typedef struct nativeWatchedOutputOpaque LDKnativeWatchedOutput;
struct nativeMultiThreadedLockableScoreOpaque;
typedef struct nativeMultiThreadedLockableScoreOpaque LDKnativeMultiThreadedLockableScore;
+struct nativeChannelUsageOpaque;
+typedef struct nativeChannelUsageOpaque LDKnativeChannelUsage;
struct nativeFixedPenaltyScorerOpaque;
typedef struct nativeFixedPenaltyScorerOpaque LDKnativeFixedPenaltyScorer;
-struct nativeScorerOpaque;
-typedef struct nativeScorerOpaque LDKnativeScorer;
-struct nativeScoringParametersOpaque;
-typedef struct nativeScoringParametersOpaque LDKnativeScoringParameters;
struct nativeProbabilisticScorerOpaque;
typedef struct nativeProbabilisticScorerOpaque LDKnativeProbabilisticScorer;
struct nativeProbabilisticScoringParametersOpaque;
typedef struct nativeInvoiceFeaturesOpaque LDKnativeInvoiceFeatures;
struct nativeChannelTypeFeaturesOpaque;
typedef struct nativeChannelTypeFeaturesOpaque LDKnativeChannelTypeFeatures;
+struct nativeNodeIdOpaque;
+typedef struct nativeNodeIdOpaque LDKnativeNodeId;
+struct nativeNetworkGraphOpaque;
+typedef struct nativeNetworkGraphOpaque LDKnativeNetworkGraph;
+struct nativeReadOnlyNetworkGraphOpaque;
+typedef struct nativeReadOnlyNetworkGraphOpaque LDKnativeReadOnlyNetworkGraph;
+struct nativeP2PGossipSyncOpaque;
+typedef struct nativeP2PGossipSyncOpaque LDKnativeP2PGossipSync;
+struct nativeChannelUpdateInfoOpaque;
+typedef struct nativeChannelUpdateInfoOpaque LDKnativeChannelUpdateInfo;
+struct nativeChannelInfoOpaque;
+typedef struct nativeChannelInfoOpaque LDKnativeChannelInfo;
+struct nativeDirectedChannelInfoOpaque;
+typedef struct nativeDirectedChannelInfoOpaque LDKnativeDirectedChannelInfo;
+struct nativeRoutingFeesOpaque;
+typedef struct nativeRoutingFeesOpaque LDKnativeRoutingFees;
+struct nativeNodeAnnouncementInfoOpaque;
+typedef struct nativeNodeAnnouncementInfoOpaque LDKnativeNodeAnnouncementInfo;
+struct nativeNodeInfoOpaque;
+typedef struct nativeNodeInfoOpaque LDKnativeNodeInfo;
struct nativeDelayedPaymentOutputDescriptorOpaque;
typedef struct nativeDelayedPaymentOutputDescriptorOpaque LDKnativeDelayedPaymentOutputDescriptor;
struct nativeStaticPaymentOutputDescriptorOpaque;
typedef struct nativeChannelConfigOpaque LDKnativeChannelConfig;
struct nativeUserConfigOpaque;
typedef struct nativeUserConfigOpaque LDKnativeUserConfig;
+struct nativeBigSizeOpaque;
+typedef struct nativeBigSizeOpaque LDKnativeBigSize;
struct nativeOutPointOpaque;
typedef struct nativeOutPointOpaque LDKnativeOutPoint;
struct nativeInvoicePayerOpaque;
typedef struct nativeInvoicePayerOpaque LDKnativeInvoicePayer;
-struct nativeRetryAttemptsOpaque;
-typedef struct nativeRetryAttemptsOpaque LDKnativeRetryAttempts;
struct nativeInvoiceOpaque;
typedef struct nativeInvoiceOpaque LDKnativeInvoice;
struct nativeSignedRawInvoiceOpaque;
typedef struct nativeHTLCUpdateOpaque LDKnativeHTLCUpdate;
struct nativeChannelMonitorOpaque;
typedef struct nativeChannelMonitorOpaque LDKnativeChannelMonitor;
+struct nativeExpandedKeyOpaque;
+typedef struct nativeExpandedKeyOpaque LDKnativeExpandedKey;
struct nativeIgnoringMessageHandlerOpaque;
typedef struct nativeIgnoringMessageHandlerOpaque LDKnativeIgnoringMessageHandler;
struct nativeErroringMessageHandlerOpaque;
typedef struct nativePeerHandleErrorOpaque LDKnativePeerHandleError;
struct nativePeerManagerOpaque;
typedef struct nativePeerManagerOpaque LDKnativePeerManager;
-struct nativeNodeIdOpaque;
-typedef struct nativeNodeIdOpaque LDKnativeNodeId;
-struct nativeNetworkGraphOpaque;
-typedef struct nativeNetworkGraphOpaque LDKnativeNetworkGraph;
-struct nativeReadOnlyNetworkGraphOpaque;
-typedef struct nativeReadOnlyNetworkGraphOpaque LDKnativeReadOnlyNetworkGraph;
-struct nativeNetGraphMsgHandlerOpaque;
-typedef struct nativeNetGraphMsgHandlerOpaque LDKnativeNetGraphMsgHandler;
-struct nativeChannelUpdateInfoOpaque;
-typedef struct nativeChannelUpdateInfoOpaque LDKnativeChannelUpdateInfo;
-struct nativeChannelInfoOpaque;
-typedef struct nativeChannelInfoOpaque LDKnativeChannelInfo;
-struct nativeDirectedChannelInfoOpaque;
-typedef struct nativeDirectedChannelInfoOpaque LDKnativeDirectedChannelInfo;
-struct nativeRoutingFeesOpaque;
-typedef struct nativeRoutingFeesOpaque LDKnativeRoutingFees;
-struct nativeNodeAnnouncementInfoOpaque;
-typedef struct nativeNodeAnnouncementInfoOpaque LDKnativeNodeAnnouncementInfo;
-struct nativeNodeInfoOpaque;
-typedef struct nativeNodeInfoOpaque LDKnativeNodeInfo;
+struct nativeRapidGossipSyncOpaque;
+typedef struct nativeRapidGossipSyncOpaque LDKnativeRapidGossipSync;
struct nativeDecodeErrorOpaque;
typedef struct nativeDecodeErrorOpaque LDKnativeDecodeError;
struct nativeInitOpaque;
typedef struct nativeFundingCreatedOpaque LDKnativeFundingCreated;
struct nativeFundingSignedOpaque;
typedef struct nativeFundingSignedOpaque LDKnativeFundingSigned;
-struct nativeFundingLockedOpaque;
-typedef struct nativeFundingLockedOpaque LDKnativeFundingLocked;
+struct nativeChannelReadyOpaque;
+typedef struct nativeChannelReadyOpaque LDKnativeChannelReady;
struct nativeShutdownOpaque;
typedef struct nativeShutdownOpaque LDKnativeShutdown;
struct nativeClosingSignedFeeRangeOpaque;
* Bad secret key
*/
LDKSecp256k1Error_InvalidSecretKey,
+ /**
+ * Bad shared secret.
+ */
+ LDKSecp256k1Error_InvalidSharedSecret,
/**
* Bad recovery id
*/
* Invalid tweak for add_assign or mul_assign
*/
LDKSecp256k1Error_InvalidTweak,
- /**
- * tweak_add_check failed on an xonly public key
- */
- LDKSecp256k1Error_TweakCheckFailed,
/**
* Didn't pass enough memory to context creation with preallocated memory
*/
LDKSecp256k1Error_NotEnoughMemory,
+ /**
+ * Bad set of public keys.
+ */
+ LDKSecp256k1Error_InvalidPublicKeySum,
+ /**
+ * The only valid parity values are 0 or 1.
+ */
+ LDKSecp256k1Error_InvalidParityValue,
/**
* Must be last for serialization purposes
*/
/**
* Implements the per-commitment secret storage scheme from
- * [BOLT 3](https://github.com/lightningnetwork/lightning-rfc/blob/dcbf8583976df087c79c3ce0b535311212e6812d/03-transactions.md#efficient-per-commitment-secret-storage).
+ * [BOLT 3](https://github.com/lightning/bolts/blob/dcbf8583976df087c79c3ce0b535311212e6812d/03-transactions.md#efficient-per-commitment-secret-storage).
*
* Allows us to keep track of all of the revocation secrets of our counterparty in just 50*32 bytes
* or so.
/**
* A script pubkey for shutting down a channel as defined by [BOLT #2].
*
- * [BOLT #2]: https://github.com/lightningnetwork/lightning-rfc/blob/master/02-peer-protocol.md
+ * [BOLT #2]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md
*/
typedef struct MUST_USE_STRUCT LDKShutdownScript {
/**
/**
* Parameters needed to find a [`Route`].
*
- * Passed to [`find_route`] and also provided in [`Event::PaymentPathFailed`] for retrying a failed
- * payment path.
+ * Passed to [`find_route`] and [`build_route_from_hops`], but also provided in
+ * [`Event::PaymentPathFailed`] for retrying a failed payment path.
*
* [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
*/
} LDKCResult_RouteLightningErrorZ;
/**
- * The contents of CResult_TxOutAccessErrorZ
- */
-typedef union LDKCResult_TxOutAccessErrorZPtr {
- /**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
- */
- struct LDKTxOut *result;
- /**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
- */
- enum LDKAccessError *err;
-} LDKCResult_TxOutAccessErrorZPtr;
-
-/**
- * A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
- * containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
- * `result_ok` indicates the overall state, and the contents are provided via `contents`.
- */
-typedef struct LDKCResult_TxOutAccessErrorZ {
- /**
- * The contents of this CResult_TxOutAccessErrorZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
- */
- union LDKCResult_TxOutAccessErrorZPtr contents;
- /**
- * Whether this CResult_TxOutAccessErrorZ represents a success state.
- */
- bool result_ok;
-} LDKCResult_TxOutAccessErrorZ;
-
-/**
- * A tuple of 2 elements. See the individual fields for the types contained.
- */
-typedef struct LDKC2Tuple_usizeTransactionZ {
- /**
- * The element at position 0
- */
- uintptr_t a;
- /**
- * The element at position 1
- */
- struct LDKTransaction b;
-} LDKC2Tuple_usizeTransactionZ;
-
-/**
- * A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
+ * A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
* This corresponds to std::vector in C++
*/
-typedef struct LDKCVec_C2Tuple_usizeTransactionZZ {
+typedef struct LDKCVec_PublicKeyZ {
/**
* The elements in the array.
* If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
*/
- struct LDKC2Tuple_usizeTransactionZ *data;
+ struct LDKPublicKey *data;
/**
* The number of elements pointed to by `data`.
*/
uintptr_t datalen;
-} LDKCVec_C2Tuple_usizeTransactionZZ;
+} LDKCVec_PublicKeyZ;
/**
* Arbitrary 32 bytes, which could represent one of a few different things. You probably want to
} LDKThirtyTwoBytes;
/**
- * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
- * This corresponds to std::vector in C++
+ * Some information provided on receipt of payment depends on whether the payment received is a
+ * spontaneous payment or a \"conventional\" lightning payment that's paying an invoice.
*/
-typedef struct LDKCVec_TxidZ {
+typedef enum LDKPaymentPurpose_Tag {
/**
- * The elements in the array.
- * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ * Information for receiving a payment that we generated an invoice for.
*/
- struct LDKThirtyTwoBytes *data;
+ LDKPaymentPurpose_InvoicePayment,
/**
- * The number of elements pointed to by `data`.
+ * Because this is a spontaneous payment, the payer generated their own preimage rather than us
+ * (the payee) providing a preimage.
*/
- uintptr_t datalen;
-} LDKCVec_TxidZ;
+ LDKPaymentPurpose_SpontaneousPayment,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKPaymentPurpose_Sentinel,
+} LDKPaymentPurpose_Tag;
+
+typedef struct LDKPaymentPurpose_LDKInvoicePayment_Body {
+ /**
+ * The preimage to the payment_hash, if the payment hash (and secret) were fetched via
+ * [`ChannelManager::create_inbound_payment`]. If provided, this can be handed directly to
+ * [`ChannelManager::claim_funds`].
+ *
+ * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
+ * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
+ *
+ * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
+ */
+ struct LDKThirtyTwoBytes payment_preimage;
+ /**
+ * The \"payment secret\". This authenticates the sender to the recipient, preventing a
+ * number of deanonymization attacks during the routing process.
+ * It is provided here for your reference, however its accuracy is enforced directly by
+ * [`ChannelManager`] using the values you previously provided to
+ * [`ChannelManager::create_inbound_payment`] or
+ * [`ChannelManager::create_inbound_payment_for_hash`].
+ *
+ * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
+ * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
+ * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
+ */
+ struct LDKThirtyTwoBytes payment_secret;
+} LDKPaymentPurpose_LDKInvoicePayment_Body;
+
+typedef struct MUST_USE_STRUCT LDKPaymentPurpose {
+ LDKPaymentPurpose_Tag tag;
+ union {
+ LDKPaymentPurpose_LDKInvoicePayment_Body invoice_payment;
+ struct {
+ struct LDKThirtyTwoBytes spontaneous_payment;
+ };
+ };
+} LDKPaymentPurpose;
/**
- * The contents of CResult_NoneChannelMonitorUpdateErrZ
+ * The contents of CResult_PaymentPurposeDecodeErrorZ
*/
-typedef union LDKCResult_NoneChannelMonitorUpdateErrZPtr {
+typedef union LDKCResult_PaymentPurposeDecodeErrorZPtr {
/**
- * Note that this value is always NULL, as there are no contents in the OK variant
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
*/
- void *result;
+ struct LDKPaymentPurpose *result;
/**
* A pointer to the contents in the error state.
* Reading from this pointer when `result_ok` is set is undefined.
*/
- enum LDKChannelMonitorUpdateErr *err;
-} LDKCResult_NoneChannelMonitorUpdateErrZPtr;
+ struct LDKDecodeError *err;
+} LDKCResult_PaymentPurposeDecodeErrorZPtr;
/**
- * A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
- * containing a () on success and a crate::lightning::chain::ChannelMonitorUpdateErr on failure.
+ * A CResult_PaymentPurposeDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::util::events::PaymentPurpose 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_NoneChannelMonitorUpdateErrZ {
+typedef struct LDKCResult_PaymentPurposeDecodeErrorZ {
/**
- * The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
+ * The contents of this CResult_PaymentPurposeDecodeErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_NoneChannelMonitorUpdateErrZPtr contents;
+ union LDKCResult_PaymentPurposeDecodeErrorZPtr contents;
/**
- * Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
+ * Whether this CResult_PaymentPurposeDecodeErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_NoneChannelMonitorUpdateErrZ;
-
-
+} LDKCResult_PaymentPurposeDecodeErrorZ;
/**
- * Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on
- * chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the
- * preimage claim backward will lead to loss of funds.
+ * The reason the channel was closed. See individual variants more details.
*/
-typedef struct MUST_USE_STRUCT LDKHTLCUpdate {
+typedef enum LDKClosureReason_Tag {
/**
- * A pointer to the opaque Rust object.
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ * Closure generated from receiving a peer error message.
+ *
+ * Our counterparty may have broadcasted their latest commitment state, and we have
+ * as well.
*/
- LDKnativeHTLCUpdate *inner;
+ LDKClosureReason_CounterpartyForceClosed,
/**
- * Indicates that this is the only struct which contains the same pointer.
- * Rust functions which take ownership of an object provided via an argument require
- * this to be true and invalidate the object pointed to by inner.
+ * Closure generated from [`ChannelManager::force_close_channel`], called by the user.
+ *
+ * [`ChannelManager::force_close_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel.
*/
- bool is_owned;
-} LDKHTLCUpdate;
-
-
-
-/**
- * A reference to a transaction output.
- *
- * Differs from bitcoin::blockdata::transaction::OutPoint as the index is a u16 instead of u32
- * due to LN's restrictions on index values. Should reduce (possibly) unsafe conversions this way.
- */
-typedef struct MUST_USE_STRUCT LDKOutPoint {
+ LDKClosureReason_HolderForceClosed,
/**
- * A pointer to the opaque Rust object.
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ * The channel was closed after negotiating a cooperative close and we've now broadcasted
+ * the cooperative close transaction. Note the shutdown may have been initiated by us.
*/
- LDKnativeOutPoint *inner;
+ LDKClosureReason_CooperativeClosure,
/**
- * Indicates that this is the only struct which contains the same pointer.
- * Rust functions which take ownership of an object provided via an argument require
- * this to be true and invalidate the object pointed to by inner.
+ * A commitment transaction was confirmed on chain, closing the channel. Most likely this
+ * commitment transaction came from our counterparty, but it may also have come from
+ * a copy of our own `ChannelMonitor`.
*/
- bool is_owned;
-} LDKOutPoint;
-
-/**
- * An event to be processed by the ChannelManager.
- */
-typedef enum LDKMonitorEvent_Tag {
+ LDKClosureReason_CommitmentTxConfirmed,
/**
- * A monitor event containing an HTLCUpdate.
+ * The funding transaction failed to confirm in a timely manner on an inbound channel.
*/
- LDKMonitorEvent_HTLCEvent,
+ LDKClosureReason_FundingTimedOut,
/**
- * A monitor event that the Channel's commitment transaction was confirmed.
+ * Closure generated from processing an event, likely a HTLC forward/relay/reception.
*/
- LDKMonitorEvent_CommitmentTxConfirmed,
+ LDKClosureReason_ProcessingError,
/**
- * Indicates a [`ChannelMonitor`] update has completed. See
- * [`ChannelMonitorUpdateErr::TemporaryFailure`] for more information on how this is used.
+ * The peer disconnected prior to funding completing. In this case the spec mandates that we
+ * forget the channel entirely - we can attempt again if the peer reconnects.
*
- * [`ChannelMonitorUpdateErr::TemporaryFailure`]: super::ChannelMonitorUpdateErr::TemporaryFailure
+ * In LDK versions prior to 0.0.107 this could also occur if we were unable to connect to the
+ * peer because of mutual incompatibility between us and our channel counterparty.
*/
- LDKMonitorEvent_UpdateCompleted,
+ LDKClosureReason_DisconnectedPeer,
/**
- * Indicates a [`ChannelMonitor`] update has failed. See
- * [`ChannelMonitorUpdateErr::PermanentFailure`] for more information on how this is used.
- *
- * [`ChannelMonitorUpdateErr::PermanentFailure`]: super::ChannelMonitorUpdateErr::PermanentFailure
+ * Closure generated from `ChannelManager::read` if the ChannelMonitor is newer than
+ * the ChannelManager deserialized.
*/
- LDKMonitorEvent_UpdateFailed,
+ LDKClosureReason_OutdatedChannelManager,
/**
* Must be last for serialization purposes
*/
- LDKMonitorEvent_Sentinel,
-} LDKMonitorEvent_Tag;
+ LDKClosureReason_Sentinel,
+} LDKClosureReason_Tag;
-typedef struct LDKMonitorEvent_LDKUpdateCompleted_Body {
+typedef struct LDKClosureReason_LDKCounterpartyForceClosed_Body {
/**
- * The funding outpoint of the [`ChannelMonitor`] that was updated
+ * The error which the peer sent us.
+ *
+ * The string should be sanitized before it is used (e.g emitted to logs
+ * or printed to stdout). Otherwise, a well crafted error message may exploit
+ * a security vulnerability in the terminal emulator or the logging subsystem.
*/
- struct LDKOutPoint funding_txo;
+ struct LDKStr peer_msg;
+} LDKClosureReason_LDKCounterpartyForceClosed_Body;
+
+typedef struct LDKClosureReason_LDKProcessingError_Body {
/**
- * The Update ID from [`ChannelMonitorUpdate::update_id`] which was applied or
- * [`ChannelMonitor::get_latest_update_id`].
- *
- * Note that this should only be set to a given update's ID if all previous updates for the
- * same [`ChannelMonitor`] have been applied and persisted.
+ * A developer-readable error message which we generated.
*/
- uint64_t monitor_update_id;
-} LDKMonitorEvent_LDKUpdateCompleted_Body;
+ struct LDKStr err;
+} LDKClosureReason_LDKProcessingError_Body;
-typedef struct MUST_USE_STRUCT LDKMonitorEvent {
- LDKMonitorEvent_Tag tag;
- union {
- struct {
- struct LDKHTLCUpdate htlc_event;
- };
- struct {
- struct LDKOutPoint commitment_tx_confirmed;
- };
- LDKMonitorEvent_LDKUpdateCompleted_Body update_completed;
- struct {
- struct LDKOutPoint update_failed;
- };
- };
-} LDKMonitorEvent;
-
-/**
- * A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
- * This corresponds to std::vector in C++
- */
-typedef struct LDKCVec_MonitorEventZ {
- /**
- * The elements in the array.
- * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
- */
- struct LDKMonitorEvent *data;
- /**
- * The number of elements pointed to by `data`.
- */
- uintptr_t datalen;
-} LDKCVec_MonitorEventZ;
-
-/**
- * An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
- */
-typedef enum LDKCOption_C2Tuple_usizeTransactionZZ_Tag {
- /**
- * When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
- */
- LDKCOption_C2Tuple_usizeTransactionZZ_Some,
- /**
- * When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
- */
- LDKCOption_C2Tuple_usizeTransactionZZ_None,
- /**
- * Must be last for serialization purposes
- */
- LDKCOption_C2Tuple_usizeTransactionZZ_Sentinel,
-} LDKCOption_C2Tuple_usizeTransactionZZ_Tag;
-
-typedef struct LDKCOption_C2Tuple_usizeTransactionZZ {
- LDKCOption_C2Tuple_usizeTransactionZZ_Tag tag;
- union {
- struct {
- struct LDKC2Tuple_usizeTransactionZ some;
- };
- };
-} LDKCOption_C2Tuple_usizeTransactionZZ;
-
-/**
- * The reason the channel was closed. See individual variants more details.
- */
-typedef enum LDKClosureReason_Tag {
- /**
- * Closure generated from receiving a peer error message.
- *
- * Our counterparty may have broadcasted their latest commitment state, and we have
- * as well.
- */
- LDKClosureReason_CounterpartyForceClosed,
- /**
- * Closure generated from [`ChannelManager::force_close_channel`], called by the user.
- *
- * [`ChannelManager::force_close_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel.
- */
- LDKClosureReason_HolderForceClosed,
- /**
- * The channel was closed after negotiating a cooperative close and we've now broadcasted
- * the cooperative close transaction. Note the shutdown may have been initiated by us.
- */
- LDKClosureReason_CooperativeClosure,
- /**
- * A commitment transaction was confirmed on chain, closing the channel. Most likely this
- * commitment transaction came from our counterparty, but it may also have come from
- * a copy of our own `ChannelMonitor`.
- */
- LDKClosureReason_CommitmentTxConfirmed,
- /**
- * The funding transaction failed to confirm in a timely manner on an inbound channel.
- */
- LDKClosureReason_FundingTimedOut,
- /**
- * Closure generated from processing an event, likely a HTLC forward/relay/reception.
- */
- LDKClosureReason_ProcessingError,
- /**
- * The `PeerManager` informed us that we've disconnected from the peer. We close channels
- * if the `PeerManager` informed us that it is unlikely we'll be able to connect to the
- * peer again in the future or if the peer disconnected before we finished negotiating
- * the channel open. The first case may be caused by incompatible features which our
- * counterparty, or we, require.
- */
- LDKClosureReason_DisconnectedPeer,
- /**
- * Closure generated from `ChannelManager::read` if the ChannelMonitor is newer than
- * the ChannelManager deserialized.
- */
- LDKClosureReason_OutdatedChannelManager,
- /**
- * Must be last for serialization purposes
- */
- LDKClosureReason_Sentinel,
-} LDKClosureReason_Tag;
-
-typedef struct LDKClosureReason_LDKCounterpartyForceClosed_Body {
- /**
- * The error which the peer sent us.
- *
- * The string should be sanitized before it is used (e.g emitted to logs
- * or printed to stdout). Otherwise, a well crafted error message may exploit
- * a security vulnerability in the terminal emulator or the logging subsystem.
- */
- struct LDKStr peer_msg;
-} LDKClosureReason_LDKCounterpartyForceClosed_Body;
-
-typedef struct LDKClosureReason_LDKProcessingError_Body {
- /**
- * A developer-readable error message which we generated.
- */
- struct LDKStr err;
-} LDKClosureReason_LDKProcessingError_Body;
-
-typedef struct MUST_USE_STRUCT LDKClosureReason {
- LDKClosureReason_Tag tag;
+typedef struct MUST_USE_STRUCT LDKClosureReason {
+ LDKClosureReason_Tag tag;
union {
LDKClosureReason_LDKCounterpartyForceClosed_Body counterparty_force_closed;
LDKClosureReason_LDKProcessingError_Body processing_error;
* Update to the [`NetworkGraph`] based on payment failure information conveyed via the Onion
* return packet by a node along the route. See [BOLT #4] for details.
*
- * [BOLT #4]: https://github.com/lightningnetwork/lightning-rfc/blob/master/04-onion-routing.md
+ * [BOLT #4]: https://github.com/lightning/bolts/blob/master/04-onion-routing.md
*/
typedef enum LDKNetworkUpdate_Tag {
/**
*/
LDKNetworkUpdate_ChannelUpdateMessage,
/**
- * An error indicating only that a channel has been closed, which should be applied via
- * [`NetworkGraph::close_channel_from_update`].
+ * An error indicating that a channel failed to route a payment, which should be applied via
+ * [`NetworkGraph::channel_failed`].
*/
- LDKNetworkUpdate_ChannelClosed,
+ LDKNetworkUpdate_ChannelFailure,
/**
- * An error indicating only that a node has failed, which should be applied via
- * [`NetworkGraph::fail_node`].
+ * An error indicating that a node failed to route a payment, which should be applied via
+ * [`NetworkGraph::node_failed`].
*/
LDKNetworkUpdate_NodeFailure,
/**
struct LDKChannelUpdate msg;
} LDKNetworkUpdate_LDKChannelUpdateMessage_Body;
-typedef struct LDKNetworkUpdate_LDKChannelClosed_Body {
+typedef struct LDKNetworkUpdate_LDKChannelFailure_Body {
/**
* The short channel id of the closed channel.
*/
* `channel_update` message is received.
*/
bool is_permanent;
-} LDKNetworkUpdate_LDKChannelClosed_Body;
+} LDKNetworkUpdate_LDKChannelFailure_Body;
typedef struct LDKNetworkUpdate_LDKNodeFailure_Body {
/**
LDKNetworkUpdate_Tag tag;
union {
LDKNetworkUpdate_LDKChannelUpdateMessage_Body channel_update_message;
- LDKNetworkUpdate_LDKChannelClosed_Body channel_closed;
+ LDKNetworkUpdate_LDKChannelFailure_Body channel_failure;
LDKNetworkUpdate_LDKNodeFailure_Body node_failure;
};
} LDKNetworkUpdate;
/**
- * An enum which can either contain a crate::lightning::routing::network_graph::NetworkUpdate or not
+ * An enum which can either contain a crate::lightning::routing::gossip::NetworkUpdate or not
*/
typedef enum LDKCOption_NetworkUpdateZ_Tag {
/**
- * When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::network_graph::NetworkUpdate
+ * When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::gossip::NetworkUpdate
*/
LDKCOption_NetworkUpdateZ_Some,
/**
+/**
+ * A reference to a transaction output.
+ *
+ * Differs from bitcoin::blockdata::transaction::OutPoint as the index is a u16 instead of u32
+ * due to LN's restrictions on index values. Should reduce (possibly) unsafe conversions this way.
+ */
+typedef struct MUST_USE_STRUCT LDKOutPoint {
+ /**
+ * 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.
+ */
+ LDKnativeOutPoint *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;
+} LDKOutPoint;
+
+
+
/**
* Information about a spendable output to a P2WSH script. See
* SpendableOutputDescriptor::DelayedPaymentOutput for more details on how to spend this.
uintptr_t datalen;
} LDKCVec_SpendableOutputDescriptorZ;
-/**
- * Some information provided on receipt of payment depends on whether the payment received is a
- * spontaneous payment or a \"conventional\" lightning payment that's paying an invoice.
- */
-typedef enum LDKPaymentPurpose_Tag {
- /**
- * Information for receiving a payment that we generated an invoice for.
- */
- LDKPaymentPurpose_InvoicePayment,
- /**
- * Because this is a spontaneous payment, the payer generated their own preimage rather than us
- * (the payee) providing a preimage.
- */
- LDKPaymentPurpose_SpontaneousPayment,
- /**
- * Must be last for serialization purposes
- */
- LDKPaymentPurpose_Sentinel,
-} LDKPaymentPurpose_Tag;
-
-typedef struct LDKPaymentPurpose_LDKInvoicePayment_Body {
- /**
- * The preimage to the payment_hash, if the payment hash (and secret) were fetched via
- * [`ChannelManager::create_inbound_payment`]. If provided, this can be handed directly to
- * [`ChannelManager::claim_funds`].
- *
- * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
- * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
- *
- * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
- */
- struct LDKThirtyTwoBytes payment_preimage;
- /**
- * The \"payment secret\". This authenticates the sender to the recipient, preventing a
- * number of deanonymization attacks during the routing process.
- * It is provided here for your reference, however its accuracy is enforced directly by
- * [`ChannelManager`] using the values you previously provided to
- * [`ChannelManager::create_inbound_payment`] or
- * [`ChannelManager::create_inbound_payment_for_hash`].
- *
- * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
- * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
- * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
- */
- struct LDKThirtyTwoBytes payment_secret;
-} LDKPaymentPurpose_LDKInvoicePayment_Body;
-
-typedef struct MUST_USE_STRUCT LDKPaymentPurpose {
- LDKPaymentPurpose_Tag tag;
- union {
- LDKPaymentPurpose_LDKInvoicePayment_Body invoice_payment;
- struct {
- struct LDKThirtyTwoBytes spontaneous_payment;
- };
- };
-} LDKPaymentPurpose;
-
/**
*/
LDKEvent_FundingGenerationReady,
/**
- * Indicates we've received money! Just gotta dig out that payment preimage and feed it to
- * [`ChannelManager::claim_funds`] to get it....
+ * Indicates we've received (an offer of) money! Just gotta dig out that payment preimage and
+ * feed it to [`ChannelManager::claim_funds`] to get it....
+ *
* Note that if the preimage is not known, you should call
* [`ChannelManager::fail_htlc_backwards`] to free up resources for this HTLC and avoid
* network congestion.
* [`ChannelManager::fail_htlc_backwards`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards
*/
LDKEvent_PaymentReceived,
+ /**
+ * Indicates a payment has been claimed and we've received money!
+ *
+ * This most likely occurs when [`ChannelManager::claim_funds`] has been called in response
+ * to an [`Event::PaymentReceived`]. However, if we previously crashed during a
+ * [`ChannelManager::claim_funds`] call you may see this event without a corresponding
+ * [`Event::PaymentReceived`] event.
+ *
+ * # Note
+ * LDK will not stop an inbound payment from being paid multiple times, so multiple
+ * `PaymentReceived` events may be generated for the same payment. If you then call
+ * [`ChannelManager::claim_funds`] twice for the same [`Event::PaymentReceived`] you may get
+ * multiple `PaymentClaimed` events.
+ *
+ * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
+ */
+ LDKEvent_PaymentClaimed,
/**
* 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).
* event. In this situation, you SHOULD treat this payment as having succeeded.
*/
LDKEvent_PaymentSent,
- /**
- * Indicates an outbound HTLC we sent failed. Probably some intermediary node dropped
- * something. You may wish to retry with a different route.
- *
- * Note that this does *not* indicate that all paths for an MPP payment have failed, see
- * [`Event::PaymentFailed`] and [`all_paths_failed`].
- *
- * [`all_paths_failed`]: Self::PaymentPathFailed::all_paths_failed
- */
- LDKEvent_PaymentPathFailed,
/**
* Indicates an outbound payment failed. Individual [`Event::PaymentPathFailed`] events
* provide failure information for each MPP part in the payment.
* [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
*/
LDKEvent_PaymentFailed,
+ /**
+ * Indicates that a path for an outbound payment was successful.
+ *
+ * Always generated after [`Event::PaymentSent`] and thus useful for scoring channels. See
+ * [`Event::PaymentSent`] for obtaining the payment preimage.
+ */
+ LDKEvent_PaymentPathSuccessful,
+ /**
+ * Indicates an outbound HTLC we sent failed. Probably some intermediary node dropped
+ * something. You may wish to retry with a different route.
+ *
+ * Note that this does *not* indicate that all paths for an MPP payment have failed, see
+ * [`Event::PaymentFailed`] and [`all_paths_failed`].
+ *
+ * [`all_paths_failed`]: Self::PaymentPathFailed::all_paths_failed
+ */
+ LDKEvent_PaymentPathFailed,
/**
* Used to indicate that [`ChannelManager::process_pending_htlc_forwards`] should be called at
* a time in the future.
*/
LDKEvent_PaymentForwarded,
/**
- * Used to indicate that a channel with the given `channel_id` is in the process of closure.
+ * Used to indicate that a previously opened channel with the given `channel_id` is in the
+ * process of closure.
*/
LDKEvent_ChannelClosed,
/**
* inputs for another purpose.
*/
LDKEvent_DiscardFunding,
- /**
- * Indicates that a path for an outbound payment was successful.
- *
- * Always generated after [`Event::PaymentSent`] and thus useful for scoring channels. See
- * [`Event::PaymentSent`] for obtaining the payment preimage.
- */
- LDKEvent_PaymentPathSuccessful,
/**
* Indicates a request to open a new channel by a peer.
*
typedef struct LDKEvent_LDKFundingGenerationReady_Body {
/**
* The random channel_id we picked which you'll need to pass into
- * ChannelManager::funding_transaction_generated.
+ * [`ChannelManager::funding_transaction_generated`].
+ *
+ * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
*/
struct LDKThirtyTwoBytes temporary_channel_id;
+ /**
+ * The counterparty's node_id, which you'll need to pass back into
+ * [`ChannelManager::funding_transaction_generated`].
+ *
+ * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
+ */
+ struct LDKPublicKey counterparty_node_id;
/**
* The value, in satoshis, that the output should have.
*/
/**
* The value, in thousandths of a satoshi, that this payment is for.
*/
- uint64_t amt;
+ uint64_t amount_msat;
/**
* Information for claiming this received payment, based on whether the purpose of the
* payment is to pay an invoice or to send a spontaneous payment.
struct LDKPaymentPurpose purpose;
} LDKEvent_LDKPaymentReceived_Body;
-typedef struct LDKEvent_LDKPaymentSent_Body {
+typedef struct LDKEvent_LDKPaymentClaimed_Body {
/**
- * The id returned by [`ChannelManager::send_payment`] and used with
- * [`ChannelManager::retry_payment`].
- *
- * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
- * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
- *
+ * The payment hash of the claimed payment. Note that LDK will not stop you from
+ * registering duplicate payment hashes for inbound payments.
+ */
+ struct LDKThirtyTwoBytes payment_hash;
+ /**
+ * The value, in thousandths of a satoshi, that this payment is for.
+ */
+ uint64_t amount_msat;
+ /**
+ * The purpose of this claimed payment, i.e. whether the payment was for an invoice or a
+ * spontaneous payment.
+ */
+ struct LDKPaymentPurpose purpose;
+} LDKEvent_LDKPaymentClaimed_Body;
+
+typedef struct LDKEvent_LDKPaymentSent_Body {
+ /**
+ * The id returned by [`ChannelManager::send_payment`] and used with
+ * [`ChannelManager::retry_payment`].
+ *
+ * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
+ * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
+ *
* Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
struct LDKThirtyTwoBytes payment_id;
struct LDKCOption_u64Z fee_paid_msat;
} LDKEvent_LDKPaymentSent_Body;
+typedef struct LDKEvent_LDKPaymentFailed_Body {
+ /**
+ * The id returned by [`ChannelManager::send_payment`] and used with
+ * [`ChannelManager::retry_payment`] and [`ChannelManager::abandon_payment`].
+ *
+ * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
+ * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
+ * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
+ */
+ struct LDKThirtyTwoBytes payment_id;
+ /**
+ * The hash that was given to [`ChannelManager::send_payment`].
+ *
+ * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
+ */
+ struct LDKThirtyTwoBytes payment_hash;
+} LDKEvent_LDKPaymentFailed_Body;
+
+typedef struct LDKEvent_LDKPaymentPathSuccessful_Body {
+ /**
+ * The id returned by [`ChannelManager::send_payment`] and used with
+ * [`ChannelManager::retry_payment`].
+ *
+ * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
+ * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
+ */
+ struct LDKThirtyTwoBytes payment_id;
+ /**
+ * The hash that was given to [`ChannelManager::send_payment`].
+ *
+ * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
+ *
+ * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
+ */
+ struct LDKThirtyTwoBytes payment_hash;
+ /**
+ * The payment path that was successful.
+ *
+ * May contain a closed channel if the HTLC sent along the path was fulfilled on chain.
+ */
+ struct LDKCVec_RouteHopZ path;
+} LDKEvent_LDKPaymentPathSuccessful_Body;
+
typedef struct LDKEvent_LDKPaymentPathFailed_Body {
/**
* The id returned by [`ChannelManager::send_payment`] and used with
* payment route.
*
* Should be applied to the [`NetworkGraph`] so that routing decisions can take into
- * account the update. [`NetGraphMsgHandler`] is capable of doing this.
+ * account the update.
*
- * [`NetworkGraph`]: crate::routing::network_graph::NetworkGraph
- * [`NetGraphMsgHandler`]: crate::routing::network_graph::NetGraphMsgHandler
+ * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph
*/
struct LDKCOption_NetworkUpdateZ network_update;
/**
/**
* The channel responsible for the failed payment path.
*
+ * Note that for route hints or for the first hop in a path this may be an SCID alias and
+ * may not refer to a channel in the public network graph. These aliases may also collide
+ * with channels in the public network graph.
+ *
* If this is `Some`, then the corresponding channel should be avoided when the payment is
* retried. May be `None` for older [`Event`] serializations.
*/
struct LDKRouteParameters retry;
} LDKEvent_LDKPaymentPathFailed_Body;
-typedef struct LDKEvent_LDKPaymentFailed_Body {
- /**
- * The id returned by [`ChannelManager::send_payment`] and used with
- * [`ChannelManager::retry_payment`] and [`ChannelManager::abandon_payment`].
- *
- * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
- * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
- * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
- */
- struct LDKThirtyTwoBytes payment_id;
- /**
- * The hash that was given to [`ChannelManager::send_payment`].
- *
- * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
- */
- struct LDKThirtyTwoBytes payment_hash;
-} LDKEvent_LDKPaymentFailed_Body;
-
typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body {
/**
* The minimum amount of time that should be waited prior to calling
} LDKEvent_LDKSpendableOutputs_Body;
typedef struct LDKEvent_LDKPaymentForwarded_Body {
+ /**
+ * The incoming channel between the previous node and us. This is only `None` for events
+ * generated or serialized by versions prior to 0.0.107.
+ *
+ * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
+ */
+ struct LDKThirtyTwoBytes prev_channel_id;
+ /**
+ * The outgoing channel between the next node and us. This is only `None` for events
+ * generated or serialized by versions prior to 0.0.107.
+ *
+ * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
+ */
+ struct LDKThirtyTwoBytes next_channel_id;
/**
* The fee, in milli-satoshis, which was earned as a result of the payment.
*
struct LDKTransaction transaction;
} LDKEvent_LDKDiscardFunding_Body;
-typedef struct LDKEvent_LDKPaymentPathSuccessful_Body {
- /**
- * The id returned by [`ChannelManager::send_payment`] and used with
- * [`ChannelManager::retry_payment`].
- *
- * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
- * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
- */
- struct LDKThirtyTwoBytes payment_id;
- /**
- * The hash that was given to [`ChannelManager::send_payment`].
- *
- * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
- *
- * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
- */
- struct LDKThirtyTwoBytes payment_hash;
- /**
- * The payment path that was successful.
- *
- * May contain a closed channel if the HTLC sent along the path was fulfilled on chain.
- */
- struct LDKCVec_RouteHopZ path;
-} LDKEvent_LDKPaymentPathSuccessful_Body;
-
typedef struct LDKEvent_LDKOpenChannelRequest_Body {
/**
* The temporary channel ID of the channel requested to be opened.
*
* When responding to the request, the `temporary_channel_id` should be passed
- * back to the ChannelManager with [`ChannelManager::accept_inbound_channel`] to accept,
- * or to [`ChannelManager::force_close_channel`] to reject.
+ * back to the ChannelManager through [`ChannelManager::accept_inbound_channel`] to accept,
+ * or through [`ChannelManager::force_close_channel`] to reject.
*
* [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
* [`ChannelManager::force_close_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel
struct LDKThirtyTwoBytes temporary_channel_id;
/**
* The node_id of the counterparty requesting to open the channel.
+ *
+ * When responding to the request, the `counterparty_node_id` should be passed
+ * back to the `ChannelManager` through [`ChannelManager::accept_inbound_channel`] to
+ * accept the request, or through [`ChannelManager::force_close_channel`] to reject the
+ * request.
+ *
+ * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
+ * [`ChannelManager::force_close_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel
*/
struct LDKPublicKey counterparty_node_id;
/**
* the resulting [`ChannelManager`] will not be readable by versions of LDK prior to
* 0.0.106.
*
+ * Furthermore, note that if [`ChannelTypeFeatures::supports_zero_conf`] returns true on this type,
+ * the resulting [`ChannelManager`] will not be readable by versions of LDK prior to
+ * 0.0.107. Channels setting this type also need to get manually accepted via
+ * [`crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`],
+ * or will be rejected otherwise.
+ *
* [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
*/
struct LDKChannelTypeFeatures channel_type;
union {
LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready;
LDKEvent_LDKPaymentReceived_Body payment_received;
+ LDKEvent_LDKPaymentClaimed_Body payment_claimed;
LDKEvent_LDKPaymentSent_Body payment_sent;
- LDKEvent_LDKPaymentPathFailed_Body payment_path_failed;
LDKEvent_LDKPaymentFailed_Body payment_failed;
+ LDKEvent_LDKPaymentPathSuccessful_Body payment_path_successful;
+ LDKEvent_LDKPaymentPathFailed_Body payment_path_failed;
LDKEvent_LDKPendingHTLCsForwardable_Body pending_htl_cs_forwardable;
LDKEvent_LDKSpendableOutputs_Body spendable_outputs;
LDKEvent_LDKPaymentForwarded_Body payment_forwarded;
LDKEvent_LDKChannelClosed_Body channel_closed;
LDKEvent_LDKDiscardFunding_Body discard_funding;
- LDKEvent_LDKPaymentPathSuccessful_Body payment_path_successful;
LDKEvent_LDKOpenChannelRequest_Body open_channel_request;
};
} LDKEvent;
/**
- * A funding_locked message to be sent or received from a peer
+ * A channel_ready message to be sent or received from a peer
*/
-typedef struct MUST_USE_STRUCT LDKFundingLocked {
+typedef struct MUST_USE_STRUCT LDKChannelReady {
/**
* 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.
*/
- LDKnativeFundingLocked *inner;
+ LDKnativeChannelReady *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;
-} LDKFundingLocked;
+} LDKChannelReady;
*/
LDKMessageSendEvent_SendFundingSigned,
/**
- * Used to indicate that a funding_locked message should be sent to the peer with the given node_id.
+ * Used to indicate that a channel_ready message should be sent to the peer with the given node_id.
*/
- LDKMessageSendEvent_SendFundingLocked,
+ LDKMessageSendEvent_SendChannelReady,
/**
* Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id.
*/
struct LDKFundingSigned msg;
} LDKMessageSendEvent_LDKSendFundingSigned_Body;
-typedef struct LDKMessageSendEvent_LDKSendFundingLocked_Body {
+typedef struct LDKMessageSendEvent_LDKSendChannelReady_Body {
/**
* The node_id of the node which should receive these message(s)
*/
struct LDKPublicKey node_id;
/**
- * The funding_locked message which should be sent.
+ * The channel_ready message which should be sent.
*/
- struct LDKFundingLocked msg;
-} LDKMessageSendEvent_LDKSendFundingLocked_Body;
+ struct LDKChannelReady msg;
+} LDKMessageSendEvent_LDKSendChannelReady_Body;
typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body {
/**
LDKMessageSendEvent_LDKSendOpenChannel_Body send_open_channel;
LDKMessageSendEvent_LDKSendFundingCreated_Body send_funding_created;
LDKMessageSendEvent_LDKSendFundingSigned_Body send_funding_signed;
- LDKMessageSendEvent_LDKSendFundingLocked_Body send_funding_locked;
+ LDKMessageSendEvent_LDKSendChannelReady_Body send_channel_ready;
LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body send_announcement_signatures;
LDKMessageSendEvent_LDKUpdateHTLCs_Body update_htl_cs;
LDKMessageSendEvent_LDKSendRevokeAndACK_Body send_revoke_and_ack;
uintptr_t datalen;
} LDKCVec_MessageSendEventZ;
-
-
-/**
- * [`Score`] implementation that uses a fixed penalty.
- */
-typedef struct MUST_USE_STRUCT LDKFixedPenaltyScorer {
- /**
- * 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.
- */
- LDKnativeFixedPenaltyScorer *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;
-} LDKFixedPenaltyScorer;
-
/**
- * The contents of CResult_FixedPenaltyScorerDecodeErrorZ
+ * The contents of CResult_TxOutAccessErrorZ
*/
-typedef union LDKCResult_FixedPenaltyScorerDecodeErrorZPtr {
+typedef union LDKCResult_TxOutAccessErrorZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKFixedPenaltyScorer *result;
+ struct LDKTxOut *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_FixedPenaltyScorerDecodeErrorZPtr;
+ enum LDKAccessError *err;
+} LDKCResult_TxOutAccessErrorZPtr;
/**
- * A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
+ * containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_FixedPenaltyScorerDecodeErrorZ {
+typedef struct LDKCResult_TxOutAccessErrorZ {
/**
- * The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
+ * The contents of this CResult_TxOutAccessErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_FixedPenaltyScorerDecodeErrorZPtr contents;
+ union LDKCResult_TxOutAccessErrorZPtr contents;
/**
- * Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
+ * Whether this CResult_TxOutAccessErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_FixedPenaltyScorerDecodeErrorZ;
+} LDKCResult_TxOutAccessErrorZ;
+/**
+ * A tuple of 2 elements. See the individual fields for the types contained.
+ */
+typedef struct LDKC2Tuple_usizeTransactionZ {
+ /**
+ * The element at position 0
+ */
+ uintptr_t a;
+ /**
+ * The element at position 1
+ */
+ struct LDKTransaction b;
+} LDKC2Tuple_usizeTransactionZ;
+/**
+ * A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
+ * This corresponds to std::vector in C++
+ */
+typedef struct LDKCVec_C2Tuple_usizeTransactionZZ {
+ /**
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ */
+ struct LDKC2Tuple_usizeTransactionZ *data;
+ /**
+ * The number of elements pointed to by `data`.
+ */
+ uintptr_t datalen;
+} LDKCVec_C2Tuple_usizeTransactionZZ;
/**
- * Parameters for configuring [`Scorer`].
+ * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
+ * This corresponds to std::vector in C++
*/
-typedef struct MUST_USE_STRUCT LDKScoringParameters {
+typedef struct LDKCVec_TxidZ {
/**
- * A pointer to the opaque Rust object.
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
*/
- LDKnativeScoringParameters *inner;
+ struct LDKThirtyTwoBytes *data;
/**
- * Indicates that this is the only struct which contains the same pointer.
- * Rust functions which take ownership of an object provided via an argument require
- * this to be true and invalidate the object pointed to by inner.
+ * The number of elements pointed to by `data`.
*/
- bool is_owned;
-} LDKScoringParameters;
+ uintptr_t datalen;
+} LDKCVec_TxidZ;
/**
- * The contents of CResult_ScoringParametersDecodeErrorZ
+ * The contents of CResult_NoneChannelMonitorUpdateErrZ
*/
-typedef union LDKCResult_ScoringParametersDecodeErrorZPtr {
+typedef union LDKCResult_NoneChannelMonitorUpdateErrZPtr {
/**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
+ * Note that this value is always NULL, as there are no contents in the OK variant
*/
- struct LDKScoringParameters *result;
+ void *result;
/**
* A pointer to the contents in the error state.
* Reading from this pointer when `result_ok` is set is undefined.
*/
- struct LDKDecodeError *err;
-} LDKCResult_ScoringParametersDecodeErrorZPtr;
+ enum LDKChannelMonitorUpdateErr *err;
+} LDKCResult_NoneChannelMonitorUpdateErrZPtr;
/**
- * A CResult_ScoringParametersDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::lightning::routing::scoring::ScoringParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
+ * containing a () on success and a crate::lightning::chain::ChannelMonitorUpdateErr on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_ScoringParametersDecodeErrorZ {
+typedef struct LDKCResult_NoneChannelMonitorUpdateErrZ {
/**
- * The contents of this CResult_ScoringParametersDecodeErrorZ, accessible via either
+ * The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_ScoringParametersDecodeErrorZPtr contents;
+ union LDKCResult_NoneChannelMonitorUpdateErrZPtr contents;
/**
- * Whether this CResult_ScoringParametersDecodeErrorZ represents a success state.
+ * Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
*/
bool result_ok;
-} LDKCResult_ScoringParametersDecodeErrorZ;
+} LDKCResult_NoneChannelMonitorUpdateErrZ;
/**
- * [`Score`] implementation that provides reasonable default behavior.
- *
- * Used to apply a fixed penalty to each channel, thus avoiding long paths when shorter paths with
- * slightly higher fees are available. Will further penalize channels that fail to relay payments.
- *
- * See [module-level documentation] for usage and [`ScoringParameters`] for customization.
- *
- * # Note
- *
- * Mixing the `no-std` feature between serialization and deserialization results in undefined
- * behavior.
- *
- * [module-level documentation]: crate::routing::scoring
+ * Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on
+ * chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the
+ * preimage claim backward will lead to loss of funds.
*/
-typedef struct MUST_USE_STRUCT LDKScorer {
+typedef struct MUST_USE_STRUCT LDKHTLCUpdate {
/**
* A pointer to the opaque Rust object.
* Nearly everywhere, inner must be non-null, however in places where
* the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- LDKnativeScorer *inner;
+ LDKnativeHTLCUpdate *inner;
/**
* Indicates that this is the only struct which contains the same pointer.
* Rust functions which take ownership of an object provided via an argument require
* this to be true and invalidate the object pointed to by inner.
*/
bool is_owned;
-} LDKScorer;
+} LDKHTLCUpdate;
/**
- * The contents of CResult_ScorerDecodeErrorZ
+ * An event to be processed by the ChannelManager.
*/
-typedef union LDKCResult_ScorerDecodeErrorZPtr {
+typedef enum LDKMonitorEvent_Tag {
/**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
+ * A monitor event containing an HTLCUpdate.
*/
- struct LDKScorer *result;
+ LDKMonitorEvent_HTLCEvent,
/**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
+ * A monitor event that the Channel's commitment transaction was confirmed.
*/
- struct LDKDecodeError *err;
-} LDKCResult_ScorerDecodeErrorZPtr;
-
-/**
- * A CResult_ScorerDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::lightning::routing::scoring::Scorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
- * `result_ok` indicates the overall state, and the contents are provided via `contents`.
- */
-typedef struct LDKCResult_ScorerDecodeErrorZ {
+ LDKMonitorEvent_CommitmentTxConfirmed,
/**
- * The contents of this CResult_ScorerDecodeErrorZ, accessible via either
+ * Indicates a [`ChannelMonitor`] update has completed. See
+ * [`ChannelMonitorUpdateErr::TemporaryFailure`] for more information on how this is used.
+ *
+ * [`ChannelMonitorUpdateErr::TemporaryFailure`]: super::ChannelMonitorUpdateErr::TemporaryFailure
+ */
+ LDKMonitorEvent_UpdateCompleted,
+ /**
+ * Indicates a [`ChannelMonitor`] update has failed. See
+ * [`ChannelMonitorUpdateErr::PermanentFailure`] for more information on how this is used.
+ *
+ * [`ChannelMonitorUpdateErr::PermanentFailure`]: super::ChannelMonitorUpdateErr::PermanentFailure
+ */
+ LDKMonitorEvent_UpdateFailed,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKMonitorEvent_Sentinel,
+} LDKMonitorEvent_Tag;
+
+typedef struct LDKMonitorEvent_LDKUpdateCompleted_Body {
+ /**
+ * The funding outpoint of the [`ChannelMonitor`] that was updated
+ */
+ struct LDKOutPoint funding_txo;
+ /**
+ * The Update ID from [`ChannelMonitorUpdate::update_id`] which was applied or
+ * [`ChannelMonitor::get_latest_update_id`].
+ *
+ * Note that this should only be set to a given update's ID if all previous updates for the
+ * same [`ChannelMonitor`] have been applied and persisted.
+ */
+ uint64_t monitor_update_id;
+} LDKMonitorEvent_LDKUpdateCompleted_Body;
+
+typedef struct MUST_USE_STRUCT LDKMonitorEvent {
+ LDKMonitorEvent_Tag tag;
+ union {
+ struct {
+ struct LDKHTLCUpdate htlc_event;
+ };
+ struct {
+ struct LDKOutPoint commitment_tx_confirmed;
+ };
+ LDKMonitorEvent_LDKUpdateCompleted_Body update_completed;
+ struct {
+ struct LDKOutPoint update_failed;
+ };
+ };
+} LDKMonitorEvent;
+
+/**
+ * A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
+ * This corresponds to std::vector in C++
+ */
+typedef struct LDKCVec_MonitorEventZ {
+ /**
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ */
+ struct LDKMonitorEvent *data;
+ /**
+ * The number of elements pointed to by `data`.
+ */
+ uintptr_t datalen;
+} LDKCVec_MonitorEventZ;
+
+/**
+ * A tuple of 2 elements. See the individual fields for the types contained.
+ */
+typedef struct LDKC2Tuple_OutPointCVec_MonitorEventZZ {
+ /**
+ * The element at position 0
+ */
+ struct LDKOutPoint a;
+ /**
+ * The element at position 1
+ */
+ struct LDKCVec_MonitorEventZ b;
+} LDKC2Tuple_OutPointCVec_MonitorEventZZ;
+
+/**
+ * A dynamically-allocated array of crate::c_types::derived::C2Tuple_OutPointCVec_MonitorEventZZs of arbitrary size.
+ * This corresponds to std::vector in C++
+ */
+typedef struct LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ {
+ /**
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ */
+ struct LDKC2Tuple_OutPointCVec_MonitorEventZZ *data;
+ /**
+ * The number of elements pointed to by `data`.
+ */
+ uintptr_t datalen;
+} LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ;
+
+/**
+ * An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
+ */
+typedef enum LDKCOption_C2Tuple_usizeTransactionZZ_Tag {
+ /**
+ * When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
+ */
+ LDKCOption_C2Tuple_usizeTransactionZZ_Some,
+ /**
+ * When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
+ */
+ LDKCOption_C2Tuple_usizeTransactionZZ_None,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKCOption_C2Tuple_usizeTransactionZZ_Sentinel,
+} LDKCOption_C2Tuple_usizeTransactionZZ_Tag;
+
+typedef struct LDKCOption_C2Tuple_usizeTransactionZZ {
+ LDKCOption_C2Tuple_usizeTransactionZZ_Tag tag;
+ union {
+ struct {
+ struct LDKC2Tuple_usizeTransactionZ some;
+ };
+ };
+} LDKCOption_C2Tuple_usizeTransactionZZ;
+
+
+
+/**
+ * [`Score`] implementation that uses a fixed penalty.
+ */
+typedef struct MUST_USE_STRUCT LDKFixedPenaltyScorer {
+ /**
+ * 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.
+ */
+ LDKnativeFixedPenaltyScorer *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;
+} LDKFixedPenaltyScorer;
+
+/**
+ * The contents of CResult_FixedPenaltyScorerDecodeErrorZ
+ */
+typedef union LDKCResult_FixedPenaltyScorerDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKFixedPenaltyScorer *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_FixedPenaltyScorerDecodeErrorZPtr;
+
+/**
+ * A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::routing::scoring::FixedPenaltyScorer 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_FixedPenaltyScorerDecodeErrorZ {
+ /**
+ * The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_ScorerDecodeErrorZPtr contents;
+ union LDKCResult_FixedPenaltyScorerDecodeErrorZPtr contents;
/**
- * Whether this CResult_ScorerDecodeErrorZ represents a success state.
+ * Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_ScorerDecodeErrorZ;
+} LDKCResult_FixedPenaltyScorerDecodeErrorZ;
+
+
+
+/**
+ * A Record, unit of logging output with Metadata to enable filtering
+ * Module_path, file, line to inform on log's source
+ */
+typedef struct MUST_USE_STRUCT LDKRecord {
+ /**
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeRecord *inner;
+ /**
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
+ */
+ bool is_owned;
+} LDKRecord;
+
+/**
+ * A trait encapsulating the operations required of a logger
+ */
+typedef struct LDKLogger {
+ /**
+ * 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;
+ /**
+ * Logs the `Record`
+ */
+ void (*log)(const void *this_arg, const struct LDKRecord *NONNULL_PTR record);
+ /**
+ * 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);
+} LDKLogger;
bool result_ok;
} LDKCResult_ChannelTypeFeaturesDecodeErrorZ;
+
+
/**
- * The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
+ * Represents the compressed public key of a node
*/
-typedef union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
+typedef struct MUST_USE_STRUCT LDKNodeId {
+ /**
+ * 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.
+ */
+ LDKnativeNodeId *inner;
+ /**
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
+ */
+ bool is_owned;
+} LDKNodeId;
+
+/**
+ * The contents of CResult_NodeIdDecodeErrorZ
+ */
+typedef union LDKCResult_NodeIdDecodeErrorZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKDelayedPaymentOutputDescriptor *result;
+ struct LDKNodeId *result;
/**
* A pointer to the contents in the error state.
* Reading from this pointer when `result_ok` is set is undefined.
*/
struct LDKDecodeError *err;
-} LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr;
+} LDKCResult_NodeIdDecodeErrorZPtr;
/**
- * A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::routing::gossip::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
+typedef struct LDKCResult_NodeIdDecodeErrorZ {
/**
- * The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
+ * The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr contents;
+ union LDKCResult_NodeIdDecodeErrorZPtr contents;
/**
- * Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
+ * Whether this CResult_NodeIdDecodeErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ;
+} LDKCResult_NodeIdDecodeErrorZ;
/**
- * The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
+ * The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
*/
-typedef union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
+typedef union LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKStaticPaymentOutputDescriptor *result;
+ struct LDKCOption_NetworkUpdateZ *result;
/**
* A pointer to the contents in the error state.
* Reading from this pointer when `result_ok` is set is undefined.
*/
struct LDKDecodeError *err;
-} LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr;
+} LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr;
/**
- * A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
- * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ * A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ {
+typedef struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ {
/**
- * The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
+ * The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr contents;
+ union LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr contents;
/**
- * Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
+ * Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ;
+} LDKCResult_COption_NetworkUpdateZDecodeErrorZ;
/**
- * The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
+ * The `Access` trait defines behavior for accessing chain data and state, such as blocks and
+ * UTXOs.
*/
-typedef union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr {
+typedef struct LDKAccess {
+ /**
+ * An opaque pointer which is passed to your function implementations as an argument.
+ * This has no meaning in the LDK, and can be NULL or any other value.
+ */
+ void *this_arg;
+ /**
+ * Returns the 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.
+ *
+ * [`short_channel_id`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#definition-of-short_channel_id
+ */
+ struct LDKCResult_TxOutAccessErrorZ (*get_utxo)(const void *this_arg, const uint8_t (*genesis_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.
+ */
+ void (*free)(void *this_arg);
+} LDKAccess;
+
+/**
+ * An enum which can either contain a crate::lightning::chain::Access or not
+ */
+typedef enum LDKCOption_AccessZ_Tag {
+ /**
+ * When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
+ */
+ LDKCOption_AccessZ_Some,
+ /**
+ * When we're in this state, this COption_AccessZ contains nothing
+ */
+ LDKCOption_AccessZ_None,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKCOption_AccessZ_Sentinel,
+} LDKCOption_AccessZ_Tag;
+
+typedef struct LDKCOption_AccessZ {
+ LDKCOption_AccessZ_Tag tag;
+ union {
+ struct {
+ struct LDKAccess some;
+ };
+ };
+} LDKCOption_AccessZ;
+
+/**
+ * The contents of CResult_boolLightningErrorZ
+ */
+typedef union LDKCResult_boolLightningErrorZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKSpendableOutputDescriptor *result;
+ bool *result;
/**
* A pointer to the contents in the error state.
* Reading from this pointer when `result_ok` is set is undefined.
*/
- struct LDKDecodeError *err;
-} LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr;
+ struct LDKLightningError *err;
+} LDKCResult_boolLightningErrorZPtr;
/**
- * A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * A CResult_boolLightningErrorZ represents the result of a fallible operation,
+ * containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ {
+typedef struct LDKCResult_boolLightningErrorZ {
/**
- * The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
+ * The contents of this CResult_boolLightningErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr contents;
+ union LDKCResult_boolLightningErrorZPtr contents;
/**
- * Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
+ * Whether this CResult_boolLightningErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_SpendableOutputDescriptorDecodeErrorZ;
+} LDKCResult_boolLightningErrorZ;
/**
- * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
+ * A tuple of 3 elements. See the individual fields for the types contained.
+ */
+typedef struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
+ /**
+ * The element at position 0
+ */
+ struct LDKChannelAnnouncement a;
+ /**
+ * The element at position 1
+ */
+ struct LDKChannelUpdate b;
+ /**
+ * The element at position 2
+ */
+ struct LDKChannelUpdate c;
+} LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ;
+
+/**
+ * A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
* This corresponds to std::vector in C++
*/
-typedef struct LDKCVec_PaymentPreimageZ {
+typedef struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
/**
* The elements in the array.
* If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
*/
- struct LDKThirtyTwoBytes *data;
+ struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *data;
/**
* The number of elements pointed to by `data`.
*/
uintptr_t datalen;
-} LDKCVec_PaymentPreimageZ;
+} LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ;
/**
- * A tuple of 2 elements. See the individual fields for the types contained.
+ * A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
+ * This corresponds to std::vector in C++
*/
-typedef struct LDKC2Tuple_SignatureCVec_SignatureZZ {
+typedef struct LDKCVec_NodeAnnouncementZ {
/**
- * The element at position 0
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
*/
- struct LDKSignature a;
+ struct LDKNodeAnnouncement *data;
/**
- * The element at position 1
+ * The number of elements pointed to by `data`.
*/
- struct LDKCVec_SignatureZ b;
-} LDKC2Tuple_SignatureCVec_SignatureZZ;
+ uintptr_t datalen;
+} LDKCVec_NodeAnnouncementZ;
/**
- * The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
+ * The contents of CResult_NoneLightningErrorZ
*/
-typedef union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
+typedef union LDKCResult_NoneLightningErrorZPtr {
/**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
+ * Note that this value is always NULL, as there are no contents in the OK variant
*/
- struct LDKC2Tuple_SignatureCVec_SignatureZZ *result;
+ void *result;
/**
- * Note that this value is always NULL, as there are no contents in the Err variant
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
*/
- void *err;
-} LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr;
+ struct LDKLightningError *err;
+} LDKCResult_NoneLightningErrorZPtr;
/**
- * A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
- * containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
+ * A CResult_NoneLightningErrorZ represents the result of a fallible operation,
+ * containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
+typedef struct LDKCResult_NoneLightningErrorZ {
/**
- * The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
+ * The contents of this CResult_NoneLightningErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr contents;
+ union LDKCResult_NoneLightningErrorZPtr contents;
/**
- * Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
+ * Whether this CResult_NoneLightningErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ;
+} LDKCResult_NoneLightningErrorZ;
+
+
/**
- * The contents of CResult_SignatureNoneZ
+ * Details about one direction of a channel as received within a [`ChannelUpdate`].
*/
-typedef union LDKCResult_SignatureNoneZPtr {
+typedef struct MUST_USE_STRUCT LDKChannelUpdateInfo {
+ /**
+ * 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.
+ */
+ LDKnativeChannelUpdateInfo *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;
+} LDKChannelUpdateInfo;
+
+/**
+ * The contents of CResult_ChannelUpdateInfoDecodeErrorZ
+ */
+typedef union LDKCResult_ChannelUpdateInfoDecodeErrorZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKSignature *result;
+ struct LDKChannelUpdateInfo *result;
/**
- * Note that this value is always NULL, as there are no contents in the Err variant
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
*/
- void *err;
-} LDKCResult_SignatureNoneZPtr;
+ struct LDKDecodeError *err;
+} LDKCResult_ChannelUpdateInfoDecodeErrorZPtr;
/**
- * A CResult_SignatureNoneZ represents the result of a fallible operation,
- * containing a crate::c_types::Signature on success and a () on failure.
+ * A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::routing::gossip::ChannelUpdateInfo 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_SignatureNoneZ {
+typedef struct LDKCResult_ChannelUpdateInfoDecodeErrorZ {
/**
- * The contents of this CResult_SignatureNoneZ, accessible via either
+ * The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_SignatureNoneZPtr contents;
+ union LDKCResult_ChannelUpdateInfoDecodeErrorZPtr contents;
/**
- * Whether this CResult_SignatureNoneZ represents a success state.
+ * Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_SignatureNoneZ;
+} LDKCResult_ChannelUpdateInfoDecodeErrorZ;
+
+
/**
- * A tuple of 2 elements. See the individual fields for the types contained.
+ * Details about a channel (both directions).
+ * Received within a channel announcement.
*/
-typedef struct LDKC2Tuple_SignatureSignatureZ {
+typedef struct MUST_USE_STRUCT LDKChannelInfo {
/**
- * The element at position 0
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- struct LDKSignature a;
+ LDKnativeChannelInfo *inner;
/**
- * The element at position 1
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
*/
- struct LDKSignature b;
-} LDKC2Tuple_SignatureSignatureZ;
+ bool is_owned;
+} LDKChannelInfo;
/**
- * The contents of CResult_C2Tuple_SignatureSignatureZNoneZ
+ * The contents of CResult_ChannelInfoDecodeErrorZ
*/
-typedef union LDKCResult_C2Tuple_SignatureSignatureZNoneZPtr {
+typedef union LDKCResult_ChannelInfoDecodeErrorZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKC2Tuple_SignatureSignatureZ *result;
+ struct LDKChannelInfo *result;
/**
- * Note that this value is always NULL, as there are no contents in the Err variant
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
*/
- void *err;
-} LDKCResult_C2Tuple_SignatureSignatureZNoneZPtr;
+ struct LDKDecodeError *err;
+} LDKCResult_ChannelInfoDecodeErrorZPtr;
/**
- * A CResult_C2Tuple_SignatureSignatureZNoneZ represents the result of a fallible operation,
- * containing a crate::c_types::derived::C2Tuple_SignatureSignatureZ on success and a () on failure.
+ * A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::routing::gossip::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ {
+typedef struct LDKCResult_ChannelInfoDecodeErrorZ {
/**
- * The contents of this CResult_C2Tuple_SignatureSignatureZNoneZ, accessible via either
+ * The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_C2Tuple_SignatureSignatureZNoneZPtr contents;
+ union LDKCResult_ChannelInfoDecodeErrorZPtr contents;
/**
- * Whether this CResult_C2Tuple_SignatureSignatureZNoneZ represents a success state.
+ * Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_C2Tuple_SignatureSignatureZNoneZ;
+} LDKCResult_ChannelInfoDecodeErrorZ;
+
+
/**
- * The contents of CResult_SecretKeyNoneZ
+ * Fees for routing via a given channel or a node
*/
-typedef union LDKCResult_SecretKeyNoneZPtr {
+typedef struct MUST_USE_STRUCT LDKRoutingFees {
+ /**
+ * 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.
+ */
+ LDKnativeRoutingFees *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;
+} LDKRoutingFees;
+
+/**
+ * The contents of CResult_RoutingFeesDecodeErrorZ
+ */
+typedef union LDKCResult_RoutingFeesDecodeErrorZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKSecretKey *result;
+ struct LDKRoutingFees *result;
/**
- * Note that this value is always NULL, as there are no contents in the Err variant
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
*/
- void *err;
-} LDKCResult_SecretKeyNoneZPtr;
+ struct LDKDecodeError *err;
+} LDKCResult_RoutingFeesDecodeErrorZPtr;
/**
- * A CResult_SecretKeyNoneZ represents the result of a fallible operation,
- * containing a crate::c_types::SecretKey on success and a () on failure.
+ * A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::routing::gossip::RoutingFees 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_SecretKeyNoneZ {
+typedef struct LDKCResult_RoutingFeesDecodeErrorZ {
/**
- * The contents of this CResult_SecretKeyNoneZ, accessible via either
+ * The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_SecretKeyNoneZPtr contents;
+ union LDKCResult_RoutingFeesDecodeErrorZPtr contents;
/**
- * Whether this CResult_SecretKeyNoneZ represents a success state.
+ * Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_SecretKeyNoneZ;
-
-
+} LDKCResult_RoutingFeesDecodeErrorZ;
/**
- * This class tracks the per-transaction information needed to build a closing transaction and will
- * actually build it and sign.
- *
- * This class can be used inside a signer implementation to generate a signature given the relevant
- * secret key.
+ * A 4-byte byte array.
*/
-typedef struct MUST_USE_STRUCT LDKClosingTransaction {
- /**
- * A pointer to the opaque Rust object.
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
- */
- LDKnativeClosingTransaction *inner;
+typedef struct LDKFourBytes {
/**
- * Indicates that this is the only struct which contains the same pointer.
- * Rust functions which take ownership of an object provided via an argument require
- * this to be true and invalidate the object pointed to by inner.
+ * The four bytes
*/
- bool is_owned;
-} LDKClosingTransaction;
-
-
+ uint8_t data[4];
+} LDKFourBytes;
/**
- * The unsigned part of a channel_announcement
+ * A 16-byte byte array.
*/
-typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement {
+typedef struct LDKSixteenBytes {
/**
- * A pointer to the opaque Rust object.
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ * The sixteen bytes
*/
- LDKnativeUnsignedChannelAnnouncement *inner;
+ uint8_t data[16];
+} LDKSixteenBytes;
+
+/**
+ * A 12-byte byte array.
+ */
+typedef struct LDKTwelveBytes {
/**
- * Indicates that this is the only struct which contains the same pointer.
- * Rust functions which take ownership of an object provided via an argument require
- * this to be true and invalidate the object pointed to by inner.
+ * The twelve bytes
*/
- bool is_owned;
-} LDKUnsignedChannelAnnouncement;
+ uint8_t data[12];
+} LDKTwelveBytes;
/**
- * A trait to sign lightning channel transactions as described in BOLT 3.
- *
- * Signing services could be implemented on a hardware wallet. In this case,
- * the current Sign would be a front-end on top of a communication
- * channel connected to your secure device and lightning key material wouldn't
- * reside on a hot server. Nevertheless, a this deployment would still need
- * to trust the ChannelManager to avoid loss of funds as this latest component
- * could ask to sign commitment transaction with HTLCs paying to attacker pubkeys.
- *
- * A more secure iteration would be to use hashlock (or payment points) to pair
- * invoice/incoming HTLCs with outgoing HTLCs to implement a no-trust-ChannelManager
- * at the price of more state and computation on the hardware wallet side. In the future,
- * we are looking forward to design such interface.
- *
- * In any case, ChannelMonitor or fallback watchtowers are always going to be trusted
- * to act, as liveness and breach reply correctness are always going to be hard requirements
- * of LN security model, orthogonal of key management issues.
+ * An address which can be used to connect to a remote peer
*/
-typedef struct LDKBaseSign {
+typedef enum LDKNetAddress_Tag {
/**
- * An opaque pointer which is passed to your function implementations as an argument.
- * This has no meaning in the LDK, and can be NULL or any other value.
+ * An IPv4 address/port on which the peer is listening.
*/
- void *this_arg;
+ LDKNetAddress_IPv4,
/**
- * Gets the per-commitment point for a specific commitment number
- *
- * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
+ * An IPv6 address/port on which the peer is listening.
*/
- struct LDKPublicKey (*get_per_commitment_point)(const void *this_arg, uint64_t idx);
+ LDKNetAddress_IPv6,
/**
- * Gets the commitment secret for a specific commitment number as part of the revocation process
- *
- * An external signer implementation should error here if the commitment was already signed
- * and should refuse to sign it in the future.
- *
- * May be called more than once for the same index.
+ * An old-style Tor onion address/port on which the peer is listening.
*
- * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
+ * This field is deprecated and the Tor network generally no longer supports V2 Onion
+ * addresses. Thus, the details are not parsed here.
*/
- struct LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx);
+ LDKNetAddress_OnionV2,
/**
- * Validate the counterparty's signatures on the holder commitment transaction and HTLCs.
- *
- * This is required in order for the signer to make sure that releasing a commitment
- * secret won't leave us without a broadcastable holder transaction.
- * Policy checks should be implemented in this function, including checking the amount
- * sent to us and checking the HTLCs.
- *
- * The preimages of outgoing HTLCs that were fulfilled since the last commitment are provided.
- * A validating signer should ensure that an HTLC output is removed only when the matching
- * preimage is provided, or when the value to holder is restored.
- *
- * NOTE: all the relevant preimages will be provided, but there may also be additional
- * irrelevant or duplicate preimages.
+ * A new-style Tor onion address/port on which the peer is listening.
+ * To create the human-readable \"hostname\", concatenate ed25519_pubkey, checksum, and version,
+ * wrap as base32 and append \".onion\".
*/
- struct LDKCResult_NoneNoneZ (*validate_holder_commitment)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR holder_tx, struct LDKCVec_PaymentPreimageZ preimages);
+ LDKNetAddress_OnionV3,
/**
- * Gets the holder's channel public keys and basepoints
+ * Must be last for serialization purposes
*/
- struct LDKChannelPublicKeys pubkeys;
+ LDKNetAddress_Sentinel,
+} LDKNetAddress_Tag;
+
+typedef struct LDKNetAddress_LDKIPv4_Body {
/**
- * Fill in the pubkeys field as a reference to it will be given to Rust after this returns
- * Note that this takes a pointer to this object, not the this_ptr like other methods do
- * This function pointer may be NULL if pubkeys is filled in when this object is created and never needs updating.
+ * The 4-byte IPv4 address
*/
- void (*set_pubkeys)(const struct LDKBaseSign*NONNULL_PTR );
+ struct LDKFourBytes addr;
/**
- * Gets an arbitrary identifier describing the set of keys which are provided back to you in
- * some SpendableOutputDescriptor types. This should be sufficient to identify this
- * Sign object uniquely and lookup or re-derive its keys.
+ * The port on which the node is listening
*/
- struct LDKThirtyTwoBytes (*channel_keys_id)(const void *this_arg);
+ uint16_t port;
+} LDKNetAddress_LDKIPv4_Body;
+
+typedef struct LDKNetAddress_LDKIPv6_Body {
/**
- * Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
- *
- * Note that if signing fails or is rejected, the channel will be force-closed.
- *
- * Policy checks should be implemented in this function, including checking the amount
- * sent to us and checking the HTLCs.
- *
- * The preimages of outgoing HTLCs that were fulfilled since the last commitment are provided.
- * A validating signer should ensure that an HTLC output is removed only when the matching
- * preimage is provided, or when the value to holder is restored.
- *
- * NOTE: all the relevant preimages will be provided, but there may also be additional
- * irrelevant or duplicate preimages.
+ * The 16-byte IPv6 address
*/
- struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx, struct LDKCVec_PaymentPreimageZ preimages);
+ struct LDKSixteenBytes addr;
/**
- * Validate the counterparty's revocation.
- *
- * This is required in order for the signer to make sure that the state has moved
- * forward and it is safe to sign the next counterparty commitment.
+ * The port on which the node is listening
*/
- struct LDKCResult_NoneNoneZ (*validate_counterparty_revocation)(const void *this_arg, uint64_t idx, const uint8_t (*secret)[32]);
+ uint16_t port;
+} LDKNetAddress_LDKIPv6_Body;
+
+typedef struct LDKNetAddress_LDKOnionV3_Body {
/**
- * Create a signatures for a holder's commitment transaction and its claiming HTLC transactions.
- * This will only ever be called with a non-revoked commitment_tx. This will be called with the
- * latest commitment_tx when we initiate a force-close.
- * This will be called with the previous latest, just to get claiming HTLC signatures, if we are
- * reacting to a ChannelMonitor replica that decided to broadcast before it had been updated to
- * the latest.
- * This may be called multiple times for the same transaction.
- *
- * An external signer implementation should check that the commitment has not been revoked.
- *
- * May return Err if key derivation fails. Callers, such as ChannelMonitor, will panic in such a case.
+ * The ed25519 long-term public key of the peer
*/
- struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_holder_commitment_and_htlcs)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx);
+ struct LDKThirtyTwoBytes ed25519_pubkey;
/**
- * Create a signature for the given input in a transaction spending an HTLC transaction output
- * or a commitment transaction `to_local` output when our counterparty broadcasts an old state.
- *
- * A justice transaction may claim multiple outputs at the same time if timelocks are
- * similar, but only a signature for the input at index `input` should be signed for here.
- * It may be called multiple times for same output(s) if a fee-bump is needed with regards
- * to an upcoming timelock expiration.
- *
- * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
- *
- * per_commitment_key is revocation secret which was provided by our counterparty when they
- * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
- * not allow the spending of any funds by itself (you need our holder revocation_secret to do
- * so).
+ * The checksum of the pubkey and version, as included in the onion address
*/
- struct LDKCResult_SignatureNoneZ (*sign_justice_revoked_output)(const void *this_arg, struct LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32]);
+ uint16_t checksum;
/**
- * Create a signature for the given input in a transaction spending a commitment transaction
- * HTLC output when our counterparty broadcasts an old state.
- *
- * A justice transaction may claim multiple outputs at the same time if timelocks are
- * similar, but only a signature for the input at index `input` should be signed for here.
- * It may be called multiple times for same output(s) if a fee-bump is needed with regards
- * to an upcoming timelock expiration.
- *
- * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
- *
- * per_commitment_key is revocation secret which was provided by our counterparty when they
- * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
- * not allow the spending of any funds by itself (you need our holder revocation_secret to do
- * so).
- *
- * htlc holds HTLC elements (hash, timelock), thus changing the format of the witness script
- * (which is committed to in the BIP 143 signatures).
+ * The version byte, as defined by the Tor Onion v3 spec.
*/
- struct LDKCResult_SignatureNoneZ (*sign_justice_revoked_htlc)(const void *this_arg, struct LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32], const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc);
+ uint8_t version;
/**
- * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
- * transaction, either offered or received.
- *
- * Such a transaction may claim multiples offered outputs at same time if we know the
- * preimage for each when we create it, but only the input at index `input` should be
- * signed for here. It may be called multiple times for same output(s) if a fee-bump is
- * needed with regards to an upcoming timelock expiration.
- *
- * Witness_script is either a offered or received script as defined in BOLT3 for HTLC
- * outputs.
- *
- * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
- *
- * Per_commitment_point is the dynamic point corresponding to the channel state
- * detected onchain. It has been generated by our counterparty and is used to derive
- * channel state keys, which are then included in the witness script and committed to in the
- * BIP 143 signature.
- */
- struct LDKCResult_SignatureNoneZ (*sign_counterparty_htlc_transaction)(const void *this_arg, struct LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, struct LDKPublicKey per_commitment_point, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc);
- /**
- * Create a signature for a (proposed) closing transaction.
- *
- * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
- * chosen to forgo their output as dust.
- */
- struct LDKCResult_SignatureNoneZ (*sign_closing_transaction)(const void *this_arg, const struct LDKClosingTransaction *NONNULL_PTR closing_tx);
- /**
- * Signs a channel announcement message with our funding key and our node secret key (aka
- * node_id or network_key), proving it comes from one of the channel participants.
- *
- * The first returned signature should be from our node secret key, the second from our
- * funding key.
- *
- * Note that if this fails or is rejected, the channel will not be publicly announced and
- * our counterparty may (though likely will not) close the channel on us for violating the
- * protocol.
- */
- struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ (*sign_channel_announcement)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg);
- /**
- * Set the counterparty static channel data, including basepoints,
- * counterparty_selected/holder_selected_contest_delay and funding outpoint.
- * This is done as soon as the funding outpoint is known. Since these are static channel data,
- * they MUST NOT be allowed to change to different values once set.
- *
- * channel_parameters.is_populated() MUST be true.
- *
- * We bind holder_selected_contest_delay late here for API convenience.
- *
- * Will be called before any signatures are applied.
- */
- void (*ready_channel)(void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters);
- /**
- * Frees any resources associated with this object given its this_arg pointer.
- * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ * The port on which the node is listening
*/
- void (*free)(void *this_arg);
-} LDKBaseSign;
+ uint16_t port;
+} LDKNetAddress_LDKOnionV3_Body;
+
+typedef struct MUST_USE_STRUCT LDKNetAddress {
+ LDKNetAddress_Tag tag;
+ union {
+ LDKNetAddress_LDKIPv4_Body i_pv4;
+ LDKNetAddress_LDKIPv6_Body i_pv6;
+ struct {
+ struct LDKTwelveBytes onion_v2;
+ };
+ LDKNetAddress_LDKOnionV3_Body onion_v3;
+ };
+} LDKNetAddress;
/**
- * A cloneable signer.
- *
- * Although we require signers to be cloneable, it may be useful for developers to be able to use
- * signers in an un-sized way, for example as `dyn BaseSign`. Therefore we separate the Clone trait,
- * which implies Sized, into this derived trait.
+ * A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
+ * This corresponds to std::vector in C++
*/
-typedef struct LDKSign {
- /**
- * An opaque pointer which is passed to your function implementations as an argument.
- * This has no meaning in the LDK, and can be NULL or any other value.
- */
- void *this_arg;
+typedef struct LDKCVec_NetAddressZ {
/**
- * Implementation of BaseSign for this object.
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
*/
- struct LDKBaseSign BaseSign;
+ struct LDKNetAddress *data;
/**
- * Serialize the object into a byte array
+ * The number of elements pointed to by `data`.
*/
- struct LDKCVec_u8Z (*write)(const void *this_arg);
+ uintptr_t datalen;
+} LDKCVec_NetAddressZ;
+
+
+
+/**
+ * Information received in the latest node_announcement from this node.
+ */
+typedef struct MUST_USE_STRUCT LDKNodeAnnouncementInfo {
/**
- * Called, if set, after this Sign has been cloned into a duplicate object.
- * The new Sign is provided, and should be mutated as needed to perform a
- * deep copy of the object pointed to by this_arg or avoid any double-freeing.
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- void (*cloned)(struct LDKSign *NONNULL_PTR new_Sign);
+ LDKnativeNodeAnnouncementInfo *inner;
/**
- * Frees any resources associated with this object given its this_arg pointer.
- * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
*/
- void (*free)(void *this_arg);
-} LDKSign;
+ bool is_owned;
+} LDKNodeAnnouncementInfo;
/**
- * The contents of CResult_SignDecodeErrorZ
+ * The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
*/
-typedef union LDKCResult_SignDecodeErrorZPtr {
+typedef union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKSign *result;
+ struct LDKNodeAnnouncementInfo *result;
/**
* A pointer to the contents in the error state.
* Reading from this pointer when `result_ok` is set is undefined.
*/
struct LDKDecodeError *err;
-} LDKCResult_SignDecodeErrorZPtr;
+} LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr;
/**
- * A CResult_SignDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::routing::gossip::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_SignDecodeErrorZ {
+typedef struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ {
/**
- * The contents of this CResult_SignDecodeErrorZ, accessible via either
+ * The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_SignDecodeErrorZPtr contents;
+ union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr contents;
/**
- * Whether this CResult_SignDecodeErrorZ represents a success state.
+ * Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_SignDecodeErrorZ;
-
-/**
- * Integer in the range `0..32`
- */
-typedef struct LDKu5 {
- uint8_t _0;
-} LDKu5;
+} LDKCResult_NodeAnnouncementInfoDecodeErrorZ;
/**
- * A dynamically-allocated array of crate::c_types::u5s of arbitrary size.
+ * A dynamically-allocated array of u64s of arbitrary size.
* This corresponds to std::vector in C++
*/
-typedef struct LDKCVec_u5Z {
+typedef struct LDKCVec_u64Z {
/**
* The elements in the array.
* If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
*/
- struct LDKu5 *data;
+ uint64_t *data;
/**
* The number of elements pointed to by `data`.
*/
uintptr_t datalen;
-} LDKCVec_u5Z;
+} LDKCVec_u64Z;
+
+
/**
- * Represents a secp256k1 signature serialized as two 32-byte numbers as well as a tag which
- * allows recovering the exact public key which created the signature given the message.
+ * Details about a node in the network, known from the network announcement.
*/
-typedef struct LDKRecoverableSignature {
+typedef struct MUST_USE_STRUCT LDKNodeInfo {
/**
- * The bytes of the signature in "compact" form plus a "Recovery ID" which allows for
- * recovery.
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- uint8_t serialized_form[68];
-} LDKRecoverableSignature;
+ LDKnativeNodeInfo *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;
+} LDKNodeInfo;
/**
- * The contents of CResult_RecoverableSignatureNoneZ
+ * The contents of CResult_NodeInfoDecodeErrorZ
*/
-typedef union LDKCResult_RecoverableSignatureNoneZPtr {
+typedef union LDKCResult_NodeInfoDecodeErrorZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKRecoverableSignature *result;
+ struct LDKNodeInfo *result;
/**
- * Note that this value is always NULL, as there are no contents in the Err variant
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
*/
- void *err;
-} LDKCResult_RecoverableSignatureNoneZPtr;
+ struct LDKDecodeError *err;
+} LDKCResult_NodeInfoDecodeErrorZPtr;
/**
- * A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
- * containing a crate::c_types::RecoverableSignature on success and a () on failure.
+ * A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::routing::gossip::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_RecoverableSignatureNoneZ {
+typedef struct LDKCResult_NodeInfoDecodeErrorZ {
/**
- * The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
+ * The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_RecoverableSignatureNoneZPtr contents;
+ union LDKCResult_NodeInfoDecodeErrorZPtr contents;
/**
- * Whether this CResult_RecoverableSignatureNoneZ represents a success state.
+ * Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_RecoverableSignatureNoneZ;
-
-/**
- * A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
- * This corresponds to std::vector in C++
- */
-typedef struct LDKCVec_CVec_u8ZZ {
- /**
- * The elements in the array.
- * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
- */
- struct LDKCVec_u8Z *data;
- /**
- * The number of elements pointed to by `data`.
- */
- uintptr_t datalen;
-} LDKCVec_CVec_u8ZZ;
+} LDKCResult_NodeInfoDecodeErrorZ;
/**
- * The contents of CResult_CVec_CVec_u8ZZNoneZ
+ * The contents of CResult_NetworkGraphDecodeErrorZ
*/
-typedef union LDKCResult_CVec_CVec_u8ZZNoneZPtr {
+typedef union LDKCResult_NetworkGraphDecodeErrorZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKCVec_CVec_u8ZZ *result;
+ struct LDKNetworkGraph *result;
/**
- * Note that this value is always NULL, as there are no contents in the Err variant
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
*/
- void *err;
-} LDKCResult_CVec_CVec_u8ZZNoneZPtr;
+ struct LDKDecodeError *err;
+} LDKCResult_NetworkGraphDecodeErrorZPtr;
/**
- * A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
- * containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
+ * A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::routing::gossip::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_CVec_CVec_u8ZZNoneZ {
+typedef struct LDKCResult_NetworkGraphDecodeErrorZ {
/**
- * The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
+ * The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_CVec_CVec_u8ZZNoneZPtr contents;
+ union LDKCResult_NetworkGraphDecodeErrorZPtr contents;
/**
- * Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
+ * Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_CVec_CVec_u8ZZNoneZ;
-
-
+} LDKCResult_NetworkGraphDecodeErrorZ;
/**
- * A simple implementation of Sign that just keeps the private keys in memory.
- *
- * This implementation performs no policy checks and is insufficient by itself as
- * a secure external signer.
+ * An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
*/
-typedef struct MUST_USE_STRUCT LDKInMemorySigner {
+typedef enum LDKCOption_CVec_NetAddressZZ_Tag {
/**
- * A pointer to the opaque Rust object.
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ * When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
*/
- LDKnativeInMemorySigner *inner;
+ LDKCOption_CVec_NetAddressZZ_Some,
/**
- * 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.
+ * When we're in this state, this COption_CVec_NetAddressZZ contains nothing
*/
- bool is_owned;
-} LDKInMemorySigner;
+ LDKCOption_CVec_NetAddressZZ_None,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKCOption_CVec_NetAddressZZ_Sentinel,
+} LDKCOption_CVec_NetAddressZZ_Tag;
+
+typedef struct LDKCOption_CVec_NetAddressZZ {
+ LDKCOption_CVec_NetAddressZZ_Tag tag;
+ union {
+ struct {
+ struct LDKCVec_NetAddressZ some;
+ };
+ };
+} LDKCOption_CVec_NetAddressZZ;
/**
- * The contents of CResult_InMemorySignerDecodeErrorZ
+ * The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
*/
-typedef union LDKCResult_InMemorySignerDecodeErrorZPtr {
+typedef union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKInMemorySigner *result;
+ struct LDKDelayedPaymentOutputDescriptor *result;
/**
* A pointer to the contents in the error state.
* Reading from this pointer when `result_ok` is set is undefined.
*/
struct LDKDecodeError *err;
-} LDKCResult_InMemorySignerDecodeErrorZPtr;
+} LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr;
/**
- * A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_InMemorySignerDecodeErrorZ {
+typedef struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
/**
- * The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
+ * The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_InMemorySignerDecodeErrorZPtr contents;
+ union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr contents;
/**
- * Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
+ * Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_InMemorySignerDecodeErrorZ;
+} LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ;
/**
- * A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
- * This corresponds to std::vector in C++
+ * The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
*/
-typedef struct LDKCVec_TxOutZ {
+typedef union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
/**
- * The elements in the array.
- * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKTxOut *data;
+ struct LDKStaticPaymentOutputDescriptor *result;
/**
- * The number of elements pointed to by `data`.
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
*/
- uintptr_t datalen;
-} LDKCVec_TxOutZ;
+ struct LDKDecodeError *err;
+} LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr;
/**
- * The contents of CResult_TransactionNoneZ
+ * A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef union LDKCResult_TransactionNoneZPtr {
+typedef struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ {
+ /**
+ * The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ;
+
+/**
+ * The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
+ */
+typedef union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKTransaction *result;
+ struct LDKSpendableOutputDescriptor *result;
/**
- * Note that this value is always NULL, as there are no contents in the Err variant
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
*/
- void *err;
-} LDKCResult_TransactionNoneZPtr;
+ struct LDKDecodeError *err;
+} LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr;
/**
- * A CResult_TransactionNoneZ represents the result of a fallible operation,
- * containing a crate::c_types::Transaction on success and a () on failure.
+ * A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_TransactionNoneZ {
+typedef struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ {
/**
- * The contents of this CResult_TransactionNoneZ, accessible via either
+ * The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_TransactionNoneZPtr contents;
+ union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr contents;
/**
- * Whether this CResult_TransactionNoneZ represents a success state.
+ * Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_TransactionNoneZ;
-
-
+} LDKCResult_SpendableOutputDescriptorDecodeErrorZ;
/**
- * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates
- * on-chain transactions to ensure no loss of funds occurs.
- *
- * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date
- * information and are actively monitoring the chain.
- *
- * Pending Events or updated HTLCs which have not yet been read out by
- * get_and_clear_pending_monitor_events or get_and_clear_pending_events are serialized to disk and
- * reloaded at deserialize-time. Thus, you must ensure that, when handling events, all events
- * gotten are fully handled before re-serializing the new state.
- *
- * Note that the deserializer is only implemented for (BlockHash, ChannelMonitor), which
- * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
- * the \"reorg path\" (ie disconnecting blocks until you find a common ancestor from both the
- * returned block hash and the the current chain and then reconnecting blocks to get to the
- * best chain) upon deserializing the object!
+ * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
+ * This corresponds to std::vector in C++
*/
-typedef struct MUST_USE_STRUCT LDKChannelMonitor {
+typedef struct LDKCVec_PaymentPreimageZ {
/**
- * A pointer to the opaque Rust object.
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
*/
- LDKnativeChannelMonitor *inner;
+ struct LDKThirtyTwoBytes *data;
/**
- * Indicates that this is the only struct which contains the same pointer.
- * Rust functions which take ownership of an object provided via an argument require
- * this to be true and invalidate the object pointed to by inner.
+ * The number of elements pointed to by `data`.
*/
- bool is_owned;
-} LDKChannelMonitor;
+ uintptr_t datalen;
+} LDKCVec_PaymentPreimageZ;
/**
* A tuple of 2 elements. See the individual fields for the types contained.
*/
-typedef struct LDKC2Tuple_BlockHashChannelMonitorZ {
+typedef struct LDKC2Tuple_SignatureCVec_SignatureZZ {
/**
* The element at position 0
*/
- struct LDKThirtyTwoBytes a;
+ struct LDKSignature a;
/**
* The element at position 1
*/
- struct LDKChannelMonitor b;
-} LDKC2Tuple_BlockHashChannelMonitorZ;
+ struct LDKCVec_SignatureZ b;
+} LDKC2Tuple_SignatureCVec_SignatureZZ;
/**
- * A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
- * This corresponds to std::vector in C++
+ * The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
*/
-typedef struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ {
+typedef union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
/**
- * The elements in the array.
- * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKC2Tuple_BlockHashChannelMonitorZ *data;
+ struct LDKC2Tuple_SignatureCVec_SignatureZZ *result;
/**
- * The number of elements pointed to by `data`.
+ * Note that this value is always NULL, as there are no contents in the Err variant
*/
- uintptr_t datalen;
-} LDKCVec_C2Tuple_BlockHashChannelMonitorZZ;
+ void *err;
+} LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr;
/**
- * The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
+ * A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
+ * containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
+typedef struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
+ /**
+ * The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr contents;
+ /**
+ * Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ;
+
+/**
+ * The contents of CResult_SignatureNoneZ
+ */
+typedef union LDKCResult_SignatureNoneZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *result;
+ struct LDKSignature *result;
/**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
+ * Note that this value is always NULL, as there are no contents in the Err variant
*/
- enum LDKIOError *err;
-} LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr;
+ void *err;
+} LDKCResult_SignatureNoneZPtr;
/**
- * A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
- * containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
+ * A CResult_SignatureNoneZ represents the result of a fallible operation,
+ * containing a crate::c_types::Signature on success and a () on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
+typedef struct LDKCResult_SignatureNoneZ {
/**
- * The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
+ * The contents of this CResult_SignatureNoneZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr contents;
+ union LDKCResult_SignatureNoneZPtr contents;
/**
- * Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
+ * Whether this CResult_SignatureNoneZ represents a success state.
*/
bool result_ok;
-} LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ;
+} LDKCResult_SignatureNoneZ;
/**
- * An enum which can either contain a u16 or not
+ * A tuple of 2 elements. See the individual fields for the types contained.
*/
-typedef enum LDKCOption_u16Z_Tag {
- /**
- * When we're in this state, this COption_u16Z contains a u16
- */
- LDKCOption_u16Z_Some,
+typedef struct LDKC2Tuple_SignatureSignatureZ {
/**
- * When we're in this state, this COption_u16Z contains nothing
+ * The element at position 0
*/
- LDKCOption_u16Z_None,
+ struct LDKSignature a;
/**
- * Must be last for serialization purposes
+ * The element at position 1
*/
- LDKCOption_u16Z_Sentinel,
-} LDKCOption_u16Z_Tag;
-
-typedef struct LDKCOption_u16Z {
- LDKCOption_u16Z_Tag tag;
- union {
- struct {
- uint16_t some;
- };
- };
-} LDKCOption_u16Z;
+ struct LDKSignature b;
+} LDKC2Tuple_SignatureSignatureZ;
/**
- * Indicates an error on the client's part (usually some variant of attempting to use too-low or
- * too-high values)
+ * The contents of CResult_C2Tuple_SignatureSignatureZNoneZ
*/
-typedef enum LDKAPIError_Tag {
+typedef union LDKCResult_C2Tuple_SignatureSignatureZNoneZPtr {
/**
- * Indicates the API was wholly misused (see err for more). Cases where these can be returned
- * are documented, but generally indicates some precondition of a function was violated.
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
*/
- LDKAPIError_APIMisuseError,
+ struct LDKC2Tuple_SignatureSignatureZ *result;
/**
- * Due to a high feerate, we were unable to complete the request.
- * For example, this may be returned if the feerate implies we cannot open a channel at the
- * requested value, but opening a larger channel would succeed.
+ * Note that this value is always NULL, as there are no contents in the Err variant
*/
- LDKAPIError_FeeRateTooHigh,
- /**
- * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route,
- * too-many-hops, etc).
- */
- LDKAPIError_RouteError,
- /**
- * We were unable to complete the request as the Channel required to do so is unable to
- * complete the request (or was not found). This can take many forms, including disconnected
- * peer, channel at capacity, channel shutting down, etc.
- */
- LDKAPIError_ChannelUnavailable,
- /**
- * An attempt to call watch/update_channel returned an Err (ie you did this!), causing the
- * attempted action to fail.
- */
- LDKAPIError_MonitorUpdateFailed,
- /**
- * [`KeysInterface::get_shutdown_scriptpubkey`] returned a shutdown scriptpubkey incompatible
- * with the channel counterparty as negotiated in [`InitFeatures`].
- *
- * Using a SegWit v0 script should resolve this issue. If you cannot, you won't be able to open
- * a channel or cooperatively close one with this peer (and will have to force-close instead).
- *
- * [`KeysInterface::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::KeysInterface::get_shutdown_scriptpubkey
- * [`InitFeatures`]: crate::ln::features::InitFeatures
- */
- LDKAPIError_IncompatibleShutdownScript,
- /**
- * Must be last for serialization purposes
- */
- LDKAPIError_Sentinel,
-} LDKAPIError_Tag;
-
-typedef struct LDKAPIError_LDKAPIMisuseError_Body {
- /**
- * A human-readable error message
- */
- struct LDKStr err;
-} LDKAPIError_LDKAPIMisuseError_Body;
-
-typedef struct LDKAPIError_LDKFeeRateTooHigh_Body {
- /**
- * A human-readable error message
- */
- struct LDKStr err;
- /**
- * The feerate which was too high.
- */
- uint32_t feerate;
-} LDKAPIError_LDKFeeRateTooHigh_Body;
-
-typedef struct LDKAPIError_LDKRouteError_Body {
- /**
- * A human-readable error message
- */
- struct LDKStr err;
-} LDKAPIError_LDKRouteError_Body;
+ void *err;
+} LDKCResult_C2Tuple_SignatureSignatureZNoneZPtr;
-typedef struct LDKAPIError_LDKChannelUnavailable_Body {
+/**
+ * A CResult_C2Tuple_SignatureSignatureZNoneZ represents the result of a fallible operation,
+ * containing a crate::c_types::derived::C2Tuple_SignatureSignatureZ on success and a () on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ {
/**
- * A human-readable error message
+ * The contents of this CResult_C2Tuple_SignatureSignatureZNoneZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
*/
- struct LDKStr err;
-} LDKAPIError_LDKChannelUnavailable_Body;
-
-typedef struct LDKAPIError_LDKIncompatibleShutdownScript_Body {
+ union LDKCResult_C2Tuple_SignatureSignatureZNoneZPtr contents;
/**
- * The incompatible shutdown script.
+ * Whether this CResult_C2Tuple_SignatureSignatureZNoneZ represents a success state.
*/
- struct LDKShutdownScript script;
-} LDKAPIError_LDKIncompatibleShutdownScript_Body;
-
-typedef struct MUST_USE_STRUCT LDKAPIError {
- LDKAPIError_Tag tag;
- union {
- LDKAPIError_LDKAPIMisuseError_Body api_misuse_error;
- LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high;
- LDKAPIError_LDKRouteError_Body route_error;
- LDKAPIError_LDKChannelUnavailable_Body channel_unavailable;
- LDKAPIError_LDKIncompatibleShutdownScript_Body incompatible_shutdown_script;
- };
-} LDKAPIError;
+ bool result_ok;
+} LDKCResult_C2Tuple_SignatureSignatureZNoneZ;
/**
- * The contents of CResult_NoneAPIErrorZ
+ * The contents of CResult_SecretKeyNoneZ
*/
-typedef union LDKCResult_NoneAPIErrorZPtr {
+typedef union LDKCResult_SecretKeyNoneZPtr {
/**
- * Note that this value is always NULL, as there are no contents in the OK variant
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
*/
- void *result;
+ struct LDKSecretKey *result;
/**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
+ * Note that this value is always NULL, as there are no contents in the Err variant
*/
- struct LDKAPIError *err;
-} LDKCResult_NoneAPIErrorZPtr;
+ void *err;
+} LDKCResult_SecretKeyNoneZPtr;
/**
- * A CResult_NoneAPIErrorZ represents the result of a fallible operation,
- * containing a () on success and a crate::lightning::util::errors::APIError on failure.
+ * A CResult_SecretKeyNoneZ represents the result of a fallible operation,
+ * containing a crate::c_types::SecretKey on success and a () on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_NoneAPIErrorZ {
+typedef struct LDKCResult_SecretKeyNoneZ {
/**
- * The contents of this CResult_NoneAPIErrorZ, accessible via either
+ * The contents of this CResult_SecretKeyNoneZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_NoneAPIErrorZPtr contents;
+ union LDKCResult_SecretKeyNoneZPtr contents;
/**
- * Whether this CResult_NoneAPIErrorZ represents a success state.
+ * Whether this CResult_SecretKeyNoneZ represents a success state.
*/
bool result_ok;
-} LDKCResult_NoneAPIErrorZ;
+} LDKCResult_SecretKeyNoneZ;
+
+
/**
- * A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
- * This corresponds to std::vector in C++
+ * This class tracks the per-transaction information needed to build a closing transaction and will
+ * actually build it and sign.
+ *
+ * This class can be used inside a signer implementation to generate a signature given the relevant
+ * secret key.
*/
-typedef struct LDKCVec_CResult_NoneAPIErrorZZ {
+typedef struct MUST_USE_STRUCT LDKClosingTransaction {
/**
- * The elements in the array.
- * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- struct LDKCResult_NoneAPIErrorZ *data;
+ LDKnativeClosingTransaction *inner;
/**
- * The number of elements pointed to by `data`.
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
*/
- uintptr_t datalen;
-} LDKCVec_CResult_NoneAPIErrorZZ;
+ bool is_owned;
+} LDKClosingTransaction;
+
+
/**
- * A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
- * This corresponds to std::vector in C++
+ * The unsigned part of a channel_announcement
*/
-typedef struct LDKCVec_APIErrorZ {
+typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement {
/**
- * The elements in the array.
- * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- struct LDKAPIError *data;
+ LDKnativeUnsignedChannelAnnouncement *inner;
/**
- * The number of elements pointed to by `data`.
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
*/
- uintptr_t datalen;
-} LDKCVec_APIErrorZ;
+ bool is_owned;
+} LDKUnsignedChannelAnnouncement;
/**
- * The contents of CResult__u832APIErrorZ
+ * A trait to sign lightning channel transactions as described in BOLT 3.
+ *
+ * Signing services could be implemented on a hardware wallet. In this case,
+ * the current Sign would be a front-end on top of a communication
+ * channel connected to your secure device and lightning key material wouldn't
+ * reside on a hot server. Nevertheless, a this deployment would still need
+ * to trust the ChannelManager to avoid loss of funds as this latest component
+ * could ask to sign commitment transaction with HTLCs paying to attacker pubkeys.
+ *
+ * A more secure iteration would be to use hashlock (or payment points) to pair
+ * invoice/incoming HTLCs with outgoing HTLCs to implement a no-trust-ChannelManager
+ * at the price of more state and computation on the hardware wallet side. In the future,
+ * we are looking forward to design such interface.
+ *
+ * In any case, ChannelMonitor or fallback watchtowers are always going to be trusted
+ * to act, as liveness and breach reply correctness are always going to be hard requirements
+ * of LN security model, orthogonal of key management issues.
*/
-typedef union LDKCResult__u832APIErrorZPtr {
+typedef struct LDKBaseSign {
/**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
+ * 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 LDKThirtyTwoBytes *result;
+ void *this_arg;
/**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
+ * Gets the per-commitment point for a specific commitment number
+ *
+ * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
*/
- struct LDKAPIError *err;
-} LDKCResult__u832APIErrorZPtr;
-
-/**
- * A CResult__u832APIErrorZ represents the result of a fallible operation,
- * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
- * `result_ok` indicates the overall state, and the contents are provided via `contents`.
- */
-typedef struct LDKCResult__u832APIErrorZ {
+ struct LDKPublicKey (*get_per_commitment_point)(const void *this_arg, uint64_t idx);
/**
- * The contents of this CResult__u832APIErrorZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
+ * Gets the commitment secret for a specific commitment number as part of the revocation process
+ *
+ * An external signer implementation should error here if the commitment was already signed
+ * and should refuse to sign it in the future.
+ *
+ * May be called more than once for the same index.
+ *
+ * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
*/
- union LDKCResult__u832APIErrorZPtr contents;
+ struct LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx);
/**
- * Whether this CResult__u832APIErrorZ represents a success state.
+ * Validate the counterparty's signatures on the holder commitment transaction and HTLCs.
+ *
+ * This is required in order for the signer to make sure that releasing a commitment
+ * secret won't leave us without a broadcastable holder transaction.
+ * Policy checks should be implemented in this function, including checking the amount
+ * sent to us and checking the HTLCs.
+ *
+ * The preimages of outgoing HTLCs that were fulfilled since the last commitment are provided.
+ * A validating signer should ensure that an HTLC output is removed only when the matching
+ * preimage is provided, or when the value to holder is restored.
+ *
+ * NOTE: all the relevant preimages will be provided, but there may also be additional
+ * irrelevant or duplicate preimages.
*/
- bool result_ok;
-} LDKCResult__u832APIErrorZ;
-
-/**
- * If a payment fails to send, it can be in one of several states. This enum is returned as the
- * Err() type describing which state the payment is in, see the description of individual enum
- * states for more.
- */
-typedef enum LDKPaymentSendFailure_Tag {
+ struct LDKCResult_NoneNoneZ (*validate_holder_commitment)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR holder_tx, struct LDKCVec_PaymentPreimageZ preimages);
/**
- * A parameter which was passed to send_payment was invalid, preventing us from attempting to
- * send the payment at all. No channel state has been changed or messages sent to peers, and
- * once you've changed the parameter at error, you can freely retry the payment in full.
+ * Gets the holder's channel public keys and basepoints
*/
- LDKPaymentSendFailure_ParameterError,
+ struct LDKChannelPublicKeys pubkeys;
/**
- * A parameter in a single path which was passed to send_payment was invalid, preventing us
- * from attempting to send the payment at all. No channel state has been changed or messages
- * sent to peers, and once you've changed the parameter at error, you can freely retry the
- * payment in full.
- *
- * The results here are ordered the same as the paths in the route object which was passed to
- * send_payment.
+ * Fill in the pubkeys field as a reference to it will be given to Rust after this returns
+ * Note that this takes a pointer to this object, not the this_ptr like other methods do
+ * This function pointer may be NULL if pubkeys is filled in when this object is created and never needs updating.
*/
- LDKPaymentSendFailure_PathParameterError,
+ void (*set_pubkeys)(const struct LDKBaseSign*NONNULL_PTR );
/**
- * All paths which were attempted failed to send, with no channel state change taking place.
- * You can freely retry the payment in full (though you probably want to do so over different
- * paths than the ones selected).
+ * Gets an arbitrary identifier describing the set of keys which are provided back to you in
+ * some SpendableOutputDescriptor types. This should be sufficient to identify this
+ * Sign object uniquely and lookup or re-derive its keys.
*/
- LDKPaymentSendFailure_AllFailedRetrySafe,
+ struct LDKThirtyTwoBytes (*channel_keys_id)(const void *this_arg);
/**
- * Some paths which were attempted failed to send, though possibly not all. At least some
- * paths have irrevocably committed to the HTLC and retrying the payment in full would result
- * in over-/re-payment.
+ * Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
*
- * The results here are ordered the same as the paths in the route object which was passed to
- * send_payment, and any Errs which are not APIError::MonitorUpdateFailed can be safely
- * retried (though there is currently no API with which to do so).
+ * Note that if signing fails or is rejected, the channel will be force-closed.
*
- * Any entries which contain Err(APIError::MonitorUpdateFailed) or Ok(()) MUST NOT be retried
- * as they will result in over-/re-payment. These HTLCs all either successfully sent (in the
- * case of Ok(())) or will send once channel_monitor_updated is called on the next-hop channel
- * with the latest update_id.
- */
- LDKPaymentSendFailure_PartialFailure,
- /**
- * Must be last for serialization purposes
+ * Policy checks should be implemented in this function, including checking the amount
+ * sent to us and checking the HTLCs.
+ *
+ * The preimages of outgoing HTLCs that were fulfilled since the last commitment are provided.
+ * A validating signer should ensure that an HTLC output is removed only when the matching
+ * preimage is provided, or when the value to holder is restored.
+ *
+ * NOTE: all the relevant preimages will be provided, but there may also be additional
+ * irrelevant or duplicate preimages.
*/
- LDKPaymentSendFailure_Sentinel,
-} LDKPaymentSendFailure_Tag;
-
-typedef struct LDKPaymentSendFailure_LDKPartialFailure_Body {
+ struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx, struct LDKCVec_PaymentPreimageZ preimages);
/**
- * The errors themselves, in the same order as the route hops.
+ * Validate the counterparty's revocation.
+ *
+ * This is required in order for the signer to make sure that the state has moved
+ * forward and it is safe to sign the next counterparty commitment.
*/
- struct LDKCVec_CResult_NoneAPIErrorZZ results;
+ struct LDKCResult_NoneNoneZ (*validate_counterparty_revocation)(const void *this_arg, uint64_t idx, const uint8_t (*secret)[32]);
/**
- * If some paths failed without irrevocably committing to the new HTLC(s), this will
- * contain a [`RouteParameters`] object which can be used to calculate a new route that
- * will pay all remaining unpaid balance.
+ * Create a signatures for a holder's commitment transaction and its claiming HTLC transactions.
+ * This will only ever be called with a non-revoked commitment_tx. This will be called with the
+ * latest commitment_tx when we initiate a force-close.
+ * This will be called with the previous latest, just to get claiming HTLC signatures, if we are
+ * reacting to a ChannelMonitor replica that decided to broadcast before it had been updated to
+ * the latest.
+ * This may be called multiple times for the same transaction.
*
- * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
+ * An external signer implementation should check that the commitment has not been revoked.
+ *
+ * May return Err if key derivation fails. Callers, such as ChannelMonitor, will panic in such a case.
*/
- struct LDKRouteParameters failed_paths_retry;
+ struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_holder_commitment_and_htlcs)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx);
/**
- * The payment id for the payment, which is now at least partially pending.
+ * Create a signature for the given input in a transaction spending an HTLC transaction output
+ * or a commitment transaction `to_local` output when our counterparty broadcasts an old state.
+ *
+ * A justice transaction may claim multiple outputs at the same time if timelocks are
+ * similar, but only a signature for the input at index `input` should be signed for here.
+ * It may be called multiple times for same output(s) if a fee-bump is needed with regards
+ * to an upcoming timelock expiration.
+ *
+ * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
+ *
+ * per_commitment_key is revocation secret which was provided by our counterparty when they
+ * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
+ * not allow the spending of any funds by itself (you need our holder revocation_secret to do
+ * so).
*/
- struct LDKThirtyTwoBytes payment_id;
-} LDKPaymentSendFailure_LDKPartialFailure_Body;
-
-typedef struct MUST_USE_STRUCT LDKPaymentSendFailure {
- LDKPaymentSendFailure_Tag tag;
- union {
- struct {
- struct LDKAPIError parameter_error;
- };
- struct {
- struct LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error;
- };
- struct {
- struct LDKCVec_APIErrorZ all_failed_retry_safe;
- };
- LDKPaymentSendFailure_LDKPartialFailure_Body partial_failure;
- };
-} LDKPaymentSendFailure;
-
-/**
- * The contents of CResult_PaymentIdPaymentSendFailureZ
- */
-typedef union LDKCResult_PaymentIdPaymentSendFailureZPtr {
+ struct LDKCResult_SignatureNoneZ (*sign_justice_revoked_output)(const void *this_arg, struct LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32]);
/**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
+ * Create a signature for the given input in a transaction spending a commitment transaction
+ * HTLC output when our counterparty broadcasts an old state.
+ *
+ * A justice transaction may claim multiple outputs at the same time if timelocks are
+ * similar, but only a signature for the input at index `input` should be signed for here.
+ * It may be called multiple times for same output(s) if a fee-bump is needed with regards
+ * to an upcoming timelock expiration.
+ *
+ * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
+ *
+ * per_commitment_key is revocation secret which was provided by our counterparty when they
+ * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
+ * not allow the spending of any funds by itself (you need our holder revocation_secret to do
+ * so).
+ *
+ * htlc holds HTLC elements (hash, timelock), thus changing the format of the witness script
+ * (which is committed to in the BIP 143 signatures).
*/
- struct LDKThirtyTwoBytes *result;
+ struct LDKCResult_SignatureNoneZ (*sign_justice_revoked_htlc)(const void *this_arg, struct LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32], const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc);
/**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
- */
- struct LDKPaymentSendFailure *err;
-} LDKCResult_PaymentIdPaymentSendFailureZPtr;
-
-/**
- * A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation,
- * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
- * `result_ok` indicates the overall state, and the contents are provided via `contents`.
- */
-typedef struct LDKCResult_PaymentIdPaymentSendFailureZ {
+ * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
+ * transaction, either offered or received.
+ *
+ * Such a transaction may claim multiples offered outputs at same time if we know the
+ * preimage for each when we create it, but only the input at index `input` should be
+ * signed for here. It may be called multiple times for same output(s) if a fee-bump is
+ * needed with regards to an upcoming timelock expiration.
+ *
+ * Witness_script is either a offered or received script as defined in BOLT3 for HTLC
+ * outputs.
+ *
+ * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
+ *
+ * Per_commitment_point is the dynamic point corresponding to the channel state
+ * detected onchain. It has been generated by our counterparty and is used to derive
+ * channel state keys, which are then included in the witness script and committed to in the
+ * BIP 143 signature.
+ */
+ struct LDKCResult_SignatureNoneZ (*sign_counterparty_htlc_transaction)(const void *this_arg, struct LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, struct LDKPublicKey per_commitment_point, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc);
/**
- * The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
+ * Create a signature for a (proposed) closing transaction.
+ *
+ * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
+ * chosen to forgo their output as dust.
*/
- union LDKCResult_PaymentIdPaymentSendFailureZPtr contents;
+ struct LDKCResult_SignatureNoneZ (*sign_closing_transaction)(const void *this_arg, const struct LDKClosingTransaction *NONNULL_PTR closing_tx);
/**
- * Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state.
+ * Signs a channel announcement message with our funding key and our node secret key (aka
+ * node_id or network_key), proving it comes from one of the channel participants.
+ *
+ * The first returned signature should be from our node secret key, the second from our
+ * funding key.
+ *
+ * Note that if this fails or is rejected, the channel will not be publicly announced and
+ * our counterparty may (though likely will not) close the channel on us for violating the
+ * protocol.
*/
- bool result_ok;
-} LDKCResult_PaymentIdPaymentSendFailureZ;
-
-/**
- * The contents of CResult_NonePaymentSendFailureZ
- */
-typedef union LDKCResult_NonePaymentSendFailureZPtr {
+ struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ (*sign_channel_announcement)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg);
/**
- * Note that this value is always NULL, as there are no contents in the OK variant
+ * Set the counterparty static channel data, including basepoints,
+ * counterparty_selected/holder_selected_contest_delay and funding outpoint.
+ * This is done as soon as the funding outpoint is known. Since these are static channel data,
+ * they MUST NOT be allowed to change to different values once set.
+ *
+ * channel_parameters.is_populated() MUST be true.
+ *
+ * We bind holder_selected_contest_delay late here for API convenience.
+ *
+ * Will be called before any signatures are applied.
*/
- void *result;
+ void (*ready_channel)(void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters);
/**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
+ * Frees any resources associated with this object given its this_arg pointer.
+ * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
*/
- struct LDKPaymentSendFailure *err;
-} LDKCResult_NonePaymentSendFailureZPtr;
+ void (*free)(void *this_arg);
+} LDKBaseSign;
/**
- * A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
- * containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
- * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ * A cloneable signer.
+ *
+ * Although we require signers to be cloneable, it may be useful for developers to be able to use
+ * signers in an un-sized way, for example as `dyn BaseSign`. Therefore we separate the Clone trait,
+ * which implies Sized, into this derived trait.
*/
-typedef struct LDKCResult_NonePaymentSendFailureZ {
+typedef struct LDKSign {
/**
- * The contents of this CResult_NonePaymentSendFailureZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
+ * An opaque pointer which is passed to your function implementations as an argument.
+ * This has no meaning in the LDK, and can be NULL or any other value.
*/
- union LDKCResult_NonePaymentSendFailureZPtr contents;
+ void *this_arg;
/**
- * Whether this CResult_NonePaymentSendFailureZ represents a success state.
+ * Implementation of BaseSign for this object.
*/
- bool result_ok;
-} LDKCResult_NonePaymentSendFailureZ;
-
-/**
- * A tuple of 2 elements. See the individual fields for the types contained.
- */
-typedef struct LDKC2Tuple_PaymentHashPaymentIdZ {
+ struct LDKBaseSign BaseSign;
/**
- * The element at position 0
+ * Serialize the object into a byte array
*/
- struct LDKThirtyTwoBytes a;
+ struct LDKCVec_u8Z (*write)(const void *this_arg);
/**
- * The element at position 1
+ * Called, if set, after this Sign has been cloned into a duplicate object.
+ * The new Sign is provided, and should be mutated as needed to perform a
+ * deep copy of the object pointed to by this_arg or avoid any double-freeing.
*/
- struct LDKThirtyTwoBytes b;
-} LDKC2Tuple_PaymentHashPaymentIdZ;
+ void (*cloned)(struct LDKSign *NONNULL_PTR new_Sign);
+ /**
+ * Frees any resources associated with this object given its this_arg pointer.
+ * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ */
+ void (*free)(void *this_arg);
+} LDKSign;
/**
- * The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
+ * The contents of CResult_SignDecodeErrorZ
*/
-typedef union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
+typedef union LDKCResult_SignDecodeErrorZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKC2Tuple_PaymentHashPaymentIdZ *result;
+ struct LDKSign *result;
/**
* A pointer to the contents in the error state.
* Reading from this pointer when `result_ok` is set is undefined.
*/
- struct LDKPaymentSendFailure *err;
-} LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr;
+ struct LDKDecodeError *err;
+} LDKCResult_SignDecodeErrorZPtr;
/**
- * A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
- * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
+ * A CResult_SignDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
+typedef struct LDKCResult_SignDecodeErrorZ {
/**
- * The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
+ * The contents of this CResult_SignDecodeErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr contents;
+ union LDKCResult_SignDecodeErrorZPtr contents;
/**
- * Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
+ * Whether this CResult_SignDecodeErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ;
-
-/**
- * A 4-byte byte array.
- */
-typedef struct LDKFourBytes {
- /**
- * The four bytes
- */
- uint8_t data[4];
-} LDKFourBytes;
-
-/**
- * A 16-byte byte array.
- */
-typedef struct LDKSixteenBytes {
- /**
- * The sixteen bytes
- */
- uint8_t data[16];
-} LDKSixteenBytes;
-
-/**
- * A 12-byte byte array.
- */
-typedef struct LDKTwelveBytes {
- /**
- * The twelve bytes
- */
- uint8_t data[12];
-} LDKTwelveBytes;
+} LDKCResult_SignDecodeErrorZ;
/**
- * An address which can be used to connect to a remote peer
+ * Integer in the range `0..32`
*/
-typedef enum LDKNetAddress_Tag {
- /**
- * An IPv4 address/port on which the peer is listening.
- */
- LDKNetAddress_IPv4,
- /**
- * An IPv6 address/port on which the peer is listening.
- */
- LDKNetAddress_IPv6,
- /**
- * An old-style Tor onion address/port on which the peer is listening.
- *
- * This field is deprecated and the Tor network generally no longer supports V2 Onion
- * addresses. Thus, the details are not parsed here.
- */
- LDKNetAddress_OnionV2,
- /**
- * A new-style Tor onion address/port on which the peer is listening.
- * To create the human-readable \"hostname\", concatenate ed25519_pubkey, checksum, and version,
- * wrap as base32 and append \".onion\".
- */
- LDKNetAddress_OnionV3,
- /**
- * Must be last for serialization purposes
- */
- LDKNetAddress_Sentinel,
-} LDKNetAddress_Tag;
-
-typedef struct LDKNetAddress_LDKIPv4_Body {
- /**
- * The 4-byte IPv4 address
- */
- struct LDKFourBytes addr;
- /**
- * The port on which the node is listening
- */
- uint16_t port;
-} LDKNetAddress_LDKIPv4_Body;
-
-typedef struct LDKNetAddress_LDKIPv6_Body {
- /**
- * The 16-byte IPv6 address
- */
- struct LDKSixteenBytes addr;
- /**
- * The port on which the node is listening
- */
- uint16_t port;
-} LDKNetAddress_LDKIPv6_Body;
-
-typedef struct LDKNetAddress_LDKOnionV3_Body {
- /**
- * The ed25519 long-term public key of the peer
- */
- struct LDKThirtyTwoBytes ed25519_pubkey;
- /**
- * The checksum of the pubkey and version, as included in the onion address
- */
- uint16_t checksum;
- /**
- * The version byte, as defined by the Tor Onion v3 spec.
- */
- uint8_t version;
- /**
- * The port on which the node is listening
- */
- uint16_t port;
-} LDKNetAddress_LDKOnionV3_Body;
-
-typedef struct MUST_USE_STRUCT LDKNetAddress {
- LDKNetAddress_Tag tag;
- union {
- LDKNetAddress_LDKIPv4_Body i_pv4;
- LDKNetAddress_LDKIPv6_Body i_pv6;
- struct {
- struct LDKTwelveBytes onion_v2;
- };
- LDKNetAddress_LDKOnionV3_Body onion_v3;
- };
-} LDKNetAddress;
+typedef struct LDKu5 {
+ uint8_t _0;
+} LDKu5;
/**
- * A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
+ * A dynamically-allocated array of crate::c_types::u5s of arbitrary size.
* This corresponds to std::vector in C++
*/
-typedef struct LDKCVec_NetAddressZ {
+typedef struct LDKCVec_u5Z {
/**
* The elements in the array.
* If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
*/
- struct LDKNetAddress *data;
+ struct LDKu5 *data;
/**
* The number of elements pointed to by `data`.
*/
uintptr_t datalen;
-} LDKCVec_NetAddressZ;
+} LDKCVec_u5Z;
/**
- * A tuple of 2 elements. See the individual fields for the types contained.
+ * Represents a secp256k1 signature serialized as two 32-byte numbers as well as a tag which
+ * allows recovering the exact public key which created the signature given the message.
*/
-typedef struct LDKC2Tuple_PaymentHashPaymentSecretZ {
- /**
- * The element at position 0
- */
- struct LDKThirtyTwoBytes a;
+typedef struct LDKRecoverableSignature {
/**
- * The element at position 1
- */
- struct LDKThirtyTwoBytes b;
-} LDKC2Tuple_PaymentHashPaymentSecretZ;
+ * The bytes of the signature in "compact" form plus a "Recovery ID" which allows for
+ * recovery.
+ */
+ uint8_t serialized_form[68];
+} LDKRecoverableSignature;
/**
- * The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ
+ * The contents of CResult_RecoverableSignatureNoneZ
*/
-typedef union LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
+typedef union LDKCResult_RecoverableSignatureNoneZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKC2Tuple_PaymentHashPaymentSecretZ *result;
+ struct LDKRecoverableSignature *result;
/**
* Note that this value is always NULL, as there are no contents in the Err variant
*/
void *err;
-} LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr;
+} LDKCResult_RecoverableSignatureNoneZPtr;
/**
- * A CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation,
- * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure.
+ * A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
+ * containing a crate::c_types::RecoverableSignature on success and a () on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
+typedef struct LDKCResult_RecoverableSignatureNoneZ {
/**
- * The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either
+ * The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr contents;
+ union LDKCResult_RecoverableSignatureNoneZPtr contents;
/**
- * Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state.
+ * Whether this CResult_RecoverableSignatureNoneZ represents a success state.
*/
bool result_ok;
-} LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ;
-
-/**
- * The contents of CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ
- */
-typedef union LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
- /**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
- */
- struct LDKC2Tuple_PaymentHashPaymentSecretZ *result;
- /**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
- */
- struct LDKAPIError *err;
-} LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr;
+} LDKCResult_RecoverableSignatureNoneZ;
/**
- * A CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents the result of a fallible operation,
- * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a crate::lightning::util::errors::APIError on failure.
- * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ * A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
+ * This corresponds to std::vector in C++
*/
-typedef struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
+typedef struct LDKCVec_CVec_u8ZZ {
/**
- * The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
*/
- union LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr contents;
+ struct LDKCVec_u8Z *data;
/**
- * Whether this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents a success state.
+ * The number of elements pointed to by `data`.
*/
- bool result_ok;
-} LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ;
+ uintptr_t datalen;
+} LDKCVec_CVec_u8ZZ;
/**
- * The contents of CResult_PaymentSecretNoneZ
+ * The contents of CResult_CVec_CVec_u8ZZNoneZ
*/
-typedef union LDKCResult_PaymentSecretNoneZPtr {
+typedef union LDKCResult_CVec_CVec_u8ZZNoneZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKThirtyTwoBytes *result;
+ struct LDKCVec_CVec_u8ZZ *result;
/**
* Note that this value is always NULL, as there are no contents in the Err variant
*/
void *err;
-} LDKCResult_PaymentSecretNoneZPtr;
+} LDKCResult_CVec_CVec_u8ZZNoneZPtr;
/**
- * A CResult_PaymentSecretNoneZ represents the result of a fallible operation,
- * containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
+ * A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
+ * containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_PaymentSecretNoneZ {
+typedef struct LDKCResult_CVec_CVec_u8ZZNoneZ {
/**
- * The contents of this CResult_PaymentSecretNoneZ, accessible via either
+ * The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_PaymentSecretNoneZPtr contents;
+ union LDKCResult_CVec_CVec_u8ZZNoneZPtr contents;
/**
- * Whether this CResult_PaymentSecretNoneZ represents a success state.
+ * Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
*/
bool result_ok;
-} LDKCResult_PaymentSecretNoneZ;
+} LDKCResult_CVec_CVec_u8ZZNoneZ;
+
-/**
- * The contents of CResult_PaymentSecretAPIErrorZ
- */
-typedef union LDKCResult_PaymentSecretAPIErrorZPtr {
- /**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
- */
- struct LDKThirtyTwoBytes *result;
- /**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
- */
- struct LDKAPIError *err;
-} LDKCResult_PaymentSecretAPIErrorZPtr;
/**
- * A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
- * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
- * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ * A simple implementation of Sign that just keeps the private keys in memory.
+ *
+ * This implementation performs no policy checks and is insufficient by itself as
+ * a secure external signer.
*/
-typedef struct LDKCResult_PaymentSecretAPIErrorZ {
+typedef struct MUST_USE_STRUCT LDKInMemorySigner {
/**
- * The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- union LDKCResult_PaymentSecretAPIErrorZPtr contents;
+ LDKnativeInMemorySigner *inner;
/**
- * Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
*/
- bool result_ok;
-} LDKCResult_PaymentSecretAPIErrorZ;
+ bool is_owned;
+} LDKInMemorySigner;
/**
- * The contents of CResult_PaymentPreimageAPIErrorZ
+ * The contents of CResult_InMemorySignerDecodeErrorZ
*/
-typedef union LDKCResult_PaymentPreimageAPIErrorZPtr {
+typedef union LDKCResult_InMemorySignerDecodeErrorZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKThirtyTwoBytes *result;
+ struct LDKInMemorySigner *result;
/**
* A pointer to the contents in the error state.
* Reading from this pointer when `result_ok` is set is undefined.
*/
- struct LDKAPIError *err;
-} LDKCResult_PaymentPreimageAPIErrorZPtr;
+ struct LDKDecodeError *err;
+} LDKCResult_InMemorySignerDecodeErrorZPtr;
/**
- * A CResult_PaymentPreimageAPIErrorZ represents the result of a fallible operation,
- * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
+ * A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_PaymentPreimageAPIErrorZ {
+typedef struct LDKCResult_InMemorySignerDecodeErrorZ {
/**
- * The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either
+ * The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_PaymentPreimageAPIErrorZPtr contents;
+ union LDKCResult_InMemorySignerDecodeErrorZPtr contents;
/**
- * Whether this CResult_PaymentPreimageAPIErrorZ represents a success state.
+ * Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_PaymentPreimageAPIErrorZ;
-
-
+} LDKCResult_InMemorySignerDecodeErrorZ;
/**
- * Information needed for constructing an invoice route hint for this channel.
+ * A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
+ * This corresponds to std::vector in C++
*/
-typedef struct MUST_USE_STRUCT LDKCounterpartyForwardingInfo {
+typedef struct LDKCVec_TxOutZ {
/**
- * A pointer to the opaque Rust object.
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
*/
- LDKnativeCounterpartyForwardingInfo *inner;
+ struct LDKTxOut *data;
/**
- * Indicates that this is the only struct which contains the same pointer.
- * Rust functions which take ownership of an object provided via an argument require
- * this to be true and invalidate the object pointed to by inner.
+ * The number of elements pointed to by `data`.
*/
- bool is_owned;
-} LDKCounterpartyForwardingInfo;
+ uintptr_t datalen;
+} LDKCVec_TxOutZ;
/**
- * The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
+ * The contents of CResult_TransactionNoneZ
*/
-typedef union LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr {
+typedef union LDKCResult_TransactionNoneZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKCounterpartyForwardingInfo *result;
+ struct LDKTransaction *result;
/**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
+ * Note that this value is always NULL, as there are no contents in the Err variant
*/
- struct LDKDecodeError *err;
-} LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr;
+ void *err;
+} LDKCResult_TransactionNoneZPtr;
/**
- * A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * A CResult_TransactionNoneZ represents the result of a fallible operation,
+ * containing a crate::c_types::Transaction on success and a () on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ {
+typedef struct LDKCResult_TransactionNoneZ {
/**
- * The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
+ * The contents of this CResult_TransactionNoneZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr contents;
+ union LDKCResult_TransactionNoneZPtr contents;
/**
- * Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
+ * Whether this CResult_TransactionNoneZ represents a success state.
*/
bool result_ok;
-} LDKCResult_CounterpartyForwardingInfoDecodeErrorZ;
+} LDKCResult_TransactionNoneZ;
/**
- * Channel parameters which apply to our counterparty. These are split out from [`ChannelDetails`]
- * to better separate parameters.
+ * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates
+ * on-chain transactions to ensure no loss of funds occurs.
+ *
+ * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date
+ * information and are actively monitoring the chain.
+ *
+ * Pending Events or updated HTLCs which have not yet been read out by
+ * get_and_clear_pending_monitor_events or get_and_clear_pending_events are serialized to disk and
+ * reloaded at deserialize-time. Thus, you must ensure that, when handling events, all events
+ * gotten are fully handled before re-serializing the new state.
+ *
+ * Note that the deserializer is only implemented for (BlockHash, ChannelMonitor), which
+ * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
+ * the \"reorg path\" (ie disconnecting blocks until you find a common ancestor from both the
+ * returned block hash and the the current chain and then reconnecting blocks to get to the
+ * best chain) upon deserializing the object!
*/
-typedef struct MUST_USE_STRUCT LDKChannelCounterparty {
+typedef struct MUST_USE_STRUCT LDKChannelMonitor {
/**
* A pointer to the opaque Rust object.
* Nearly everywhere, inner must be non-null, however in places where
* the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- LDKnativeChannelCounterparty *inner;
+ LDKnativeChannelMonitor *inner;
/**
* Indicates that this is the only struct which contains the same pointer.
* Rust functions which take ownership of an object provided via an argument require
* this to be true and invalidate the object pointed to by inner.
*/
bool is_owned;
-} LDKChannelCounterparty;
+} LDKChannelMonitor;
/**
- * The contents of CResult_ChannelCounterpartyDecodeErrorZ
+ * A tuple of 2 elements. See the individual fields for the types contained.
*/
-typedef union LDKCResult_ChannelCounterpartyDecodeErrorZPtr {
+typedef struct LDKC2Tuple_BlockHashChannelMonitorZ {
/**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
+ * The element at position 0
*/
- struct LDKChannelCounterparty *result;
+ struct LDKThirtyTwoBytes a;
/**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
+ * The element at position 1
*/
- struct LDKDecodeError *err;
-} LDKCResult_ChannelCounterpartyDecodeErrorZPtr;
+ struct LDKChannelMonitor b;
+} LDKC2Tuple_BlockHashChannelMonitorZ;
/**
- * A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure.
- * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ * A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
+ * This corresponds to std::vector in C++
*/
-typedef struct LDKCResult_ChannelCounterpartyDecodeErrorZ {
+typedef struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ {
/**
- * The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
*/
- union LDKCResult_ChannelCounterpartyDecodeErrorZPtr contents;
+ struct LDKC2Tuple_BlockHashChannelMonitorZ *data;
/**
- * Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
+ * The number of elements pointed to by `data`.
*/
- bool result_ok;
-} LDKCResult_ChannelCounterpartyDecodeErrorZ;
+ uintptr_t datalen;
+} LDKCVec_C2Tuple_BlockHashChannelMonitorZZ;
/**
- * The contents of CResult_ChannelDetailsDecodeErrorZ
+ * The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
*/
-typedef union LDKCResult_ChannelDetailsDecodeErrorZPtr {
+typedef union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKChannelDetails *result;
+ struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *result;
/**
* A pointer to the contents in the error state.
* Reading from this pointer when `result_ok` is set is undefined.
*/
- struct LDKDecodeError *err;
-} LDKCResult_ChannelDetailsDecodeErrorZPtr;
+ enum LDKIOError *err;
+} LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr;
/**
- * A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
+ * containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_ChannelDetailsDecodeErrorZ {
+typedef struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
/**
- * The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
+ * The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_ChannelDetailsDecodeErrorZPtr contents;
+ union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr contents;
/**
- * Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
+ * Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_ChannelDetailsDecodeErrorZ;
-
-
+} LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ;
/**
- * Route hints used in constructing invoices for [phantom node payents].
- *
- * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
+ * An enum which can either contain a u16 or not
*/
-typedef struct MUST_USE_STRUCT LDKPhantomRouteHints {
+typedef enum LDKCOption_u16Z_Tag {
/**
- * A pointer to the opaque Rust object.
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ * When we're in this state, this COption_u16Z contains a u16
*/
- LDKnativePhantomRouteHints *inner;
+ LDKCOption_u16Z_Some,
/**
- * 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.
+ * When we're in this state, this COption_u16Z contains nothing
*/
- bool is_owned;
-} LDKPhantomRouteHints;
+ LDKCOption_u16Z_None,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKCOption_u16Z_Sentinel,
+} LDKCOption_u16Z_Tag;
+
+typedef struct LDKCOption_u16Z {
+ LDKCOption_u16Z_Tag tag;
+ union {
+ struct {
+ uint16_t some;
+ };
+ };
+} LDKCOption_u16Z;
/**
- * The contents of CResult_PhantomRouteHintsDecodeErrorZ
+ * Indicates an error on the client's part (usually some variant of attempting to use too-low or
+ * too-high values)
*/
-typedef union LDKCResult_PhantomRouteHintsDecodeErrorZPtr {
+typedef enum LDKAPIError_Tag {
/**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
+ * Indicates the API was wholly misused (see err for more). Cases where these can be returned
+ * are documented, but generally indicates some precondition of a function was violated.
*/
- struct LDKPhantomRouteHints *result;
+ LDKAPIError_APIMisuseError,
/**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
+ * Due to a high feerate, we were unable to complete the request.
+ * For example, this may be returned if the feerate implies we cannot open a channel at the
+ * requested value, but opening a larger channel would succeed.
*/
- struct LDKDecodeError *err;
-} LDKCResult_PhantomRouteHintsDecodeErrorZPtr;
+ LDKAPIError_FeeRateTooHigh,
+ /**
+ * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route,
+ * too-many-hops, etc).
+ */
+ LDKAPIError_RouteError,
+ /**
+ * We were unable to complete the request as the Channel required to do so is unable to
+ * complete the request (or was not found). This can take many forms, including disconnected
+ * peer, channel at capacity, channel shutting down, etc.
+ */
+ LDKAPIError_ChannelUnavailable,
+ /**
+ * An attempt to call watch/update_channel returned an Err (ie you did this!), causing the
+ * attempted action to fail.
+ */
+ LDKAPIError_MonitorUpdateFailed,
+ /**
+ * [`KeysInterface::get_shutdown_scriptpubkey`] returned a shutdown scriptpubkey incompatible
+ * with the channel counterparty as negotiated in [`InitFeatures`].
+ *
+ * Using a SegWit v0 script should resolve this issue. If you cannot, you won't be able to open
+ * a channel or cooperatively close one with this peer (and will have to force-close instead).
+ *
+ * [`KeysInterface::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::KeysInterface::get_shutdown_scriptpubkey
+ * [`InitFeatures`]: crate::ln::features::InitFeatures
+ */
+ LDKAPIError_IncompatibleShutdownScript,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKAPIError_Sentinel,
+} LDKAPIError_Tag;
-/**
- * A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::lightning::ln::channelmanager::PhantomRouteHints 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_PhantomRouteHintsDecodeErrorZ {
+typedef struct LDKAPIError_LDKAPIMisuseError_Body {
/**
- * The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
+ * A human-readable error message
*/
- union LDKCResult_PhantomRouteHintsDecodeErrorZPtr contents;
+ struct LDKStr err;
+} LDKAPIError_LDKAPIMisuseError_Body;
+
+typedef struct LDKAPIError_LDKFeeRateTooHigh_Body {
/**
- * Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
+ * A human-readable error message
*/
- bool result_ok;
-} LDKCResult_PhantomRouteHintsDecodeErrorZ;
+ struct LDKStr err;
+ /**
+ * The feerate which was too high.
+ */
+ uint32_t feerate;
+} LDKAPIError_LDKFeeRateTooHigh_Body;
-/**
- * A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
- * This corresponds to std::vector in C++
- */
-typedef struct LDKCVec_ChannelMonitorZ {
+typedef struct LDKAPIError_LDKRouteError_Body {
/**
- * The elements in the array.
- * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ * A human-readable error message
*/
- struct LDKChannelMonitor *data;
+ struct LDKStr err;
+} LDKAPIError_LDKRouteError_Body;
+
+typedef struct LDKAPIError_LDKChannelUnavailable_Body {
/**
- * The number of elements pointed to by `data`.
+ * A human-readable error message
*/
- uintptr_t datalen;
-} LDKCVec_ChannelMonitorZ;
+ struct LDKStr err;
+} LDKAPIError_LDKChannelUnavailable_Body;
+typedef struct LDKAPIError_LDKIncompatibleShutdownScript_Body {
+ /**
+ * The incompatible shutdown script.
+ */
+ struct LDKShutdownScript script;
+} LDKAPIError_LDKIncompatibleShutdownScript_Body;
+typedef struct MUST_USE_STRUCT LDKAPIError {
+ LDKAPIError_Tag tag;
+ union {
+ LDKAPIError_LDKAPIMisuseError_Body api_misuse_error;
+ LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high;
+ LDKAPIError_LDKRouteError_Body route_error;
+ LDKAPIError_LDKChannelUnavailable_Body channel_unavailable;
+ LDKAPIError_LDKIncompatibleShutdownScript_Body incompatible_shutdown_script;
+ };
+} LDKAPIError;
/**
- * An update generated by the underlying Channel itself which contains some new information the
- * ChannelMonitor should be made aware of.
+ * The contents of CResult_NoneAPIErrorZ
*/
-typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate {
+typedef union LDKCResult_NoneAPIErrorZPtr {
/**
- * 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.
+ * Note that this value is always NULL, as there are no contents in the OK variant
*/
- LDKnativeChannelMonitorUpdate *inner;
+ void *result;
/**
- * Indicates that this is the only struct which contains the same pointer.
- * Rust functions which take ownership of an object provided via an argument require
- * this to be true and invalidate the object pointed to by inner.
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
*/
- bool is_owned;
-} LDKChannelMonitorUpdate;
+ struct LDKAPIError *err;
+} LDKCResult_NoneAPIErrorZPtr;
/**
- * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as
- * blocks are connected and disconnected.
- *
- * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are
- * responsible for maintaining a set of monitors such that they can be updated accordingly as
- * channel state changes and HTLCs are resolved. See method documentation for specific
- * requirements.
- *
- * Implementations **must** ensure that updates are successfully applied and persisted upon method
- * completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down
- * without taking any further action such as persisting the current state.
- *
- * If an implementation maintains multiple instances of a channel's monitor (e.g., by storing
- * backup copies), then it must ensure that updates are applied across all instances. Otherwise, it
- * could result in a revoked transaction being broadcast, allowing the counterparty to claim all
- * funds in the channel. See [`ChannelMonitorUpdateErr`] for more details about how to handle
- * multiple instances.
- *
- * [`PermanentFailure`]: ChannelMonitorUpdateErr::PermanentFailure
+ * A CResult_NoneAPIErrorZ represents the result of a fallible operation,
+ * containing a () on success and a crate::lightning::util::errors::APIError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKWatch {
- /**
- * An opaque pointer which is passed to your function implementations as an argument.
- * This has no meaning in the LDK, and can be NULL or any other value.
- */
- void *this_arg;
+typedef struct LDKCResult_NoneAPIErrorZ {
/**
- * Watches a channel identified by `funding_txo` using `monitor`.
- *
- * Implementations are responsible for watching the chain for the funding transaction along
- * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means
- * calling [`block_connected`] and [`block_disconnected`] on the monitor.
- *
- * Note: this interface MUST error with `ChannelMonitorUpdateErr::PermanentFailure` if
- * the given `funding_txo` has previously been registered via `watch_channel`.
- *
- * [`get_outputs_to_watch`]: channelmonitor::ChannelMonitor::get_outputs_to_watch
- * [`block_connected`]: channelmonitor::ChannelMonitor::block_connected
- * [`block_disconnected`]: channelmonitor::ChannelMonitor::block_disconnected
+ * The contents of this CResult_NoneAPIErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
*/
- struct LDKCResult_NoneChannelMonitorUpdateErrZ (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor);
+ union LDKCResult_NoneAPIErrorZPtr contents;
/**
- * Updates a channel identified by `funding_txo` by applying `update` to its monitor.
- *
- * Implementations must call [`update_monitor`] with the given update. See
- * [`ChannelMonitorUpdateErr`] for invariants around returning an error.
- *
- * [`update_monitor`]: channelmonitor::ChannelMonitor::update_monitor
+ * Whether this CResult_NoneAPIErrorZ represents a success state.
*/
- struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update);
- /**
- * Returns any monitor events since the last call. Subsequent calls must only return new
- * events.
- *
- * Note that after any block- or transaction-connection calls to a [`ChannelMonitor`], no
- * further events may be returned here until the [`ChannelMonitor`] has been fully persisted
- * to disk.
- *
- * For details on asynchronous [`ChannelMonitor`] updating and returning
- * [`MonitorEvent::UpdateCompleted`] here, see [`ChannelMonitorUpdateErr::TemporaryFailure`].
+ bool result_ok;
+} LDKCResult_NoneAPIErrorZ;
+
+/**
+ * A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
+ * This corresponds to std::vector in C++
+ */
+typedef struct LDKCVec_CResult_NoneAPIErrorZZ {
+ /**
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
*/
- struct LDKCVec_MonitorEventZ (*release_pending_monitor_events)(const void *this_arg);
+ struct LDKCResult_NoneAPIErrorZ *data;
/**
- * Frees any resources associated with this object given its this_arg pointer.
- * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ * The number of elements pointed to by `data`.
*/
- void (*free)(void *this_arg);
-} LDKWatch;
+ uintptr_t datalen;
+} LDKCVec_CResult_NoneAPIErrorZZ;
/**
- * An interface to send a transaction to the Bitcoin network.
+ * A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
+ * This corresponds to std::vector in C++
*/
-typedef struct LDKBroadcasterInterface {
+typedef struct LDKCVec_APIErrorZ {
/**
- * An opaque pointer which is passed to your function implementations as an argument.
- * This has no meaning in the LDK, and can be NULL or any other value.
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
*/
- void *this_arg;
+ struct LDKAPIError *data;
/**
- * Sends a transaction out to (hopefully) be mined.
+ * The number of elements pointed to by `data`.
*/
- void (*broadcast_transaction)(const void *this_arg, struct LDKTransaction tx);
+ uintptr_t datalen;
+} LDKCVec_APIErrorZ;
+
+/**
+ * The contents of CResult__u832APIErrorZ
+ */
+typedef union LDKCResult__u832APIErrorZPtr {
/**
- * Frees any resources associated with this object given its this_arg pointer.
- * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
*/
- void (*free)(void *this_arg);
-} LDKBroadcasterInterface;
+ struct LDKThirtyTwoBytes *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKAPIError *err;
+} LDKCResult__u832APIErrorZPtr;
/**
- * A "slice" referencing some byte array. This is simply a length-tagged pointer which does not
- * own the memory pointed to by data.
+ * A CResult__u832APIErrorZ represents the result of a fallible operation,
+ * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKu8slice {
+typedef struct LDKCResult__u832APIErrorZ {
/**
- * A pointer to the byte buffer
+ * The contents of this CResult__u832APIErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
*/
- const uint8_t *data;
+ union LDKCResult__u832APIErrorZPtr contents;
/**
- * The number of bytes pointed to by `data`.
+ * Whether this CResult__u832APIErrorZ represents a success state.
*/
- uintptr_t datalen;
-} LDKu8slice;
+ bool result_ok;
+} LDKCResult__u832APIErrorZ;
/**
- * A trait to describe an object which can get user secrets and key material.
+ * If a payment fails to send, it can be in one of several states. This enum is returned as the
+ * Err() type describing which state the payment is in, see the description of individual enum
+ * states for more.
*/
-typedef struct LDKKeysInterface {
+typedef enum LDKPaymentSendFailure_Tag {
/**
- * An opaque pointer which is passed to your function implementations as an argument.
- * This has no meaning in the LDK, and can be NULL or any other value.
+ * A parameter which was passed to send_payment was invalid, preventing us from attempting to
+ * send the payment at all. No channel state has been changed or messages sent to peers, and
+ * once you've changed the parameter at error, you can freely retry the payment in full.
*/
- void *this_arg;
+ LDKPaymentSendFailure_ParameterError,
/**
- * Get node secret key (aka node_id or network_key) based on the provided [`Recipient`].
+ * A parameter in a single path which was passed to send_payment was invalid, preventing us
+ * from attempting to send the payment at all. No channel state has been changed or messages
+ * sent to peers, and once you've changed the parameter at error, you can freely retry the
+ * payment in full.
*
- * This method must return the same value each time it is called with a given `Recipient`
- * parameter.
+ * The results here are ordered the same as the paths in the route object which was passed to
+ * send_payment.
*/
- struct LDKCResult_SecretKeyNoneZ (*get_node_secret)(const void *this_arg, enum LDKRecipient recipient);
+ LDKPaymentSendFailure_PathParameterError,
/**
- * Get a script pubkey which we send funds to when claiming on-chain contestable outputs.
- *
- * This method should return a different value each time it is called, to avoid linking
- * on-chain funds across channels as controlled to the same user.
+ * All paths which were attempted failed to send, with no channel state change taking place.
+ * You can freely retry the payment in full (though you probably want to do so over different
+ * paths than the ones selected).
*/
- struct LDKCVec_u8Z (*get_destination_script)(const void *this_arg);
+ LDKPaymentSendFailure_AllFailedRetrySafe,
/**
- * Get a script pubkey which we will send funds to when closing a channel.
+ * Some paths which were attempted failed to send, though possibly not all. At least some
+ * paths have irrevocably committed to the HTLC and retrying the payment in full would result
+ * in over-/re-payment.
*
- * This method should return a different value each time it is called, to avoid linking
- * on-chain funds across channels as controlled to the same user.
+ * The results here are ordered the same as the paths in the route object which was passed to
+ * send_payment, and any Errs which are not APIError::MonitorUpdateFailed can be safely
+ * retried (though there is currently no API with which to do so).
+ *
+ * Any entries which contain Err(APIError::MonitorUpdateFailed) or Ok(()) MUST NOT be retried
+ * as they will result in over-/re-payment. These HTLCs all either successfully sent (in the
+ * case of Ok(())) or will send once channel_monitor_updated is called on the next-hop channel
+ * with the latest update_id.
*/
- struct LDKShutdownScript (*get_shutdown_scriptpubkey)(const void *this_arg);
+ LDKPaymentSendFailure_PartialFailure,
/**
- * Get a new set of Sign for per-channel secrets. These MUST be unique even if you
- * restarted with some stale data!
- *
- * This method must return a different value each time it is called.
+ * Must be last for serialization purposes
*/
- struct LDKSign (*get_channel_signer)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis);
+ LDKPaymentSendFailure_Sentinel,
+} LDKPaymentSendFailure_Tag;
+
+typedef struct LDKPaymentSendFailure_LDKPartialFailure_Body {
/**
- * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting
- * onion packets and for temporary channel IDs. There is no requirement that these be
- * persisted anywhere, though they must be unique across restarts.
+ * The errors themselves, in the same order as the route hops.
+ */
+ struct LDKCVec_CResult_NoneAPIErrorZZ results;
+ /**
+ * If some paths failed without irrevocably committing to the new HTLC(s), this will
+ * contain a [`RouteParameters`] object which can be used to calculate a new route that
+ * will pay all remaining unpaid balance.
*
- * This method must return a different value each time it is called.
+ * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
- struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg);
+ struct LDKRouteParameters failed_paths_retry;
/**
- * Reads a `Signer` for this `KeysInterface` from the given input stream.
- * This is only called during deserialization of other objects which contain
- * `Sign`-implementing objects (ie `ChannelMonitor`s and `ChannelManager`s).
- * The bytes are exactly those which `<Self::Signer as Writeable>::write()` writes, and
- * contain no versioning scheme. You may wish to include your own version prefix and ensure
- * you've read all of the provided bytes to ensure no corruption occurred.
+ * The payment id for the payment, which is now at least partially pending.
*/
- struct LDKCResult_SignDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader);
+ struct LDKThirtyTwoBytes payment_id;
+} LDKPaymentSendFailure_LDKPartialFailure_Body;
+
+typedef struct MUST_USE_STRUCT LDKPaymentSendFailure {
+ LDKPaymentSendFailure_Tag tag;
+ union {
+ struct {
+ struct LDKAPIError parameter_error;
+ };
+ struct {
+ struct LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error;
+ };
+ struct {
+ struct LDKCVec_APIErrorZ all_failed_retry_safe;
+ };
+ LDKPaymentSendFailure_LDKPartialFailure_Body partial_failure;
+ };
+} LDKPaymentSendFailure;
+
+/**
+ * The contents of CResult_PaymentIdPaymentSendFailureZ
+ */
+typedef union LDKCResult_PaymentIdPaymentSendFailureZPtr {
/**
- * Sign an invoice.
- * By parameterizing by the raw invoice bytes instead of the hash, we allow implementors of
- * this trait to parse the invoice and make sure they're signing what they expect, rather than
- * blindly signing the hash.
- * The hrp is ascii bytes, while the invoice data is base32.
- *
- * The secret key used to sign the invoice is dependent on the [`Recipient`].
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKCResult_RecoverableSignatureNoneZ (*sign_invoice)(const void *this_arg, struct LDKu8slice hrp_bytes, struct LDKCVec_u5Z invoice_data, enum LDKRecipient receipient);
+ struct LDKThirtyTwoBytes *result;
/**
- * Get secret key material as bytes for use in encrypting and decrypting inbound payment data.
- *
- * If the implementor of this trait supports [phantom node payments], then every node that is
- * intended to be included in the phantom invoice route hints must return the same value from
- * this method.
- *
- * This method must return the same value each time it is called.
- *
- * [phantom node payments]: PhantomKeysManager
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
*/
- struct LDKThirtyTwoBytes (*get_inbound_payment_key_material)(const void *this_arg);
+ struct LDKPaymentSendFailure *err;
+} LDKCResult_PaymentIdPaymentSendFailureZPtr;
+
+/**
+ * A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation,
+ * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_PaymentIdPaymentSendFailureZ {
/**
- * Frees any resources associated with this object given its this_arg pointer.
- * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ * The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
*/
- void (*free)(void *this_arg);
-} LDKKeysInterface;
+ union LDKCResult_PaymentIdPaymentSendFailureZPtr contents;
+ /**
+ * Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_PaymentIdPaymentSendFailureZ;
/**
- * A trait which should be implemented to provide feerate information on a number of time
- * horizons.
- *
- * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
- * called from inside the library in response to chain events, P2P events, or timer events).
+ * The contents of CResult_NonePaymentSendFailureZ
*/
-typedef struct LDKFeeEstimator {
+typedef union LDKCResult_NonePaymentSendFailureZPtr {
/**
- * 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.
+ * Note that this value is always NULL, as there are no contents in the OK variant
*/
- void *this_arg;
+ void *result;
/**
- * Gets estimated satoshis of fee required per 1000 Weight-Units.
- *
- * Must return a value no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later
- * round-downs don't put us below 1 satoshi-per-byte).
- *
- * This method can be implemented with the following unit conversions:
- * * max(satoshis-per-byte * 250, 253)
- * * max(satoshis-per-kbyte / 4, 253)
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
*/
- uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, enum LDKConfirmationTarget confirmation_target);
+ struct LDKPaymentSendFailure *err;
+} LDKCResult_NonePaymentSendFailureZPtr;
+
+/**
+ * A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
+ * containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_NonePaymentSendFailureZ {
/**
- * Frees any resources associated with this object given its this_arg pointer.
- * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ * The contents of this CResult_NonePaymentSendFailureZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_NonePaymentSendFailureZPtr contents;
+ /**
+ * Whether this CResult_NonePaymentSendFailureZ represents a success state.
*/
- void (*free)(void *this_arg);
-} LDKFeeEstimator;
-
-
+ bool result_ok;
+} LDKCResult_NonePaymentSendFailureZ;
/**
- * A Record, unit of logging output with Metadata to enable filtering
- * Module_path, file, line to inform on log's source
+ * A tuple of 2 elements. See the individual fields for the types contained.
*/
-typedef struct MUST_USE_STRUCT LDKRecord {
+typedef struct LDKC2Tuple_PaymentHashPaymentIdZ {
/**
- * A pointer to the opaque Rust object.
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ * The element at position 0
*/
- LDKnativeRecord *inner;
+ struct LDKThirtyTwoBytes a;
/**
- * Indicates that this is the only struct which contains the same pointer.
- * Rust functions which take ownership of an object provided via an argument require
- * this to be true and invalidate the object pointed to by inner.
+ * The element at position 1
*/
- bool is_owned;
-} LDKRecord;
+ struct LDKThirtyTwoBytes b;
+} LDKC2Tuple_PaymentHashPaymentIdZ;
/**
- * A trait encapsulating the operations required of a logger
+ * The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
*/
-typedef struct LDKLogger {
- /**
- * An opaque pointer which is passed to your function implementations as an argument.
- * This has no meaning in the LDK, and can be NULL or any other value.
- */
- void *this_arg;
+typedef union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
/**
- * Logs the `Record`
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
*/
- void (*log)(const void *this_arg, const struct LDKRecord *NONNULL_PTR record);
+ struct LDKC2Tuple_PaymentHashPaymentIdZ *result;
/**
- * Frees any resources associated with this object given its this_arg pointer.
- * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
*/
- void (*free)(void *this_arg);
-} LDKLogger;
-
-
+ struct LDKPaymentSendFailure *err;
+} LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr;
/**
- * Manager which keeps track of a number of channels and sends messages to the appropriate
- * channel, also tracking HTLC preimages and forwarding onion packets appropriately.
- *
- * Implements ChannelMessageHandler, handling the multi-channel parts and passing things through
- * to individual Channels.
- *
- * Implements Writeable to write out all channel state to disk. Implies peer_disconnected() for
- * all peers during write/read (though does not modify this instance, only the instance being
- * serialized). This will result in any channels which have not yet exchanged funding_created (ie
- * called funding_transaction_generated for outbound channels).
- *
- * Note that you can be a bit lazier about writing out ChannelManager than you can be with
- * ChannelMonitors. With ChannelMonitors you MUST write each monitor update out to disk before
- * returning from chain::Watch::watch_/update_channel, with ChannelManagers, writing updates
- * happens out-of-band (and will prevent any other ChannelManager operations from occurring during
- * the serialization process). If the deserialized version is out-of-date compared to the
- * ChannelMonitors passed by reference to read(), those channels will be force-closed based on the
- * ChannelMonitor state and no funds will be lost (mod on-chain transaction fees).
- *
- * Note that the deserializer is only implemented for (BlockHash, ChannelManager), which
- * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
- * the \"reorg path\" (ie call block_disconnected() until you get to a common block and then call
- * block_connected() to step towards your best block) upon deserialization before using the
- * object!
- *
- * Note that ChannelManager is responsible for tracking liveness of its channels and generating
- * ChannelUpdate messages informing peers that the channel is temporarily disabled. To avoid
- * spam due to quick disconnection/reconnection, updates are not sent until the channel has been
- * offline for a full minute. In order to track this, you must call
- * timer_tick_occurred roughly once per minute, though it doesn't have to be perfect.
- *
- * Rather than using a plain ChannelManager, it is preferable to use either a SimpleArcChannelManager
- * a SimpleRefChannelManager, for conciseness. See their documentation for more details, but
- * essentially you should default to using a SimpleRefChannelManager, and use a
- * SimpleArcChannelManager when you require a ChannelManager with a static lifetime, such as when
- * you're using lightning-net-tokio.
+ * A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
+ * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct MUST_USE_STRUCT LDKChannelManager {
+typedef struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
/**
- * A pointer to the opaque Rust object.
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ * The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
*/
- LDKnativeChannelManager *inner;
+ union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr contents;
/**
- * Indicates that this is the only struct which contains the same pointer.
- * Rust functions which take ownership of an object provided via an argument require
- * this to be true and invalidate the object pointed to by inner.
+ * Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
*/
- bool is_owned;
-} LDKChannelManager;
+ bool result_ok;
+} LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ;
/**
* A tuple of 2 elements. See the individual fields for the types contained.
*/
-typedef struct LDKC2Tuple_BlockHashChannelManagerZ {
+typedef struct LDKC2Tuple_PaymentHashPaymentSecretZ {
/**
* The element at position 0
*/
/**
* The element at position 1
*/
- struct LDKChannelManager b;
-} LDKC2Tuple_BlockHashChannelManagerZ;
+ struct LDKThirtyTwoBytes b;
+} LDKC2Tuple_PaymentHashPaymentSecretZ;
/**
- * The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
+ * The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ
*/
-typedef union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
+typedef union LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKC2Tuple_BlockHashChannelManagerZ *result;
+ struct LDKC2Tuple_PaymentHashPaymentSecretZ *result;
/**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
+ * Note that this value is always NULL, as there are no contents in the Err variant
*/
- struct LDKDecodeError *err;
-} LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr;
+ void *err;
+} LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr;
/**
- * A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * A CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation,
+ * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
+typedef struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
/**
- * The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
+ * The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr contents;
+ union LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr contents;
/**
- * Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
+ * Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state.
*/
bool result_ok;
-} LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ;
-
+} LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ;
+/**
+ * The contents of CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ
+ */
+typedef union LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKC2Tuple_PaymentHashPaymentSecretZ *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKAPIError *err;
+} LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr;
/**
- * Options which apply on a per-channel basis and may change at runtime or based on negotiation
- * with our counterparty.
+ * A CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents the result of a fallible operation,
+ * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a crate::lightning::util::errors::APIError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct MUST_USE_STRUCT LDKChannelConfig {
+typedef struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
/**
- * A pointer to the opaque Rust object.
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ * The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
*/
- LDKnativeChannelConfig *inner;
+ union LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr contents;
/**
- * Indicates that this is the only struct which contains the same pointer.
- * Rust functions which take ownership of an object provided via an argument require
- * this to be true and invalidate the object pointed to by inner.
+ * Whether this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents a success state.
*/
- bool is_owned;
-} LDKChannelConfig;
+ bool result_ok;
+} LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ;
/**
- * The contents of CResult_ChannelConfigDecodeErrorZ
+ * The contents of CResult_PaymentSecretNoneZ
*/
-typedef union LDKCResult_ChannelConfigDecodeErrorZPtr {
+typedef union LDKCResult_PaymentSecretNoneZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKChannelConfig *result;
+ struct LDKThirtyTwoBytes *result;
/**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
+ * Note that this value is always NULL, as there are no contents in the Err variant
*/
- struct LDKDecodeError *err;
-} LDKCResult_ChannelConfigDecodeErrorZPtr;
+ void *err;
+} LDKCResult_PaymentSecretNoneZPtr;
/**
- * A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * A CResult_PaymentSecretNoneZ represents the result of a fallible operation,
+ * containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_ChannelConfigDecodeErrorZ {
+typedef struct LDKCResult_PaymentSecretNoneZ {
/**
- * The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
+ * The contents of this CResult_PaymentSecretNoneZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_ChannelConfigDecodeErrorZPtr contents;
+ union LDKCResult_PaymentSecretNoneZPtr contents;
/**
- * Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
+ * Whether this CResult_PaymentSecretNoneZ represents a success state.
*/
bool result_ok;
-} LDKCResult_ChannelConfigDecodeErrorZ;
+} LDKCResult_PaymentSecretNoneZ;
/**
- * The contents of CResult_OutPointDecodeErrorZ
+ * The contents of CResult_PaymentSecretAPIErrorZ
*/
-typedef union LDKCResult_OutPointDecodeErrorZPtr {
+typedef union LDKCResult_PaymentSecretAPIErrorZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKOutPoint *result;
+ struct LDKThirtyTwoBytes *result;
/**
* A pointer to the contents in the error state.
* Reading from this pointer when `result_ok` is set is undefined.
*/
- struct LDKDecodeError *err;
-} LDKCResult_OutPointDecodeErrorZPtr;
+ struct LDKAPIError *err;
+} LDKCResult_PaymentSecretAPIErrorZPtr;
/**
- * A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
+ * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_OutPointDecodeErrorZ {
+typedef struct LDKCResult_PaymentSecretAPIErrorZ {
/**
- * The contents of this CResult_OutPointDecodeErrorZ, accessible via either
+ * The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_OutPointDecodeErrorZPtr contents;
+ union LDKCResult_PaymentSecretAPIErrorZPtr contents;
/**
- * Whether this CResult_OutPointDecodeErrorZ represents a success state.
+ * Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_OutPointDecodeErrorZ;
+} LDKCResult_PaymentSecretAPIErrorZ;
/**
- * Defines a type identifier for sending messages over the wire.
- *
- * Messages implementing this trait specify a type and must be [`Writeable`].
+ * The contents of CResult_PaymentPreimageAPIErrorZ
*/
-typedef struct LDKType {
- /**
- * An opaque pointer which is passed to your function implementations as an argument.
- * This has no meaning in the LDK, and can be NULL or any other value.
- */
- void *this_arg;
+typedef union LDKCResult_PaymentPreimageAPIErrorZPtr {
/**
- * Returns the type identifying the message payload.
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
*/
- uint16_t (*type_id)(const void *this_arg);
+ struct LDKThirtyTwoBytes *result;
/**
- * Return a human-readable "debug" string describing this object
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
*/
- struct LDKStr (*debug_str)(const void *this_arg);
+ struct LDKAPIError *err;
+} LDKCResult_PaymentPreimageAPIErrorZPtr;
+
+/**
+ * A CResult_PaymentPreimageAPIErrorZ represents the result of a fallible operation,
+ * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_PaymentPreimageAPIErrorZ {
/**
- * Serialize the object into a byte array
+ * The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
*/
- struct LDKCVec_u8Z (*write)(const void *this_arg);
+ union LDKCResult_PaymentPreimageAPIErrorZPtr contents;
/**
- * Frees any resources associated with this object given its this_arg pointer.
- * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ * Whether this CResult_PaymentPreimageAPIErrorZ represents a success state.
*/
- void (*free)(void *this_arg);
-} LDKType;
+ bool result_ok;
+} LDKCResult_PaymentPreimageAPIErrorZ;
+
+
/**
- * An enum which can either contain a crate::lightning::ln::wire::Type or not
+ * Information needed for constructing an invoice route hint for this channel.
*/
-typedef enum LDKCOption_TypeZ_Tag {
- /**
- * When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
- */
- LDKCOption_TypeZ_Some,
+typedef struct MUST_USE_STRUCT LDKCounterpartyForwardingInfo {
/**
- * When we're in this state, this COption_TypeZ contains nothing
+ * 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.
*/
- LDKCOption_TypeZ_None,
+ LDKnativeCounterpartyForwardingInfo *inner;
/**
- * Must be last for serialization purposes
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
*/
- LDKCOption_TypeZ_Sentinel,
-} LDKCOption_TypeZ_Tag;
-
-typedef struct LDKCOption_TypeZ {
- LDKCOption_TypeZ_Tag tag;
- union {
- struct {
- struct LDKType some;
- };
- };
-} LDKCOption_TypeZ;
+ bool is_owned;
+} LDKCounterpartyForwardingInfo;
/**
- * The contents of CResult_COption_TypeZDecodeErrorZ
+ * The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
*/
-typedef union LDKCResult_COption_TypeZDecodeErrorZPtr {
+typedef union LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKCOption_TypeZ *result;
+ struct LDKCounterpartyForwardingInfo *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_TypeZDecodeErrorZPtr;
+} LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr;
/**
- * A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo 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_TypeZDecodeErrorZ {
+typedef struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ {
/**
- * The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
+ * The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_COption_TypeZDecodeErrorZPtr contents;
+ union LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr contents;
/**
- * Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
+ * Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_COption_TypeZDecodeErrorZ;
+} LDKCResult_CounterpartyForwardingInfoDecodeErrorZ;
+
+
/**
- * An error that may occur when making a payment.
+ * Channel parameters which apply to our counterparty. These are split out from [`ChannelDetails`]
+ * to better separate parameters.
*/
-typedef enum LDKPaymentError_Tag {
- /**
- * An error resulting from the provided [`Invoice`] or payment hash.
- */
- LDKPaymentError_Invoice,
- /**
- * An error occurring when finding a route.
- */
- LDKPaymentError_Routing,
+typedef struct MUST_USE_STRUCT LDKChannelCounterparty {
/**
- * An error occurring when sending a payment.
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- LDKPaymentError_Sending,
+ LDKnativeChannelCounterparty *inner;
/**
- * Must be last for serialization purposes
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
*/
- LDKPaymentError_Sentinel,
-} LDKPaymentError_Tag;
-
-typedef struct MUST_USE_STRUCT LDKPaymentError {
- LDKPaymentError_Tag tag;
- union {
- struct {
- struct LDKStr invoice;
- };
- struct {
- struct LDKLightningError routing;
- };
- struct {
- struct LDKPaymentSendFailure sending;
- };
- };
-} LDKPaymentError;
+ bool is_owned;
+} LDKChannelCounterparty;
/**
- * The contents of CResult_PaymentIdPaymentErrorZ
+ * The contents of CResult_ChannelCounterpartyDecodeErrorZ
*/
-typedef union LDKCResult_PaymentIdPaymentErrorZPtr {
+typedef union LDKCResult_ChannelCounterpartyDecodeErrorZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKThirtyTwoBytes *result;
+ struct LDKChannelCounterparty *result;
/**
* A pointer to the contents in the error state.
* Reading from this pointer when `result_ok` is set is undefined.
*/
- struct LDKPaymentError *err;
-} LDKCResult_PaymentIdPaymentErrorZPtr;
+ struct LDKDecodeError *err;
+} LDKCResult_ChannelCounterpartyDecodeErrorZPtr;
/**
- * A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
- * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
+ * A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::channelmanager::ChannelCounterparty 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_PaymentIdPaymentErrorZ {
+typedef struct LDKCResult_ChannelCounterpartyDecodeErrorZ {
/**
- * The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
+ * The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_PaymentIdPaymentErrorZPtr contents;
+ union LDKCResult_ChannelCounterpartyDecodeErrorZPtr contents;
/**
- * Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
+ * Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_PaymentIdPaymentErrorZ;
+} LDKCResult_ChannelCounterpartyDecodeErrorZ;
/**
- * Sub-errors which don't have specific information in them use this type.
+ * The contents of CResult_ChannelDetailsDecodeErrorZ
*/
-typedef struct LDKError {
+typedef union LDKCResult_ChannelDetailsDecodeErrorZPtr {
/**
- * Zero-Sized_types aren't consistent across Rust/C/C++, so we add some size here
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
*/
- uint8_t _dummy;
-} LDKError;
+ struct LDKChannelDetails *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_ChannelDetailsDecodeErrorZPtr;
/**
- * Errors that indicate what is wrong with the invoice. They have some granularity for debug
- * reasons, but should generally result in an \"invalid BOLT11 invoice\" message for the user.
+ * A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::channelmanager::ChannelDetails 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 enum LDKParseError_Tag {
- LDKParseError_Bech32Error,
- LDKParseError_ParseAmountError,
- LDKParseError_MalformedSignature,
- LDKParseError_BadPrefix,
- LDKParseError_UnknownCurrency,
- LDKParseError_UnknownSiPrefix,
- LDKParseError_MalformedHRP,
- LDKParseError_TooShortDataPart,
- LDKParseError_UnexpectedEndOfTaggedFields,
- LDKParseError_DescriptionDecodeError,
- LDKParseError_PaddingError,
- LDKParseError_IntegerOverflowError,
- LDKParseError_InvalidSegWitProgramLength,
- LDKParseError_InvalidPubKeyHashLength,
- LDKParseError_InvalidScriptHashLength,
- LDKParseError_InvalidRecoveryId,
- LDKParseError_InvalidSliceLength,
+typedef struct LDKCResult_ChannelDetailsDecodeErrorZ {
/**
- * Not an error, but used internally to signal that a part of the invoice should be ignored
- * according to BOLT11
+ * The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
*/
- LDKParseError_Skip,
+ union LDKCResult_ChannelDetailsDecodeErrorZPtr contents;
/**
- * Must be last for serialization purposes
+ * Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
*/
- LDKParseError_Sentinel,
-} LDKParseError_Tag;
+ bool result_ok;
+} LDKCResult_ChannelDetailsDecodeErrorZ;
+
-typedef struct MUST_USE_STRUCT LDKParseError {
- LDKParseError_Tag tag;
- union {
- struct {
- struct LDKBech32Error bech32_error;
- };
- struct {
- struct LDKError parse_amount_error;
- };
- struct {
- enum LDKSecp256k1Error malformed_signature;
- };
- struct {
- struct LDKError description_decode_error;
- };
- struct {
- struct LDKStr invalid_slice_length;
- };
- };
-} LDKParseError;
/**
- * The contents of CResult_SiPrefixParseErrorZ
+ * Route hints used in constructing invoices for [phantom node payents].
+ *
+ * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
*/
-typedef union LDKCResult_SiPrefixParseErrorZPtr {
+typedef struct MUST_USE_STRUCT LDKPhantomRouteHints {
+ /**
+ * 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.
+ */
+ LDKnativePhantomRouteHints *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;
+} LDKPhantomRouteHints;
+
+/**
+ * The contents of CResult_PhantomRouteHintsDecodeErrorZ
+ */
+typedef union LDKCResult_PhantomRouteHintsDecodeErrorZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- enum LDKSiPrefix *result;
+ struct LDKPhantomRouteHints *result;
/**
* A pointer to the contents in the error state.
* Reading from this pointer when `result_ok` is set is undefined.
*/
- struct LDKParseError *err;
-} LDKCResult_SiPrefixParseErrorZPtr;
+ struct LDKDecodeError *err;
+} LDKCResult_PhantomRouteHintsDecodeErrorZPtr;
/**
- * A CResult_SiPrefixParseErrorZ represents the result of a fallible operation,
- * containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::ParseError on failure.
+ * A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::channelmanager::PhantomRouteHints 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_SiPrefixParseErrorZ {
+typedef struct LDKCResult_PhantomRouteHintsDecodeErrorZ {
+ /**
+ * The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_PhantomRouteHintsDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_PhantomRouteHintsDecodeErrorZ;
+
+/**
+ * A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
+ * This corresponds to std::vector in C++
+ */
+typedef struct LDKCVec_ChannelMonitorZ {
/**
- * The contents of this CResult_SiPrefixParseErrorZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
*/
- union LDKCResult_SiPrefixParseErrorZPtr contents;
+ struct LDKChannelMonitor *data;
/**
- * Whether this CResult_SiPrefixParseErrorZ represents a success state.
+ * The number of elements pointed to by `data`.
*/
- bool result_ok;
-} LDKCResult_SiPrefixParseErrorZ;
+ uintptr_t datalen;
+} LDKCVec_ChannelMonitorZ;
/**
- * Represents a syntactically and semantically correct lightning BOLT11 invoice.
- *
- * There are three ways to construct an `Invoice`:
- * 1. using `InvoiceBuilder`
- * 2. using `Invoice::from_signed(SignedRawInvoice)`
- * 3. using `str::parse::<Invoice>(&str)`
+ * An update generated by the underlying Channel itself which contains some new information the
+ * ChannelMonitor should be made aware of.
*/
-typedef struct MUST_USE_STRUCT LDKInvoice {
+typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate {
/**
* 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.
*/
- LDKnativeInvoice *inner;
+ LDKnativeChannelMonitorUpdate *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;
-} LDKInvoice;
+} LDKChannelMonitorUpdate;
/**
- * Indicates that something went wrong while parsing or validating the invoice. Parsing errors
- * should be mostly seen as opaque and are only there for debugging reasons. Semantic errors
- * like wrong signatures, missing fields etc. could mean that someone tampered with the invoice.
+ * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as
+ * blocks are connected and disconnected.
+ *
+ * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are
+ * responsible for maintaining a set of monitors such that they can be updated accordingly as
+ * channel state changes and HTLCs are resolved. See method documentation for specific
+ * requirements.
+ *
+ * Implementations **must** ensure that updates are successfully applied and persisted upon method
+ * completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down
+ * without taking any further action such as persisting the current state.
+ *
+ * If an implementation maintains multiple instances of a channel's monitor (e.g., by storing
+ * backup copies), then it must ensure that updates are applied across all instances. Otherwise, it
+ * could result in a revoked transaction being broadcast, allowing the counterparty to claim all
+ * funds in the channel. See [`ChannelMonitorUpdateErr`] for more details about how to handle
+ * multiple instances.
+ *
+ * [`PermanentFailure`]: ChannelMonitorUpdateErr::PermanentFailure
*/
-typedef enum LDKParseOrSemanticError_Tag {
+typedef struct LDKWatch {
/**
- * The invoice couldn't be decoded
+ * 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.
*/
- LDKParseOrSemanticError_ParseError,
+ void *this_arg;
/**
- * The invoice could be decoded but violates the BOLT11 standard
+ * Watches a channel identified by `funding_txo` using `monitor`.
+ *
+ * Implementations are responsible for watching the chain for the funding transaction along
+ * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means
+ * calling [`block_connected`] and [`block_disconnected`] on the monitor.
+ *
+ * Note: this interface MUST error with `ChannelMonitorUpdateErr::PermanentFailure` if
+ * the given `funding_txo` has previously been registered via `watch_channel`.
+ *
+ * [`get_outputs_to_watch`]: channelmonitor::ChannelMonitor::get_outputs_to_watch
+ * [`block_connected`]: channelmonitor::ChannelMonitor::block_connected
+ * [`block_disconnected`]: channelmonitor::ChannelMonitor::block_disconnected
*/
- LDKParseOrSemanticError_SemanticError,
+ struct LDKCResult_NoneChannelMonitorUpdateErrZ (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor);
/**
- * Must be last for serialization purposes
+ * Updates a channel identified by `funding_txo` by applying `update` to its monitor.
+ *
+ * Implementations must call [`update_monitor`] with the given update. See
+ * [`ChannelMonitorUpdateErr`] for invariants around returning an error.
+ *
+ * [`update_monitor`]: channelmonitor::ChannelMonitor::update_monitor
*/
- LDKParseOrSemanticError_Sentinel,
-} LDKParseOrSemanticError_Tag;
-
-typedef struct MUST_USE_STRUCT LDKParseOrSemanticError {
- LDKParseOrSemanticError_Tag tag;
- union {
- struct {
- struct LDKParseError parse_error;
- };
- struct {
- enum LDKSemanticError semantic_error;
- };
- };
-} LDKParseOrSemanticError;
-
-/**
- * The contents of CResult_InvoiceParseOrSemanticErrorZ
- */
-typedef union LDKCResult_InvoiceParseOrSemanticErrorZPtr {
+ struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update);
/**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
+ * Returns any monitor events since the last call. Subsequent calls must only return new
+ * events.
+ *
+ * Note that after any block- or transaction-connection calls to a [`ChannelMonitor`], no
+ * further events may be returned here until the [`ChannelMonitor`] has been fully persisted
+ * to disk.
+ *
+ * For details on asynchronous [`ChannelMonitor`] updating and returning
+ * [`MonitorEvent::UpdateCompleted`] here, see [`ChannelMonitorUpdateErr::TemporaryFailure`].
*/
- struct LDKInvoice *result;
+ struct LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ (*release_pending_monitor_events)(const void *this_arg);
/**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
+ * Frees any resources associated with this object given its this_arg pointer.
+ * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
*/
- struct LDKParseOrSemanticError *err;
-} LDKCResult_InvoiceParseOrSemanticErrorZPtr;
+ void (*free)(void *this_arg);
+} LDKWatch;
/**
- * A CResult_InvoiceParseOrSemanticErrorZ represents the result of a fallible operation,
- * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::ParseOrSemanticError on failure.
- * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ * An interface to send a transaction to the Bitcoin network.
*/
-typedef struct LDKCResult_InvoiceParseOrSemanticErrorZ {
+typedef struct LDKBroadcasterInterface {
/**
- * The contents of this CResult_InvoiceParseOrSemanticErrorZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
+ * An opaque pointer which is passed to your function implementations as an argument.
+ * This has no meaning in the LDK, and can be NULL or any other value.
*/
- union LDKCResult_InvoiceParseOrSemanticErrorZPtr contents;
+ void *this_arg;
/**
- * Whether this CResult_InvoiceParseOrSemanticErrorZ represents a success state.
+ * Sends a transaction out to (hopefully) be mined.
*/
- bool result_ok;
-} LDKCResult_InvoiceParseOrSemanticErrorZ;
-
-
+ void (*broadcast_transaction)(const void *this_arg, struct LDKTransaction tx);
+ /**
+ * Frees any resources associated with this object given its this_arg pointer.
+ * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ */
+ void (*free)(void *this_arg);
+} LDKBroadcasterInterface;
/**
- * Represents a signed `RawInvoice` with cached hash. The signature is not checked and may be
- * invalid.
- *
- * # Invariants
- * The hash has to be either from the deserialized invoice or from the serialized `raw_invoice`.
+ * A "slice" referencing some byte array. This is simply a length-tagged pointer which does not
+ * own the memory pointed to by data.
*/
-typedef struct MUST_USE_STRUCT LDKSignedRawInvoice {
+typedef struct LDKu8slice {
/**
- * A pointer to the opaque Rust object.
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ * A pointer to the byte buffer
*/
- LDKnativeSignedRawInvoice *inner;
+ const uint8_t *data;
/**
- * Indicates that this is the only struct which contains the same pointer.
- * Rust functions which take ownership of an object provided via an argument require
- * this to be true and invalidate the object pointed to by inner.
+ * The number of bytes pointed to by `data`.
*/
- bool is_owned;
-} LDKSignedRawInvoice;
+ uintptr_t datalen;
+} LDKu8slice;
/**
- * The contents of CResult_SignedRawInvoiceParseErrorZ
+ * A trait to describe an object which can get user secrets and key material.
*/
-typedef union LDKCResult_SignedRawInvoiceParseErrorZPtr {
+typedef struct LDKKeysInterface {
/**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
+ * 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 LDKSignedRawInvoice *result;
+ void *this_arg;
/**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
+ * Get node secret key (aka node_id or network_key) based on the provided [`Recipient`].
+ *
+ * This method must return the same value each time it is called with a given `Recipient`
+ * parameter.
*/
- struct LDKParseError *err;
-} LDKCResult_SignedRawInvoiceParseErrorZPtr;
-
-/**
- * A CResult_SignedRawInvoiceParseErrorZ represents the result of a fallible operation,
- * containing a crate::lightning_invoice::SignedRawInvoice on success and a crate::lightning_invoice::ParseError on failure.
- * `result_ok` indicates the overall state, and the contents are provided via `contents`.
- */
-typedef struct LDKCResult_SignedRawInvoiceParseErrorZ {
+ struct LDKCResult_SecretKeyNoneZ (*get_node_secret)(const void *this_arg, enum LDKRecipient recipient);
/**
- * The contents of this CResult_SignedRawInvoiceParseErrorZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
+ * Get a script pubkey which we send funds to when claiming on-chain contestable outputs.
+ *
+ * This method should return a different value each time it is called, to avoid linking
+ * on-chain funds across channels as controlled to the same user.
*/
- union LDKCResult_SignedRawInvoiceParseErrorZPtr contents;
+ struct LDKCVec_u8Z (*get_destination_script)(const void *this_arg);
+ /**
+ * Get a script pubkey which we will send funds to when closing a channel.
+ *
+ * This method should return a different value each time it is called, to avoid linking
+ * on-chain funds across channels as controlled to the same user.
+ */
+ struct LDKShutdownScript (*get_shutdown_scriptpubkey)(const void *this_arg);
+ /**
+ * Get a new set of Sign for per-channel secrets. These MUST be unique even if you
+ * restarted with some stale data!
+ *
+ * This method must return a different value each time it is called.
+ */
+ struct LDKSign (*get_channel_signer)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis);
+ /**
+ * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting
+ * onion packets and for temporary channel IDs. There is no requirement that these be
+ * persisted anywhere, though they must be unique across restarts.
+ *
+ * This method must return a different value each time it is called.
+ */
+ struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg);
+ /**
+ * Reads a `Signer` for this `KeysInterface` from the given input stream.
+ * This is only called during deserialization of other objects which contain
+ * `Sign`-implementing objects (ie `ChannelMonitor`s and `ChannelManager`s).
+ * The bytes are exactly those which `<Self::Signer as Writeable>::write()` writes, and
+ * contain no versioning scheme. You may wish to include your own version prefix and ensure
+ * you've read all of the provided bytes to ensure no corruption occurred.
+ */
+ struct LDKCResult_SignDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader);
+ /**
+ * Sign an invoice.
+ * By parameterizing by the raw invoice bytes instead of the hash, we allow implementors of
+ * this trait to parse the invoice and make sure they're signing what they expect, rather than
+ * blindly signing the hash.
+ * The hrp is ascii bytes, while the invoice data is base32.
+ *
+ * The secret key used to sign the invoice is dependent on the [`Recipient`].
+ */
+ struct LDKCResult_RecoverableSignatureNoneZ (*sign_invoice)(const void *this_arg, struct LDKu8slice hrp_bytes, struct LDKCVec_u5Z invoice_data, enum LDKRecipient receipient);
+ /**
+ * Get secret key material as bytes for use in encrypting and decrypting inbound payment data.
+ *
+ * If the implementor of this trait supports [phantom node payments], then every node that is
+ * intended to be included in the phantom invoice route hints must return the same value from
+ * this method.
+ *
+ * This method must return the same value each time it is called.
+ *
+ * [phantom node payments]: PhantomKeysManager
+ */
+ struct LDKThirtyTwoBytes (*get_inbound_payment_key_material)(const void *this_arg);
/**
- * Whether this CResult_SignedRawInvoiceParseErrorZ represents a success state.
+ * Frees any resources associated with this object given its this_arg pointer.
+ * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
*/
- bool result_ok;
-} LDKCResult_SignedRawInvoiceParseErrorZ;
-
-
+ void (*free)(void *this_arg);
+} LDKKeysInterface;
/**
- * Represents an syntactically correct Invoice for a payment on the lightning network,
- * but without the signature information.
- * De- and encoding should not lead to information loss but may lead to different hashes.
+ * A trait which should be implemented to provide feerate information on a number of time
+ * horizons.
*
- * For methods without docs see the corresponding methods in `Invoice`.
+ * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
+ * called from inside the library in response to chain events, P2P events, or timer events).
*/
-typedef struct MUST_USE_STRUCT LDKRawInvoice {
+typedef struct LDKFeeEstimator {
/**
- * A pointer to the opaque Rust object.
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ * An opaque pointer which is passed to your function implementations as an argument.
+ * This has no meaning in the LDK, and can be NULL or any other value.
*/
- LDKnativeRawInvoice *inner;
+ void *this_arg;
/**
- * Indicates that this is the only struct which contains the same pointer.
- * Rust functions which take ownership of an object provided via an argument require
- * this to be true and invalidate the object pointed to by inner.
+ * Gets estimated satoshis of fee required per 1000 Weight-Units.
+ *
+ * Must return a value no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later
+ * round-downs don't put us below 1 satoshi-per-byte).
+ *
+ * This method can be implemented with the following unit conversions:
+ * * max(satoshis-per-byte * 250, 253)
+ * * max(satoshis-per-kbyte / 4, 253)
*/
- bool is_owned;
-} LDKRawInvoice;
+ uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, enum LDKConfirmationTarget confirmation_target);
+ /**
+ * Frees any resources associated with this object given its this_arg pointer.
+ * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ */
+ void (*free)(void *this_arg);
+} LDKFeeEstimator;
/**
- * Recoverable signature
+ * Manager which keeps track of a number of channels and sends messages to the appropriate
+ * channel, also tracking HTLC preimages and forwarding onion packets appropriately.
+ *
+ * Implements ChannelMessageHandler, handling the multi-channel parts and passing things through
+ * to individual Channels.
+ *
+ * Implements Writeable to write out all channel state to disk. Implies peer_disconnected() for
+ * all peers during write/read (though does not modify this instance, only the instance being
+ * serialized). This will result in any channels which have not yet exchanged funding_created (ie
+ * called funding_transaction_generated for outbound channels).
+ *
+ * Note that you can be a bit lazier about writing out ChannelManager than you can be with
+ * ChannelMonitors. With ChannelMonitors you MUST write each monitor update out to disk before
+ * returning from chain::Watch::watch_/update_channel, with ChannelManagers, writing updates
+ * happens out-of-band (and will prevent any other ChannelManager operations from occurring during
+ * the serialization process). If the deserialized version is out-of-date compared to the
+ * ChannelMonitors passed by reference to read(), those channels will be force-closed based on the
+ * ChannelMonitor state and no funds will be lost (mod on-chain transaction fees).
+ *
+ * Note that the deserializer is only implemented for (BlockHash, ChannelManager), which
+ * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
+ * the \"reorg path\" (ie call block_disconnected() until you get to a common block and then call
+ * block_connected() to step towards your best block) upon deserialization before using the
+ * object!
+ *
+ * Note that ChannelManager is responsible for tracking liveness of its channels and generating
+ * ChannelUpdate messages informing peers that the channel is temporarily disabled. To avoid
+ * spam due to quick disconnection/reconnection, updates are not sent until the channel has been
+ * offline for a full minute. In order to track this, you must call
+ * timer_tick_occurred roughly once per minute, though it doesn't have to be perfect.
+ *
+ * Rather than using a plain ChannelManager, it is preferable to use either a SimpleArcChannelManager
+ * a SimpleRefChannelManager, for conciseness. See their documentation for more details, but
+ * essentially you should default to using a SimpleRefChannelManager, and use a
+ * SimpleArcChannelManager when you require a ChannelManager with a static lifetime, such as when
+ * you're using lightning-net-tokio.
*/
-typedef struct MUST_USE_STRUCT LDKInvoiceSignature {
+typedef struct MUST_USE_STRUCT LDKChannelManager {
/**
* A pointer to the opaque Rust object.
* Nearly everywhere, inner must be non-null, however in places where
* the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- LDKnativeInvoiceSignature *inner;
+ LDKnativeChannelManager *inner;
/**
* Indicates that this is the only struct which contains the same pointer.
* Rust functions which take ownership of an object provided via an argument require
* this to be true and invalidate the object pointed to by inner.
*/
bool is_owned;
-} LDKInvoiceSignature;
+} LDKChannelManager;
/**
- * A tuple of 3 elements. See the individual fields for the types contained.
+ * A tuple of 2 elements. See the individual fields for the types contained.
*/
-typedef struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ {
+typedef struct LDKC2Tuple_BlockHashChannelManagerZ {
/**
* The element at position 0
*/
- struct LDKRawInvoice a;
+ struct LDKThirtyTwoBytes a;
/**
* The element at position 1
*/
- struct LDKThirtyTwoBytes b;
- /**
- * The element at position 2
- */
- struct LDKInvoiceSignature c;
-} LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ;
-
-
-
-/**
- * Payee public key
- */
-typedef struct MUST_USE_STRUCT LDKPayeePubKey {
- /**
- * A pointer to the opaque Rust object.
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
- */
- LDKnativePayeePubKey *inner;
- /**
- * Indicates that this is the only struct which contains the same pointer.
- * Rust functions which take ownership of an object provided via an argument require
- * this to be true and invalidate the object pointed to by inner.
- */
- bool is_owned;
-} LDKPayeePubKey;
+ struct LDKChannelManager b;
+} LDKC2Tuple_BlockHashChannelManagerZ;
/**
- * The contents of CResult_PayeePubKeyErrorZ
+ * The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
*/
-typedef union LDKCResult_PayeePubKeyErrorZPtr {
+typedef union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKPayeePubKey *result;
+ struct LDKC2Tuple_BlockHashChannelManagerZ *result;
/**
* A pointer to the contents in the error state.
* Reading from this pointer when `result_ok` is set is undefined.
*/
- enum LDKSecp256k1Error *err;
-} LDKCResult_PayeePubKeyErrorZPtr;
+ struct LDKDecodeError *err;
+} LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr;
/**
- * A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
- * containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
+ * A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_PayeePubKeyErrorZ {
+typedef struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
/**
- * The contents of this CResult_PayeePubKeyErrorZ, accessible via either
+ * The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_PayeePubKeyErrorZPtr contents;
+ union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr contents;
/**
- * Whether this CResult_PayeePubKeyErrorZ represents a success state.
+ * Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_PayeePubKeyErrorZ;
-
-
-
-/**
- * Private routing information
- *
- * # Invariants
- * The encoded route has to be <1024 5bit characters long (<=639 bytes or <=12 hops)
- *
- */
-typedef struct MUST_USE_STRUCT LDKPrivateRoute {
- /**
- * 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.
- */
- LDKnativePrivateRoute *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;
-} LDKPrivateRoute;
-
-/**
- * A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
- * This corresponds to std::vector in C++
- */
-typedef struct LDKCVec_PrivateRouteZ {
- /**
- * The elements in the array.
- * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
- */
- struct LDKPrivateRoute *data;
- /**
- * The number of elements pointed to by `data`.
- */
- uintptr_t datalen;
-} LDKCVec_PrivateRouteZ;
+} LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ;
/**
- * A timestamp that refers to a date after 1 January 1970.
- *
- * # Invariants
- *
- * The Unix timestamp representing the stored time has to be positive and no greater than
- * [`MAX_TIMESTAMP`].
+ * Options which apply on a per-channel basis and may change at runtime or based on negotiation
+ * with our counterparty.
*/
-typedef struct MUST_USE_STRUCT LDKPositiveTimestamp {
+typedef struct MUST_USE_STRUCT LDKChannelConfig {
/**
* A pointer to the opaque Rust object.
* Nearly everywhere, inner must be non-null, however in places where
* the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- LDKnativePositiveTimestamp *inner;
+ LDKnativeChannelConfig *inner;
/**
* Indicates that this is the only struct which contains the same pointer.
* Rust functions which take ownership of an object provided via an argument require
* this to be true and invalidate the object pointed to by inner.
*/
bool is_owned;
-} LDKPositiveTimestamp;
+} LDKChannelConfig;
/**
- * The contents of CResult_PositiveTimestampCreationErrorZ
+ * The contents of CResult_ChannelConfigDecodeErrorZ
*/
-typedef union LDKCResult_PositiveTimestampCreationErrorZPtr {
+typedef union LDKCResult_ChannelConfigDecodeErrorZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKPositiveTimestamp *result;
- /**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
- */
- enum LDKCreationError *err;
-} LDKCResult_PositiveTimestampCreationErrorZPtr;
-
-/**
- * A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
- * containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
- * `result_ok` indicates the overall state, and the contents are provided via `contents`.
- */
-typedef struct LDKCResult_PositiveTimestampCreationErrorZ {
- /**
- * The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
- */
- union LDKCResult_PositiveTimestampCreationErrorZPtr contents;
- /**
- * Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
- */
- bool result_ok;
-} LDKCResult_PositiveTimestampCreationErrorZ;
-
-/**
- * The contents of CResult_NoneSemanticErrorZ
- */
-typedef union LDKCResult_NoneSemanticErrorZPtr {
- /**
- * Note that this value is always NULL, as there are no contents in the OK variant
- */
- void *result;
+ struct LDKChannelConfig *result;
/**
* A pointer to the contents in the error state.
* Reading from this pointer when `result_ok` is set is undefined.
*/
- enum LDKSemanticError *err;
-} LDKCResult_NoneSemanticErrorZPtr;
+ struct LDKDecodeError *err;
+} LDKCResult_ChannelConfigDecodeErrorZPtr;
/**
- * A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
- * containing a () on success and a crate::lightning_invoice::SemanticError on failure.
+ * A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_NoneSemanticErrorZ {
+typedef struct LDKCResult_ChannelConfigDecodeErrorZ {
/**
- * The contents of this CResult_NoneSemanticErrorZ, accessible via either
+ * The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_NoneSemanticErrorZPtr contents;
+ union LDKCResult_ChannelConfigDecodeErrorZPtr contents;
/**
- * Whether this CResult_NoneSemanticErrorZ represents a success state.
+ * Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_NoneSemanticErrorZ;
+} LDKCResult_ChannelConfigDecodeErrorZ;
/**
- * The contents of CResult_InvoiceSemanticErrorZ
+ * The contents of CResult_OutPointDecodeErrorZ
*/
-typedef union LDKCResult_InvoiceSemanticErrorZPtr {
+typedef union LDKCResult_OutPointDecodeErrorZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKInvoice *result;
+ struct LDKOutPoint *result;
/**
* A pointer to the contents in the error state.
* Reading from this pointer when `result_ok` is set is undefined.
*/
- enum LDKSemanticError *err;
-} LDKCResult_InvoiceSemanticErrorZPtr;
+ struct LDKDecodeError *err;
+} LDKCResult_OutPointDecodeErrorZPtr;
/**
- * A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
- * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
+ * A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_InvoiceSemanticErrorZ {
+typedef struct LDKCResult_OutPointDecodeErrorZ {
/**
- * The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
+ * The contents of this CResult_OutPointDecodeErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_InvoiceSemanticErrorZPtr contents;
+ union LDKCResult_OutPointDecodeErrorZPtr contents;
/**
- * Whether this CResult_InvoiceSemanticErrorZ represents a success state.
+ * Whether this CResult_OutPointDecodeErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_InvoiceSemanticErrorZ;
-
-
+} LDKCResult_OutPointDecodeErrorZ;
/**
- * Description string
+ * Defines a type identifier for sending messages over the wire.
*
- * # Invariants
- * The description can be at most 639 __bytes__ long
+ * Messages implementing this trait specify a type and must be [`Writeable`].
*/
-typedef struct MUST_USE_STRUCT LDKDescription {
+typedef struct LDKType {
/**
- * A pointer to the opaque Rust object.
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ * An opaque pointer which is passed to your function implementations as an argument.
+ * This has no meaning in the LDK, and can be NULL or any other value.
*/
- LDKnativeDescription *inner;
+ void *this_arg;
/**
- * Indicates that this is the only struct which contains the same pointer.
- * Rust functions which take ownership of an object provided via an argument require
- * this to be true and invalidate the object pointed to by inner.
+ * Returns the type identifying the message payload.
*/
- bool is_owned;
-} LDKDescription;
+ uint16_t (*type_id)(const void *this_arg);
+ /**
+ * Return a human-readable "debug" string describing this object
+ */
+ struct LDKStr (*debug_str)(const void *this_arg);
+ /**
+ * Serialize the object into a byte array
+ */
+ struct LDKCVec_u8Z (*write)(const void *this_arg);
+ /**
+ * Frees any resources associated with this object given its this_arg pointer.
+ * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ */
+ void (*free)(void *this_arg);
+} LDKType;
/**
- * The contents of CResult_DescriptionCreationErrorZ
+ * An enum which can either contain a crate::lightning::ln::wire::Type or not
*/
-typedef union LDKCResult_DescriptionCreationErrorZPtr {
+typedef enum LDKCOption_TypeZ_Tag {
+ /**
+ * When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
+ */
+ LDKCOption_TypeZ_Some,
+ /**
+ * When we're in this state, this COption_TypeZ contains nothing
+ */
+ LDKCOption_TypeZ_None,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKCOption_TypeZ_Sentinel,
+} LDKCOption_TypeZ_Tag;
+
+typedef struct LDKCOption_TypeZ {
+ LDKCOption_TypeZ_Tag tag;
+ union {
+ struct {
+ struct LDKType some;
+ };
+ };
+} LDKCOption_TypeZ;
+
+/**
+ * The contents of CResult_COption_TypeZDecodeErrorZ
+ */
+typedef union LDKCResult_COption_TypeZDecodeErrorZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKDescription *result;
+ struct LDKCOption_TypeZ *result;
/**
* A pointer to the contents in the error state.
* Reading from this pointer when `result_ok` is set is undefined.
*/
- enum LDKCreationError *err;
-} LDKCResult_DescriptionCreationErrorZPtr;
+ struct LDKDecodeError *err;
+} LDKCResult_COption_TypeZDecodeErrorZPtr;
/**
- * A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
- * containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
+ * A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_DescriptionCreationErrorZ {
+typedef struct LDKCResult_COption_TypeZDecodeErrorZ {
/**
- * The contents of this CResult_DescriptionCreationErrorZ, accessible via either
+ * The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_DescriptionCreationErrorZPtr contents;
+ union LDKCResult_COption_TypeZDecodeErrorZPtr contents;
/**
- * Whether this CResult_DescriptionCreationErrorZ represents a success state.
+ * Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_DescriptionCreationErrorZ;
+} LDKCResult_COption_TypeZDecodeErrorZ;
/**
- * The contents of CResult_PrivateRouteCreationErrorZ
+ * An error that may occur when making a payment.
*/
-typedef union LDKCResult_PrivateRouteCreationErrorZPtr {
+typedef enum LDKPaymentError_Tag {
+ /**
+ * An error resulting from the provided [`Invoice`] or payment hash.
+ */
+ LDKPaymentError_Invoice,
+ /**
+ * An error occurring when finding a route.
+ */
+ LDKPaymentError_Routing,
+ /**
+ * An error occurring when sending a payment.
+ */
+ LDKPaymentError_Sending,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKPaymentError_Sentinel,
+} LDKPaymentError_Tag;
+
+typedef struct MUST_USE_STRUCT LDKPaymentError {
+ LDKPaymentError_Tag tag;
+ union {
+ struct {
+ struct LDKStr invoice;
+ };
+ struct {
+ struct LDKLightningError routing;
+ };
+ struct {
+ struct LDKPaymentSendFailure sending;
+ };
+ };
+} LDKPaymentError;
+
+/**
+ * The contents of CResult_PaymentIdPaymentErrorZ
+ */
+typedef union LDKCResult_PaymentIdPaymentErrorZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKPrivateRoute *result;
+ struct LDKThirtyTwoBytes *result;
/**
* A pointer to the contents in the error state.
* Reading from this pointer when `result_ok` is set is undefined.
*/
- enum LDKCreationError *err;
-} LDKCResult_PrivateRouteCreationErrorZPtr;
+ struct LDKPaymentError *err;
+} LDKCResult_PaymentIdPaymentErrorZPtr;
/**
- * A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
- * containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
+ * A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
+ * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_PrivateRouteCreationErrorZ {
+typedef struct LDKCResult_PaymentIdPaymentErrorZ {
/**
- * The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
+ * The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_PrivateRouteCreationErrorZPtr contents;
+ union LDKCResult_PaymentIdPaymentErrorZPtr contents;
/**
- * Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
+ * Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_PrivateRouteCreationErrorZ;
+} LDKCResult_PaymentIdPaymentErrorZ;
/**
- * The contents of CResult_StringErrorZ
+ * Sub-errors which don't have specific information in them use this type.
*/
-typedef union LDKCResult_StringErrorZPtr {
- /**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
- */
- struct LDKStr *result;
+typedef struct LDKError {
/**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
+ * Zero-Sized_types aren't consistent across Rust/C/C++, so we add some size here
*/
- enum LDKSecp256k1Error *err;
-} LDKCResult_StringErrorZPtr;
+ uint8_t _dummy;
+} LDKError;
/**
- * A CResult_StringErrorZ represents the result of a fallible operation,
- * containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
- * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ * Errors that indicate what is wrong with the invoice. They have some granularity for debug
+ * reasons, but should generally result in an \"invalid BOLT11 invoice\" message for the user.
*/
-typedef struct LDKCResult_StringErrorZ {
+typedef enum LDKParseError_Tag {
+ LDKParseError_Bech32Error,
+ LDKParseError_ParseAmountError,
+ LDKParseError_MalformedSignature,
+ LDKParseError_BadPrefix,
+ LDKParseError_UnknownCurrency,
+ LDKParseError_UnknownSiPrefix,
+ LDKParseError_MalformedHRP,
+ LDKParseError_TooShortDataPart,
+ LDKParseError_UnexpectedEndOfTaggedFields,
+ LDKParseError_DescriptionDecodeError,
+ LDKParseError_PaddingError,
+ LDKParseError_IntegerOverflowError,
+ LDKParseError_InvalidSegWitProgramLength,
+ LDKParseError_InvalidPubKeyHashLength,
+ LDKParseError_InvalidScriptHashLength,
+ LDKParseError_InvalidRecoveryId,
+ LDKParseError_InvalidSliceLength,
/**
- * The contents of this CResult_StringErrorZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
+ * Not an error, but used internally to signal that a part of the invoice should be ignored
+ * according to BOLT11
*/
- union LDKCResult_StringErrorZPtr contents;
+ LDKParseError_Skip,
/**
- * Whether this CResult_StringErrorZ represents a success state.
+ * Must be last for serialization purposes
*/
- bool result_ok;
-} LDKCResult_StringErrorZ;
+ LDKParseError_Sentinel,
+} LDKParseError_Tag;
+
+typedef struct MUST_USE_STRUCT LDKParseError {
+ LDKParseError_Tag tag;
+ union {
+ struct {
+ struct LDKBech32Error bech32_error;
+ };
+ struct {
+ struct LDKError parse_amount_error;
+ };
+ struct {
+ enum LDKSecp256k1Error malformed_signature;
+ };
+ struct {
+ struct LDKError description_decode_error;
+ };
+ struct {
+ struct LDKStr invalid_slice_length;
+ };
+ };
+} LDKParseError;
/**
- * The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
+ * The contents of CResult_SiPrefixParseErrorZ
*/
-typedef union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr {
+typedef union LDKCResult_SiPrefixParseErrorZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKChannelMonitorUpdate *result;
+ enum LDKSiPrefix *result;
/**
* A pointer to the contents in the error state.
* Reading from this pointer when `result_ok` is set is undefined.
*/
- struct LDKDecodeError *err;
-} LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr;
+ struct LDKParseError *err;
+} LDKCResult_SiPrefixParseErrorZPtr;
/**
- * A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * A CResult_SiPrefixParseErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::ParseError on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ {
+typedef struct LDKCResult_SiPrefixParseErrorZ {
/**
- * The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
+ * The contents of this CResult_SiPrefixParseErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr contents;
+ union LDKCResult_SiPrefixParseErrorZPtr contents;
/**
- * Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
+ * Whether this CResult_SiPrefixParseErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_ChannelMonitorUpdateDecodeErrorZ;
+} LDKCResult_SiPrefixParseErrorZ;
+
+
/**
- * An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
+ * Represents a syntactically and semantically correct lightning BOLT11 invoice.
+ *
+ * There are three ways to construct an `Invoice`:
+ * 1. using `InvoiceBuilder`
+ * 2. using `Invoice::from_signed(SignedRawInvoice)`
+ * 3. using `str::parse::<Invoice>(&str)`
*/
-typedef enum LDKCOption_MonitorEventZ_Tag {
+typedef struct MUST_USE_STRUCT LDKInvoice {
/**
- * When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
+ * 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.
*/
- LDKCOption_MonitorEventZ_Some,
+ LDKnativeInvoice *inner;
/**
- * When we're in this state, this COption_MonitorEventZ contains nothing
+ * 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.
*/
- LDKCOption_MonitorEventZ_None,
+ bool is_owned;
+} LDKInvoice;
+
+/**
+ * Indicates that something went wrong while parsing or validating the invoice. Parsing errors
+ * should be mostly seen as opaque and are only there for debugging reasons. Semantic errors
+ * like wrong signatures, missing fields etc. could mean that someone tampered with the invoice.
+ */
+typedef enum LDKParseOrSemanticError_Tag {
+ /**
+ * The invoice couldn't be decoded
+ */
+ LDKParseOrSemanticError_ParseError,
+ /**
+ * The invoice could be decoded but violates the BOLT11 standard
+ */
+ LDKParseOrSemanticError_SemanticError,
/**
* Must be last for serialization purposes
*/
- LDKCOption_MonitorEventZ_Sentinel,
-} LDKCOption_MonitorEventZ_Tag;
+ LDKParseOrSemanticError_Sentinel,
+} LDKParseOrSemanticError_Tag;
-typedef struct LDKCOption_MonitorEventZ {
- LDKCOption_MonitorEventZ_Tag tag;
+typedef struct MUST_USE_STRUCT LDKParseOrSemanticError {
+ LDKParseOrSemanticError_Tag tag;
union {
struct {
- struct LDKMonitorEvent some;
+ struct LDKParseError parse_error;
+ };
+ struct {
+ enum LDKSemanticError semantic_error;
};
};
-} LDKCOption_MonitorEventZ;
+} LDKParseOrSemanticError;
/**
- * The contents of CResult_COption_MonitorEventZDecodeErrorZ
+ * The contents of CResult_InvoiceParseOrSemanticErrorZ
*/
-typedef union LDKCResult_COption_MonitorEventZDecodeErrorZPtr {
+typedef union LDKCResult_InvoiceParseOrSemanticErrorZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKCOption_MonitorEventZ *result;
+ struct LDKInvoice *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_MonitorEventZDecodeErrorZPtr;
+ struct LDKParseOrSemanticError *err;
+} LDKCResult_InvoiceParseOrSemanticErrorZPtr;
/**
- * A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * A CResult_InvoiceParseOrSemanticErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::ParseOrSemanticError on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_COption_MonitorEventZDecodeErrorZ {
+typedef struct LDKCResult_InvoiceParseOrSemanticErrorZ {
/**
- * The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
+ * The contents of this CResult_InvoiceParseOrSemanticErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_COption_MonitorEventZDecodeErrorZPtr contents;
+ union LDKCResult_InvoiceParseOrSemanticErrorZPtr contents;
/**
- * Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
+ * Whether this CResult_InvoiceParseOrSemanticErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_COption_MonitorEventZDecodeErrorZ;
+} LDKCResult_InvoiceParseOrSemanticErrorZ;
+
+
/**
- * The contents of CResult_HTLCUpdateDecodeErrorZ
+ * Represents a signed `RawInvoice` with cached hash. The signature is not checked and may be
+ * invalid.
+ *
+ * # Invariants
+ * The hash has to be either from the deserialized invoice or from the serialized `raw_invoice`.
*/
-typedef union LDKCResult_HTLCUpdateDecodeErrorZPtr {
+typedef struct MUST_USE_STRUCT LDKSignedRawInvoice {
+ /**
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeSignedRawInvoice *inner;
+ /**
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
+ */
+ bool is_owned;
+} LDKSignedRawInvoice;
+
+/**
+ * The contents of CResult_SignedRawInvoiceParseErrorZ
+ */
+typedef union LDKCResult_SignedRawInvoiceParseErrorZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKHTLCUpdate *result;
+ struct LDKSignedRawInvoice *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_HTLCUpdateDecodeErrorZPtr;
+ struct LDKParseError *err;
+} LDKCResult_SignedRawInvoiceParseErrorZPtr;
/**
- * A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * A CResult_SignedRawInvoiceParseErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning_invoice::SignedRawInvoice on success and a crate::lightning_invoice::ParseError on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_HTLCUpdateDecodeErrorZ {
+typedef struct LDKCResult_SignedRawInvoiceParseErrorZ {
/**
- * The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
+ * The contents of this CResult_SignedRawInvoiceParseErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_HTLCUpdateDecodeErrorZPtr contents;
+ union LDKCResult_SignedRawInvoiceParseErrorZPtr contents;
/**
- * Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
+ * Whether this CResult_SignedRawInvoiceParseErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_HTLCUpdateDecodeErrorZ;
+} LDKCResult_SignedRawInvoiceParseErrorZ;
+
-/**
- * A tuple of 2 elements. See the individual fields for the types contained.
- */
-typedef struct LDKC2Tuple_OutPointScriptZ {
- /**
- * The element at position 0
- */
- struct LDKOutPoint a;
- /**
- * The element at position 1
- */
- struct LDKCVec_u8Z b;
-} LDKC2Tuple_OutPointScriptZ;
/**
- * A tuple of 2 elements. See the individual fields for the types contained.
+ * Represents an syntactically correct Invoice for a payment on the lightning network,
+ * but without the signature information.
+ * De- and encoding should not lead to information loss but may lead to different hashes.
+ *
+ * For methods without docs see the corresponding methods in `Invoice`.
*/
-typedef struct LDKC2Tuple_u32ScriptZ {
+typedef struct MUST_USE_STRUCT LDKRawInvoice {
/**
- * The element at position 0
+ * 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.
*/
- uint32_t a;
+ LDKnativeRawInvoice *inner;
/**
- * The element at position 1
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
*/
- struct LDKCVec_u8Z b;
-} LDKC2Tuple_u32ScriptZ;
+ bool is_owned;
+} LDKRawInvoice;
+
+
/**
- * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
- * This corresponds to std::vector in C++
+ * Recoverable signature
*/
-typedef struct LDKCVec_C2Tuple_u32ScriptZZ {
+typedef struct MUST_USE_STRUCT LDKInvoiceSignature {
/**
- * The elements in the array.
- * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- struct LDKC2Tuple_u32ScriptZ *data;
+ LDKnativeInvoiceSignature *inner;
/**
- * The number of elements pointed to by `data`.
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
*/
- uintptr_t datalen;
-} LDKCVec_C2Tuple_u32ScriptZZ;
+ bool is_owned;
+} LDKInvoiceSignature;
/**
- * A tuple of 2 elements. See the individual fields for the types contained.
+ * A tuple of 3 elements. See the individual fields for the types contained.
*/
-typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
+typedef struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ {
/**
* The element at position 0
*/
- struct LDKThirtyTwoBytes a;
+ struct LDKRawInvoice a;
/**
* The element at position 1
*/
- struct LDKCVec_C2Tuple_u32ScriptZZ b;
-} LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ;
+ struct LDKThirtyTwoBytes b;
+ /**
+ * The element at position 2
+ */
+ struct LDKInvoiceSignature c;
+} LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ;
+
+
/**
- * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
- * This corresponds to std::vector in C++
+ * Payee public key
*/
-typedef struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
+typedef struct MUST_USE_STRUCT LDKPayeePubKey {
/**
- * The elements in the array.
- * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *data;
+ LDKnativePayeePubKey *inner;
/**
- * The number of elements pointed to by `data`.
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
*/
- uintptr_t datalen;
-} LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ;
+ bool is_owned;
+} LDKPayeePubKey;
/**
- * A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
- * This corresponds to std::vector in C++
+ * The contents of CResult_PayeePubKeyErrorZ
*/
-typedef struct LDKCVec_EventZ {
+typedef union LDKCResult_PayeePubKeyErrorZPtr {
/**
- * The elements in the array.
- * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKEvent *data;
+ struct LDKPayeePubKey *result;
/**
- * The number of elements pointed to by `data`.
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
*/
- uintptr_t datalen;
-} LDKCVec_EventZ;
+ enum LDKSecp256k1Error *err;
+} LDKCResult_PayeePubKeyErrorZPtr;
/**
- * A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
- * This corresponds to std::vector in C++
+ * A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCVec_TransactionZ {
+typedef struct LDKCResult_PayeePubKeyErrorZ {
/**
- * The elements in the array.
- * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ * The contents of this CResult_PayeePubKeyErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
*/
- struct LDKTransaction *data;
+ union LDKCResult_PayeePubKeyErrorZPtr contents;
/**
- * The number of elements pointed to by `data`.
+ * Whether this CResult_PayeePubKeyErrorZ represents a success state.
*/
- uintptr_t datalen;
-} LDKCVec_TransactionZ;
+ bool result_ok;
+} LDKCResult_PayeePubKeyErrorZ;
+
+
/**
- * A tuple of 2 elements. See the individual fields for the types contained.
+ * Private routing information
+ *
+ * # Invariants
+ * The encoded route has to be <1024 5bit characters long (<=639 bytes or <=12 hops)
+ *
*/
-typedef struct LDKC2Tuple_u32TxOutZ {
+typedef struct MUST_USE_STRUCT LDKPrivateRoute {
/**
- * The element at position 0
+ * 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.
*/
- uint32_t a;
+ LDKnativePrivateRoute *inner;
/**
- * The element at position 1
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
*/
- struct LDKTxOut b;
-} LDKC2Tuple_u32TxOutZ;
+ bool is_owned;
+} LDKPrivateRoute;
/**
- * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
+ * A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
* This corresponds to std::vector in C++
*/
-typedef struct LDKCVec_C2Tuple_u32TxOutZZ {
+typedef struct LDKCVec_PrivateRouteZ {
/**
* The elements in the array.
* If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
*/
- struct LDKC2Tuple_u32TxOutZ *data;
+ struct LDKPrivateRoute *data;
/**
* The number of elements pointed to by `data`.
*/
uintptr_t datalen;
-} LDKCVec_C2Tuple_u32TxOutZZ;
+} LDKCVec_PrivateRouteZ;
+
+
/**
- * A tuple of 2 elements. See the individual fields for the types contained.
+ * A timestamp that refers to a date after 1 January 1970.
+ *
+ * # Invariants
+ *
+ * The Unix timestamp representing the stored time has to be positive and no greater than
+ * [`MAX_TIMESTAMP`].
*/
-typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
+typedef struct MUST_USE_STRUCT LDKPositiveTimestamp {
/**
- * The element at position 0
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- struct LDKThirtyTwoBytes a;
+ LDKnativePositiveTimestamp *inner;
/**
- * The element at position 1
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
*/
- struct LDKCVec_C2Tuple_u32TxOutZZ b;
-} LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ;
+ bool is_owned;
+} LDKPositiveTimestamp;
/**
- * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
- * This corresponds to std::vector in C++
+ * The contents of CResult_PositiveTimestampCreationErrorZ
*/
-typedef struct LDKCVec_TransactionOutputsZ {
+typedef union LDKCResult_PositiveTimestampCreationErrorZPtr {
/**
- * The elements in the array.
- * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *data;
+ struct LDKPositiveTimestamp *result;
/**
- * The number of elements pointed to by `data`.
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
*/
- uintptr_t datalen;
-} LDKCVec_TransactionOutputsZ;
+ enum LDKCreationError *err;
+} LDKCResult_PositiveTimestampCreationErrorZPtr;
/**
- * Details about the balance(s) available for spending once the channel appears on chain.
- *
- * See [`ChannelMonitor::get_claimable_balances`] for more details on when these will or will not
- * be provided.
+ * A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef enum LDKBalance_Tag {
- /**
- * The channel is not yet closed (or the commitment or closing transaction has not yet
- * appeared in a block). The given balance is claimable (less on-chain fees) if the channel is
- * force-closed now.
- */
- LDKBalance_ClaimableOnChannelClose,
- /**
- * The channel has been closed, and the given balance is ours but awaiting confirmations until
- * we consider it spendable.
- */
- LDKBalance_ClaimableAwaitingConfirmations,
+typedef struct LDKCResult_PositiveTimestampCreationErrorZ {
/**
- * The channel has been closed, and the given balance should be ours but awaiting spending
- * transaction confirmation. If the spending transaction does not confirm in time, it is
- * possible our counterparty can take the funds by broadcasting an HTLC timeout on-chain.
- *
- * Once the spending transaction confirms, before it has reached enough confirmations to be
- * considered safe from chain reorganizations, the balance will instead be provided via
- * [`Balance::ClaimableAwaitingConfirmations`].
+ * The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
*/
- LDKBalance_ContentiousClaimable,
+ union LDKCResult_PositiveTimestampCreationErrorZPtr contents;
/**
- * HTLCs which we sent to our counterparty which are claimable after a timeout (less on-chain
- * fees) if the counterparty does not know the preimage for the HTLCs. These are somewhat
- * likely to be claimed by our counterparty before we do.
+ * Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
*/
- LDKBalance_MaybeClaimableHTLCAwaitingTimeout,
+ bool result_ok;
+} LDKCResult_PositiveTimestampCreationErrorZ;
+
+/**
+ * The contents of CResult_NoneSemanticErrorZ
+ */
+typedef union LDKCResult_NoneSemanticErrorZPtr {
/**
- * Must be last for serialization purposes
+ * Note that this value is always NULL, as there are no contents in the OK variant
*/
- LDKBalance_Sentinel,
-} LDKBalance_Tag;
-
-typedef struct LDKBalance_LDKClaimableOnChannelClose_Body {
+ void *result;
/**
- * The amount available to claim, in satoshis, excluding the on-chain fees which will be
- * required to do so.
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
*/
- uint64_t claimable_amount_satoshis;
-} LDKBalance_LDKClaimableOnChannelClose_Body;
+ enum LDKSemanticError *err;
+} LDKCResult_NoneSemanticErrorZPtr;
-typedef struct LDKBalance_LDKClaimableAwaitingConfirmations_Body {
+/**
+ * A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
+ * containing a () on success and a crate::lightning_invoice::SemanticError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_NoneSemanticErrorZ {
/**
- * The amount available to claim, in satoshis, possibly excluding the on-chain fees which
- * were spent in broadcasting the transaction.
+ * The contents of this CResult_NoneSemanticErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
*/
- uint64_t claimable_amount_satoshis;
+ union LDKCResult_NoneSemanticErrorZPtr contents;
/**
- * The height at which an [`Event::SpendableOutputs`] event will be generated for this
- * amount.
+ * Whether this CResult_NoneSemanticErrorZ represents a success state.
*/
- uint32_t confirmation_height;
-} LDKBalance_LDKClaimableAwaitingConfirmations_Body;
+ bool result_ok;
+} LDKCResult_NoneSemanticErrorZ;
-typedef struct LDKBalance_LDKContentiousClaimable_Body {
+/**
+ * The contents of CResult_InvoiceSemanticErrorZ
+ */
+typedef union LDKCResult_InvoiceSemanticErrorZPtr {
/**
- * The amount available to claim, in satoshis, excluding the on-chain fees which will be
- * required to do so.
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
*/
- uint64_t claimable_amount_satoshis;
+ struct LDKInvoice *result;
/**
- * The height at which the counterparty may be able to claim the balance if we have not
- * done so.
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
*/
- uint32_t timeout_height;
-} LDKBalance_LDKContentiousClaimable_Body;
+ enum LDKSemanticError *err;
+} LDKCResult_InvoiceSemanticErrorZPtr;
-typedef struct LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_Body {
+/**
+ * A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_InvoiceSemanticErrorZ {
/**
- * The amount available to claim, in satoshis, excluding the on-chain fees which will be
- * required to do so.
+ * The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
*/
- uint64_t claimable_amount_satoshis;
+ union LDKCResult_InvoiceSemanticErrorZPtr contents;
/**
- * The height at which we will be able to claim the balance if our counterparty has not
- * done so.
+ * Whether this CResult_InvoiceSemanticErrorZ represents a success state.
*/
- uint32_t claimable_height;
-} LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_Body;
+ bool result_ok;
+} LDKCResult_InvoiceSemanticErrorZ;
+
-typedef struct MUST_USE_STRUCT LDKBalance {
- LDKBalance_Tag tag;
- union {
- LDKBalance_LDKClaimableOnChannelClose_Body claimable_on_channel_close;
- LDKBalance_LDKClaimableAwaitingConfirmations_Body claimable_awaiting_confirmations;
- LDKBalance_LDKContentiousClaimable_Body contentious_claimable;
- LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_Body maybe_claimable_htlc_awaiting_timeout;
- };
-} LDKBalance;
/**
- * A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
- * This corresponds to std::vector in C++
+ * Description string
+ *
+ * # Invariants
+ * The description can be at most 639 __bytes__ long
*/
-typedef struct LDKCVec_BalanceZ {
+typedef struct MUST_USE_STRUCT LDKDescription {
/**
- * The elements in the array.
- * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- struct LDKBalance *data;
+ LDKnativeDescription *inner;
/**
- * The number of elements pointed to by `data`.
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
*/
- uintptr_t datalen;
-} LDKCVec_BalanceZ;
+ bool is_owned;
+} LDKDescription;
/**
- * The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
+ * The contents of CResult_DescriptionCreationErrorZ
*/
-typedef union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
+typedef union LDKCResult_DescriptionCreationErrorZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKC2Tuple_BlockHashChannelMonitorZ *result;
+ struct LDKDescription *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_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr;
+ enum LDKCreationError *err;
+} LDKCResult_DescriptionCreationErrorZPtr;
/**
- * A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
+typedef struct LDKCResult_DescriptionCreationErrorZ {
/**
- * The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
+ * The contents of this CResult_DescriptionCreationErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr contents;
+ union LDKCResult_DescriptionCreationErrorZPtr contents;
/**
- * Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
+ * Whether this CResult_DescriptionCreationErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ;
+} LDKCResult_DescriptionCreationErrorZ;
/**
- * The contents of CResult_NoneLightningErrorZ
+ * The contents of CResult_PrivateRouteCreationErrorZ
*/
-typedef union LDKCResult_NoneLightningErrorZPtr {
+typedef union LDKCResult_PrivateRouteCreationErrorZPtr {
/**
- * Note that this value is always NULL, as there are no contents in the OK variant
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
*/
- void *result;
+ struct LDKPrivateRoute *result;
/**
* A pointer to the contents in the error state.
* Reading from this pointer when `result_ok` is set is undefined.
*/
- struct LDKLightningError *err;
-} LDKCResult_NoneLightningErrorZPtr;
+ enum LDKCreationError *err;
+} LDKCResult_PrivateRouteCreationErrorZPtr;
/**
- * A CResult_NoneLightningErrorZ represents the result of a fallible operation,
- * containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
+ * A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_NoneLightningErrorZ {
+typedef struct LDKCResult_PrivateRouteCreationErrorZ {
/**
- * The contents of this CResult_NoneLightningErrorZ, accessible via either
+ * The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_NoneLightningErrorZPtr contents;
+ union LDKCResult_PrivateRouteCreationErrorZPtr contents;
/**
- * Whether this CResult_NoneLightningErrorZ represents a success state.
+ * Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_NoneLightningErrorZ;
+} LDKCResult_PrivateRouteCreationErrorZ;
/**
- * A tuple of 2 elements. See the individual fields for the types contained.
+ * The contents of CResult_StringErrorZ
*/
-typedef struct LDKC2Tuple_PublicKeyTypeZ {
+typedef union LDKCResult_StringErrorZPtr {
/**
- * The element at position 0
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKPublicKey a;
+ struct LDKStr *result;
/**
- * The element at position 1
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
*/
- struct LDKType b;
-} LDKC2Tuple_PublicKeyTypeZ;
+ enum LDKSecp256k1Error *err;
+} LDKCResult_StringErrorZPtr;
/**
- * A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
- * This corresponds to std::vector in C++
+ * A CResult_StringErrorZ represents the result of a fallible operation,
+ * containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCVec_C2Tuple_PublicKeyTypeZZ {
+typedef struct LDKCResult_StringErrorZ {
/**
- * The elements in the array.
- * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ * The contents of this CResult_StringErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
*/
- struct LDKC2Tuple_PublicKeyTypeZ *data;
+ union LDKCResult_StringErrorZPtr contents;
/**
- * The number of elements pointed to by `data`.
+ * Whether this CResult_StringErrorZ represents a success state.
*/
- uintptr_t datalen;
-} LDKCVec_C2Tuple_PublicKeyTypeZZ;
+ bool result_ok;
+} LDKCResult_StringErrorZ;
/**
- * The contents of CResult_boolLightningErrorZ
+ * The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
*/
-typedef union LDKCResult_boolLightningErrorZPtr {
+typedef union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- bool *result;
+ struct LDKChannelMonitorUpdate *result;
/**
* A pointer to the contents in the error state.
* Reading from this pointer when `result_ok` is set is undefined.
*/
- struct LDKLightningError *err;
-} LDKCResult_boolLightningErrorZPtr;
+ struct LDKDecodeError *err;
+} LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr;
/**
- * A CResult_boolLightningErrorZ represents the result of a fallible operation,
- * containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
+ * A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_boolLightningErrorZ {
+typedef struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ {
/**
- * The contents of this CResult_boolLightningErrorZ, accessible via either
+ * The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_boolLightningErrorZPtr contents;
+ union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr contents;
/**
- * Whether this CResult_boolLightningErrorZ represents a success state.
+ * Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_boolLightningErrorZ;
+} LDKCResult_ChannelMonitorUpdateDecodeErrorZ;
/**
- * A tuple of 3 elements. See the individual fields for the types contained.
+ * An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
*/
-typedef struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
+typedef enum LDKCOption_MonitorEventZ_Tag {
/**
- * The element at position 0
+ * When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
*/
- struct LDKChannelAnnouncement a;
+ LDKCOption_MonitorEventZ_Some,
/**
- * The element at position 1
+ * When we're in this state, this COption_MonitorEventZ contains nothing
*/
- struct LDKChannelUpdate b;
+ LDKCOption_MonitorEventZ_None,
/**
- * The element at position 2
+ * Must be last for serialization purposes
*/
- struct LDKChannelUpdate c;
-} LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ;
+ LDKCOption_MonitorEventZ_Sentinel,
+} LDKCOption_MonitorEventZ_Tag;
-/**
- * A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
- * This corresponds to std::vector in C++
- */
-typedef struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
- /**
- * The elements in the array.
- * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
- */
- struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *data;
- /**
- * The number of elements pointed to by `data`.
- */
- uintptr_t datalen;
-} LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ;
+typedef struct LDKCOption_MonitorEventZ {
+ LDKCOption_MonitorEventZ_Tag tag;
+ union {
+ struct {
+ struct LDKMonitorEvent some;
+ };
+ };
+} LDKCOption_MonitorEventZ;
/**
- * A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
- * This corresponds to std::vector in C++
+ * The contents of CResult_COption_MonitorEventZDecodeErrorZ
*/
-typedef struct LDKCVec_NodeAnnouncementZ {
+typedef union LDKCResult_COption_MonitorEventZDecodeErrorZPtr {
/**
- * The elements in the array.
- * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKNodeAnnouncement *data;
+ struct LDKCOption_MonitorEventZ *result;
/**
- * The number of elements pointed to by `data`.
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
*/
- uintptr_t datalen;
-} LDKCVec_NodeAnnouncementZ;
+ struct LDKDecodeError *err;
+} LDKCResult_COption_MonitorEventZDecodeErrorZPtr;
/**
- * A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
- * This corresponds to std::vector in C++
+ * A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCVec_PublicKeyZ {
+typedef struct LDKCResult_COption_MonitorEventZDecodeErrorZ {
/**
- * The elements in the array.
- * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ * The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
*/
- struct LDKPublicKey *data;
+ union LDKCResult_COption_MonitorEventZDecodeErrorZPtr contents;
/**
- * The number of elements pointed to by `data`.
+ * Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
*/
- uintptr_t datalen;
-} LDKCVec_PublicKeyZ;
+ bool result_ok;
+} LDKCResult_COption_MonitorEventZDecodeErrorZ;
/**
- * An enum which can either contain a crate::lightning::ln::msgs::NetAddress or not
+ * The contents of CResult_HTLCUpdateDecodeErrorZ
*/
-typedef enum LDKCOption_NetAddressZ_Tag {
- /**
- * When we're in this state, this COption_NetAddressZ contains a crate::lightning::ln::msgs::NetAddress
- */
- LDKCOption_NetAddressZ_Some,
+typedef union LDKCResult_HTLCUpdateDecodeErrorZPtr {
/**
- * When we're in this state, this COption_NetAddressZ contains nothing
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
*/
- LDKCOption_NetAddressZ_None,
+ struct LDKHTLCUpdate *result;
/**
- * Must be last for serialization purposes
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
*/
- LDKCOption_NetAddressZ_Sentinel,
-} LDKCOption_NetAddressZ_Tag;
-
-typedef struct LDKCOption_NetAddressZ {
- LDKCOption_NetAddressZ_Tag tag;
- union {
- struct {
- struct LDKNetAddress some;
- };
- };
-} LDKCOption_NetAddressZ;
-
-
+ struct LDKDecodeError *err;
+} LDKCResult_HTLCUpdateDecodeErrorZPtr;
/**
- * Error for PeerManager errors. If you get one of these, you must disconnect the socket and
- * generate no further read_event/write_buffer_space_avail/socket_disconnected calls for the
- * descriptor.
+ * A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct MUST_USE_STRUCT LDKPeerHandleError {
+typedef struct LDKCResult_HTLCUpdateDecodeErrorZ {
/**
- * A pointer to the opaque Rust object.
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ * The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
*/
- LDKnativePeerHandleError *inner;
+ union LDKCResult_HTLCUpdateDecodeErrorZPtr contents;
/**
- * Indicates that this is the only struct which contains the same pointer.
- * Rust functions which take ownership of an object provided via an argument require
- * this to be true and invalidate the object pointed to by inner.
+ * Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
*/
- bool is_owned;
-} LDKPeerHandleError;
+ bool result_ok;
+} LDKCResult_HTLCUpdateDecodeErrorZ;
/**
- * The contents of CResult_CVec_u8ZPeerHandleErrorZ
+ * A tuple of 2 elements. See the individual fields for the types contained.
*/
-typedef union LDKCResult_CVec_u8ZPeerHandleErrorZPtr {
+typedef struct LDKC2Tuple_OutPointScriptZ {
/**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
+ * The element at position 0
*/
- struct LDKCVec_u8Z *result;
+ struct LDKOutPoint a;
/**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
+ * The element at position 1
*/
- struct LDKPeerHandleError *err;
-} LDKCResult_CVec_u8ZPeerHandleErrorZPtr;
+ struct LDKCVec_u8Z b;
+} LDKC2Tuple_OutPointScriptZ;
/**
- * A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
- * containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
- * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ * A tuple of 2 elements. See the individual fields for the types contained.
*/
-typedef struct LDKCResult_CVec_u8ZPeerHandleErrorZ {
+typedef struct LDKC2Tuple_u32ScriptZ {
/**
- * The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
+ * The element at position 0
*/
- union LDKCResult_CVec_u8ZPeerHandleErrorZPtr contents;
+ uint32_t a;
/**
- * Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
+ * The element at position 1
*/
- bool result_ok;
-} LDKCResult_CVec_u8ZPeerHandleErrorZ;
+ struct LDKCVec_u8Z b;
+} LDKC2Tuple_u32ScriptZ;
/**
- * The contents of CResult_NonePeerHandleErrorZ
+ * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
+ * This corresponds to std::vector in C++
*/
-typedef union LDKCResult_NonePeerHandleErrorZPtr {
+typedef struct LDKCVec_C2Tuple_u32ScriptZZ {
/**
- * Note that this value is always NULL, as there are no contents in the OK variant
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
*/
- void *result;
+ struct LDKC2Tuple_u32ScriptZ *data;
/**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
+ * The number of elements pointed to by `data`.
*/
- struct LDKPeerHandleError *err;
-} LDKCResult_NonePeerHandleErrorZPtr;
+ uintptr_t datalen;
+} LDKCVec_C2Tuple_u32ScriptZZ;
/**
- * A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
- * containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
- * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ * A tuple of 2 elements. See the individual fields for the types contained.
*/
-typedef struct LDKCResult_NonePeerHandleErrorZ {
+typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
/**
- * The contents of this CResult_NonePeerHandleErrorZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
+ * The element at position 0
*/
- union LDKCResult_NonePeerHandleErrorZPtr contents;
+ struct LDKThirtyTwoBytes a;
/**
- * Whether this CResult_NonePeerHandleErrorZ represents a success state.
+ * The element at position 1
*/
- bool result_ok;
-} LDKCResult_NonePeerHandleErrorZ;
+ struct LDKCVec_C2Tuple_u32ScriptZZ b;
+} LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ;
/**
- * The contents of CResult_boolPeerHandleErrorZ
+ * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
+ * This corresponds to std::vector in C++
*/
-typedef union LDKCResult_boolPeerHandleErrorZPtr {
+typedef struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
/**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
*/
- bool *result;
+ struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *data;
/**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
+ * The number of elements pointed to by `data`.
*/
- struct LDKPeerHandleError *err;
-} LDKCResult_boolPeerHandleErrorZPtr;
+ uintptr_t datalen;
+} LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ;
/**
- * A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
- * containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
- * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ * A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
+ * This corresponds to std::vector in C++
*/
-typedef struct LDKCResult_boolPeerHandleErrorZ {
+typedef struct LDKCVec_EventZ {
/**
- * The contents of this CResult_boolPeerHandleErrorZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
*/
- union LDKCResult_boolPeerHandleErrorZPtr contents;
+ struct LDKEvent *data;
/**
- * Whether this CResult_boolPeerHandleErrorZ represents a success state.
+ * The number of elements pointed to by `data`.
*/
- bool result_ok;
-} LDKCResult_boolPeerHandleErrorZ;
-
-
+ uintptr_t datalen;
+} LDKCVec_EventZ;
/**
- * Represents the compressed public key of a node
+ * A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
+ * This corresponds to std::vector in C++
*/
-typedef struct MUST_USE_STRUCT LDKNodeId {
+typedef struct LDKCVec_TransactionZ {
/**
- * A pointer to the opaque Rust object.
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
*/
- LDKnativeNodeId *inner;
+ struct LDKTransaction *data;
/**
- * Indicates that this is the only struct which contains the same pointer.
- * Rust functions which take ownership of an object provided via an argument require
- * this to be true and invalidate the object pointed to by inner.
+ * The number of elements pointed to by `data`.
*/
- bool is_owned;
-} LDKNodeId;
+ uintptr_t datalen;
+} LDKCVec_TransactionZ;
/**
- * The contents of CResult_NodeIdDecodeErrorZ
+ * A tuple of 2 elements. See the individual fields for the types contained.
*/
-typedef union LDKCResult_NodeIdDecodeErrorZPtr {
+typedef struct LDKC2Tuple_u32TxOutZ {
/**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
+ * The element at position 0
*/
- struct LDKNodeId *result;
+ uint32_t a;
/**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
+ * The element at position 1
*/
- struct LDKDecodeError *err;
-} LDKCResult_NodeIdDecodeErrorZPtr;
+ struct LDKTxOut b;
+} LDKC2Tuple_u32TxOutZ;
/**
- * A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::lightning::routing::network_graph::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
- * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
+ * This corresponds to std::vector in C++
*/
-typedef struct LDKCResult_NodeIdDecodeErrorZ {
+typedef struct LDKCVec_C2Tuple_u32TxOutZZ {
/**
- * The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
*/
- union LDKCResult_NodeIdDecodeErrorZPtr contents;
+ struct LDKC2Tuple_u32TxOutZ *data;
/**
- * Whether this CResult_NodeIdDecodeErrorZ represents a success state.
+ * The number of elements pointed to by `data`.
*/
- bool result_ok;
-} LDKCResult_NodeIdDecodeErrorZ;
+ uintptr_t datalen;
+} LDKCVec_C2Tuple_u32TxOutZZ;
/**
- * The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
+ * A tuple of 2 elements. See the individual fields for the types contained.
*/
-typedef union LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr {
+typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
/**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
+ * The element at position 0
*/
- struct LDKCOption_NetworkUpdateZ *result;
+ struct LDKThirtyTwoBytes a;
/**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
+ * The element at position 1
*/
- struct LDKDecodeError *err;
-} LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr;
+ struct LDKCVec_C2Tuple_u32TxOutZZ b;
+} LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ;
/**
- * A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
- * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
+ * This corresponds to std::vector in C++
*/
-typedef struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ {
+typedef struct LDKCVec_TransactionOutputsZ {
/**
- * The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
*/
- union LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr contents;
+ struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *data;
/**
- * Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
+ * The number of elements pointed to by `data`.
*/
- bool result_ok;
-} LDKCResult_COption_NetworkUpdateZDecodeErrorZ;
+ uintptr_t datalen;
+} LDKCVec_TransactionOutputsZ;
/**
- * The `Access` trait defines behavior for accessing chain data and state, such as blocks and
- * UTXOs.
+ * Details about the balance(s) available for spending once the channel appears on chain.
+ *
+ * See [`ChannelMonitor::get_claimable_balances`] for more details on when these will or will not
+ * be provided.
*/
-typedef struct LDKAccess {
- /**
- * An opaque pointer which is passed to your function implementations as an argument.
- * This has no meaning in the LDK, and can be NULL or any other value.
- */
- void *this_arg;
+typedef enum LDKBalance_Tag {
/**
- * 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.
- *
- * [`short_channel_id`]: https://github.com/lightningnetwork/lightning-rfc/blob/master/07-routing-gossip.md#definition-of-short_channel_id
+ * The channel is not yet closed (or the commitment or closing transaction has not yet
+ * appeared in a block). The given balance is claimable (less on-chain fees) if the channel is
+ * force-closed now.
*/
- struct LDKCResult_TxOutAccessErrorZ (*get_utxo)(const void *this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id);
+ LDKBalance_ClaimableOnChannelClose,
/**
- * Frees any resources associated with this object given its this_arg pointer.
- * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ * The channel has been closed, and the given balance is ours but awaiting confirmations until
+ * we consider it spendable.
*/
- void (*free)(void *this_arg);
-} LDKAccess;
-
-/**
- * An enum which can either contain a crate::lightning::chain::Access or not
- */
-typedef enum LDKCOption_AccessZ_Tag {
+ LDKBalance_ClaimableAwaitingConfirmations,
/**
- * When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
+ * The channel has been closed, and the given balance should be ours but awaiting spending
+ * transaction confirmation. If the spending transaction does not confirm in time, it is
+ * possible our counterparty can take the funds by broadcasting an HTLC timeout on-chain.
+ *
+ * Once the spending transaction confirms, before it has reached enough confirmations to be
+ * considered safe from chain reorganizations, the balance will instead be provided via
+ * [`Balance::ClaimableAwaitingConfirmations`].
*/
- LDKCOption_AccessZ_Some,
+ LDKBalance_ContentiousClaimable,
/**
- * When we're in this state, this COption_AccessZ contains nothing
+ * HTLCs which we sent to our counterparty which are claimable after a timeout (less on-chain
+ * fees) if the counterparty does not know the preimage for the HTLCs. These are somewhat
+ * likely to be claimed by our counterparty before we do.
*/
- LDKCOption_AccessZ_None,
+ LDKBalance_MaybeClaimableHTLCAwaitingTimeout,
/**
* Must be last for serialization purposes
*/
- LDKCOption_AccessZ_Sentinel,
-} LDKCOption_AccessZ_Tag;
-
-typedef struct LDKCOption_AccessZ {
- LDKCOption_AccessZ_Tag tag;
- union {
- struct {
- struct LDKAccess some;
- };
- };
-} LDKCOption_AccessZ;
-
+ LDKBalance_Sentinel,
+} LDKBalance_Tag;
+typedef struct LDKBalance_LDKClaimableOnChannelClose_Body {
+ /**
+ * The amount available to claim, in satoshis, excluding the on-chain fees which will be
+ * required to do so.
+ */
+ uint64_t claimable_amount_satoshis;
+} LDKBalance_LDKClaimableOnChannelClose_Body;
-/**
- * Details about one direction of a channel as received within a [`ChannelUpdate`].
- */
-typedef struct MUST_USE_STRUCT LDKChannelUpdateInfo {
+typedef struct LDKBalance_LDKClaimableAwaitingConfirmations_Body {
/**
- * A pointer to the opaque Rust object.
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ * The amount available to claim, in satoshis, possibly excluding the on-chain fees which
+ * were spent in broadcasting the transaction.
*/
- LDKnativeChannelUpdateInfo *inner;
+ uint64_t claimable_amount_satoshis;
/**
- * Indicates that this is the only struct which contains the same pointer.
- * Rust functions which take ownership of an object provided via an argument require
- * this to be true and invalidate the object pointed to by inner.
+ * The height at which an [`Event::SpendableOutputs`] event will be generated for this
+ * amount.
*/
- bool is_owned;
-} LDKChannelUpdateInfo;
+ uint32_t confirmation_height;
+} LDKBalance_LDKClaimableAwaitingConfirmations_Body;
-/**
- * The contents of CResult_ChannelUpdateInfoDecodeErrorZ
- */
-typedef union LDKCResult_ChannelUpdateInfoDecodeErrorZPtr {
+typedef struct LDKBalance_LDKContentiousClaimable_Body {
/**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
+ * The amount available to claim, in satoshis, excluding the on-chain fees which will be
+ * required to do so.
*/
- struct LDKChannelUpdateInfo *result;
+ uint64_t claimable_amount_satoshis;
/**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
+ * The height at which the counterparty may be able to claim the balance if we have not
+ * done so.
*/
- struct LDKDecodeError *err;
-} LDKCResult_ChannelUpdateInfoDecodeErrorZPtr;
+ uint32_t timeout_height;
+} LDKBalance_LDKContentiousClaimable_Body;
-/**
- * A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::lightning::routing::network_graph::ChannelUpdateInfo 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_ChannelUpdateInfoDecodeErrorZ {
+typedef struct LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_Body {
/**
- * The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
+ * The amount available to claim, in satoshis, excluding the on-chain fees which will be
+ * required to do so.
*/
- union LDKCResult_ChannelUpdateInfoDecodeErrorZPtr contents;
+ uint64_t claimable_amount_satoshis;
/**
- * Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
+ * The height at which we will be able to claim the balance if our counterparty has not
+ * done so.
*/
- bool result_ok;
-} LDKCResult_ChannelUpdateInfoDecodeErrorZ;
-
+ uint32_t claimable_height;
+} LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_Body;
+typedef struct MUST_USE_STRUCT LDKBalance {
+ LDKBalance_Tag tag;
+ union {
+ LDKBalance_LDKClaimableOnChannelClose_Body claimable_on_channel_close;
+ LDKBalance_LDKClaimableAwaitingConfirmations_Body claimable_awaiting_confirmations;
+ LDKBalance_LDKContentiousClaimable_Body contentious_claimable;
+ LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_Body maybe_claimable_htlc_awaiting_timeout;
+ };
+} LDKBalance;
/**
- * Details about a channel (both directions).
- * Received within a channel announcement.
+ * A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
+ * This corresponds to std::vector in C++
*/
-typedef struct MUST_USE_STRUCT LDKChannelInfo {
+typedef struct LDKCVec_BalanceZ {
/**
- * A pointer to the opaque Rust object.
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
*/
- LDKnativeChannelInfo *inner;
+ struct LDKBalance *data;
/**
- * Indicates that this is the only struct which contains the same pointer.
- * Rust functions which take ownership of an object provided via an argument require
- * this to be true and invalidate the object pointed to by inner.
+ * The number of elements pointed to by `data`.
*/
- bool is_owned;
-} LDKChannelInfo;
+ uintptr_t datalen;
+} LDKCVec_BalanceZ;
/**
- * The contents of CResult_ChannelInfoDecodeErrorZ
+ * The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
*/
-typedef union LDKCResult_ChannelInfoDecodeErrorZPtr {
+typedef union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKChannelInfo *result;
+ struct LDKC2Tuple_BlockHashChannelMonitorZ *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_ChannelInfoDecodeErrorZPtr;
+} LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr;
/**
- * A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ 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_ChannelInfoDecodeErrorZ {
+typedef struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
/**
- * The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
+ * The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_ChannelInfoDecodeErrorZPtr contents;
+ union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr contents;
/**
- * Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
+ * Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_ChannelInfoDecodeErrorZ;
-
-
+} LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ;
/**
- * Fees for routing via a given channel or a node
+ * A tuple of 2 elements. See the individual fields for the types contained.
*/
-typedef struct MUST_USE_STRUCT LDKRoutingFees {
+typedef struct LDKC2Tuple_PublicKeyTypeZ {
/**
- * A pointer to the opaque Rust object.
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ * The element at position 0
*/
- LDKnativeRoutingFees *inner;
+ struct LDKPublicKey a;
/**
- * Indicates that this is the only struct which contains the same pointer.
- * Rust functions which take ownership of an object provided via an argument require
- * this to be true and invalidate the object pointed to by inner.
+ * The element at position 1
*/
- bool is_owned;
-} LDKRoutingFees;
+ struct LDKType b;
+} LDKC2Tuple_PublicKeyTypeZ;
/**
- * The contents of CResult_RoutingFeesDecodeErrorZ
+ * A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
+ * This corresponds to std::vector in C++
*/
-typedef union LDKCResult_RoutingFeesDecodeErrorZPtr {
+typedef struct LDKCVec_C2Tuple_PublicKeyTypeZZ {
/**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
*/
- struct LDKRoutingFees *result;
+ struct LDKC2Tuple_PublicKeyTypeZ *data;
/**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
+ * The number of elements pointed to by `data`.
*/
- struct LDKDecodeError *err;
-} LDKCResult_RoutingFeesDecodeErrorZPtr;
+ uintptr_t datalen;
+} LDKCVec_C2Tuple_PublicKeyTypeZZ;
/**
- * A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
- * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ * An enum which can either contain a crate::lightning::ln::msgs::NetAddress or not
*/
-typedef struct LDKCResult_RoutingFeesDecodeErrorZ {
+typedef enum LDKCOption_NetAddressZ_Tag {
/**
- * The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
+ * When we're in this state, this COption_NetAddressZ contains a crate::lightning::ln::msgs::NetAddress
*/
- union LDKCResult_RoutingFeesDecodeErrorZPtr contents;
+ LDKCOption_NetAddressZ_Some,
/**
- * Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
+ * When we're in this state, this COption_NetAddressZ contains nothing
*/
- bool result_ok;
-} LDKCResult_RoutingFeesDecodeErrorZ;
+ LDKCOption_NetAddressZ_None,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKCOption_NetAddressZ_Sentinel,
+} LDKCOption_NetAddressZ_Tag;
+
+typedef struct LDKCOption_NetAddressZ {
+ LDKCOption_NetAddressZ_Tag tag;
+ union {
+ struct {
+ struct LDKNetAddress some;
+ };
+ };
+} LDKCOption_NetAddressZ;
/**
- * Information received in the latest node_announcement from this node.
+ * Error for PeerManager errors. If you get one of these, you must disconnect the socket and
+ * generate no further read_event/write_buffer_space_avail/socket_disconnected calls for the
+ * descriptor.
*/
-typedef struct MUST_USE_STRUCT LDKNodeAnnouncementInfo {
+typedef struct MUST_USE_STRUCT LDKPeerHandleError {
/**
* 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.
*/
- LDKnativeNodeAnnouncementInfo *inner;
+ LDKnativePeerHandleError *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;
-} LDKNodeAnnouncementInfo;
+} LDKPeerHandleError;
/**
- * The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
+ * The contents of CResult_CVec_u8ZPeerHandleErrorZ
*/
-typedef union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr {
+typedef union LDKCResult_CVec_u8ZPeerHandleErrorZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKNodeAnnouncementInfo *result;
+ struct LDKCVec_u8Z *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_NodeAnnouncementInfoDecodeErrorZPtr;
+ struct LDKPeerHandleError *err;
+} LDKCResult_CVec_u8ZPeerHandleErrorZPtr;
/**
- * A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
+ * containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ {
+typedef struct LDKCResult_CVec_u8ZPeerHandleErrorZ {
/**
- * The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
+ * The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr contents;
+ union LDKCResult_CVec_u8ZPeerHandleErrorZPtr contents;
/**
- * Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
+ * Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_NodeAnnouncementInfoDecodeErrorZ;
-
-/**
- * A dynamically-allocated array of u64s of arbitrary size.
- * This corresponds to std::vector in C++
- */
-typedef struct LDKCVec_u64Z {
- /**
- * The elements in the array.
- * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
- */
- uint64_t *data;
- /**
- * The number of elements pointed to by `data`.
- */
- uintptr_t datalen;
-} LDKCVec_u64Z;
-
-
-
-/**
- * Details about a node in the network, known from the network announcement.
- */
-typedef struct MUST_USE_STRUCT LDKNodeInfo {
- /**
- * 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.
- */
- LDKnativeNodeInfo *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;
-} LDKNodeInfo;
+} LDKCResult_CVec_u8ZPeerHandleErrorZ;
/**
- * The contents of CResult_NodeInfoDecodeErrorZ
+ * The contents of CResult_NonePeerHandleErrorZ
*/
-typedef union LDKCResult_NodeInfoDecodeErrorZPtr {
+typedef union LDKCResult_NonePeerHandleErrorZPtr {
/**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
+ * Note that this value is always NULL, as there are no contents in the OK variant
*/
- struct LDKNodeInfo *result;
+ void *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_NodeInfoDecodeErrorZPtr;
+ struct LDKPeerHandleError *err;
+} LDKCResult_NonePeerHandleErrorZPtr;
/**
- * A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
+ * containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_NodeInfoDecodeErrorZ {
+typedef struct LDKCResult_NonePeerHandleErrorZ {
/**
- * The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
+ * The contents of this CResult_NonePeerHandleErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_NodeInfoDecodeErrorZPtr contents;
+ union LDKCResult_NonePeerHandleErrorZPtr contents;
/**
- * Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
+ * Whether this CResult_NonePeerHandleErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_NodeInfoDecodeErrorZ;
+} LDKCResult_NonePeerHandleErrorZ;
/**
- * The contents of CResult_NetworkGraphDecodeErrorZ
+ * The contents of CResult_boolPeerHandleErrorZ
*/
-typedef union LDKCResult_NetworkGraphDecodeErrorZPtr {
+typedef union LDKCResult_boolPeerHandleErrorZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKNetworkGraph *result;
+ bool *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_NetworkGraphDecodeErrorZPtr;
+ struct LDKPeerHandleError *err;
+} LDKCResult_boolPeerHandleErrorZPtr;
/**
- * A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
+ * containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_NetworkGraphDecodeErrorZ {
+typedef struct LDKCResult_boolPeerHandleErrorZ {
/**
- * The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
+ * The contents of this CResult_boolPeerHandleErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_NetworkGraphDecodeErrorZPtr contents;
+ union LDKCResult_boolPeerHandleErrorZPtr contents;
/**
- * Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
+ * Whether this CResult_boolPeerHandleErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_NetworkGraphDecodeErrorZ;
+} LDKCResult_boolPeerHandleErrorZ;
/**
- * An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
+ * All-encompassing standard error type that processing can return
*/
-typedef enum LDKCOption_CVec_NetAddressZZ_Tag {
+typedef enum LDKGraphSyncError_Tag {
/**
- * When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
+ * Error trying to read the update data, typically due to an erroneous data length indication
+ * that is greater than the actual amount of data provided
*/
- LDKCOption_CVec_NetAddressZZ_Some,
+ LDKGraphSyncError_DecodeError,
/**
- * When we're in this state, this COption_CVec_NetAddressZZ contains nothing
+ * Error applying the patch to the network graph, usually the result of updates that are too
+ * old or missing prerequisite data to the application of updates out of order
*/
- LDKCOption_CVec_NetAddressZZ_None,
+ LDKGraphSyncError_LightningError,
/**
* Must be last for serialization purposes
*/
- LDKCOption_CVec_NetAddressZZ_Sentinel,
-} LDKCOption_CVec_NetAddressZZ_Tag;
+ LDKGraphSyncError_Sentinel,
+} LDKGraphSyncError_Tag;
-typedef struct LDKCOption_CVec_NetAddressZZ {
- LDKCOption_CVec_NetAddressZZ_Tag tag;
+typedef struct MUST_USE_STRUCT LDKGraphSyncError {
+ LDKGraphSyncError_Tag tag;
union {
struct {
- struct LDKCVec_NetAddressZ some;
+ struct LDKDecodeError decode_error;
+ };
+ struct {
+ struct LDKLightningError lightning_error;
};
};
-} LDKCOption_CVec_NetAddressZZ;
+} LDKGraphSyncError;
+
+/**
+ * The contents of CResult_u32GraphSyncErrorZ
+ */
+typedef union LDKCResult_u32GraphSyncErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ uint32_t *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKGraphSyncError *err;
+} LDKCResult_u32GraphSyncErrorZPtr;
+
+/**
+ * A CResult_u32GraphSyncErrorZ represents the result of a fallible operation,
+ * containing a u32 on success and a crate::lightning_rapid_gossip_sync::error::GraphSyncError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_u32GraphSyncErrorZ {
+ /**
+ * The contents of this CResult_u32GraphSyncErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_u32GraphSyncErrorZPtr contents;
+ /**
+ * Whether this CResult_u32GraphSyncErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_u32GraphSyncErrorZ;
/**
* The contents of CResult_NetAddressDecodeErrorZ
} LDKCResult_FundingSignedDecodeErrorZ;
/**
- * The contents of CResult_FundingLockedDecodeErrorZ
+ * The contents of CResult_ChannelReadyDecodeErrorZ
*/
-typedef union LDKCResult_FundingLockedDecodeErrorZPtr {
+typedef union LDKCResult_ChannelReadyDecodeErrorZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKFundingLocked *result;
+ struct LDKChannelReady *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_FundingLockedDecodeErrorZPtr;
+} LDKCResult_ChannelReadyDecodeErrorZPtr;
/**
- * A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * A CResult_ChannelReadyDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::ChannelReady 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_FundingLockedDecodeErrorZ {
+typedef struct LDKCResult_ChannelReadyDecodeErrorZ {
/**
- * The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
+ * The contents of this CResult_ChannelReadyDecodeErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_FundingLockedDecodeErrorZPtr contents;
+ union LDKCResult_ChannelReadyDecodeErrorZPtr contents;
/**
- * Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
+ * Whether this CResult_ChannelReadyDecodeErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_FundingLockedDecodeErrorZ;
+} LDKCResult_ChannelReadyDecodeErrorZ;
+/**
+ * Lightning TLV uses a custom variable-length integer called BigSize. It is similar to Bitcoin's
+ * variable-length integers except that it is serialized in big-endian instead of little-endian.
+ *
+ * Like Bitcoin's variable-length integer, it exhibits ambiguity in that certain values can be
+ * encoded in several different ways, which we must check for at deserialization-time. Thus, if
+ * you're looking for an example of a variable-length integer to use for your own project, move
+ * along, this is a rather poor design.
+ */
+typedef struct MUST_USE_STRUCT LDKBigSize {
+ /**
+ * 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.
+ */
+ LDKnativeBigSize *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;
+} LDKBigSize;
+
+
+
+/**
+ * Proposed use of a channel passed as a parameter to [`Score::channel_penalty_msat`].
+ */
+typedef struct MUST_USE_STRUCT LDKChannelUsage {
+ /**
+ * 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.
+ */
+ LDKnativeChannelUsage *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;
+} LDKChannelUsage;
+
+/**
+ * An interface used to score payment channels for path finding.
+ *
+ *\tScoring is in terms of fees willing to be paid in order to avoid routing through a channel.
+ */
+typedef struct LDKScore {
+ /**
+ * An opaque pointer which is passed to your function implementations as an argument.
+ * This has no meaning in the LDK, and can be NULL or any other value.
+ */
+ void *this_arg;
+ /**
+ * Returns the fee in msats willing to be paid to avoid routing `send_amt_msat` through the
+ * given channel in the direction from `source` to `target`.
+ *
+ * The channel's capacity (less any other MPP parts that are also being considered for use in
+ * the same payment) is given by `capacity_msat`. It may be determined from various sources
+ * such as a chain data, network gossip, or invoice hints. For invoice hints, a capacity near
+ * [`u64::max_value`] is given to indicate sufficient capacity for the invoice's full amount.
+ * Thus, implementations should be overflow-safe.
+ */
+ uint64_t (*channel_penalty_msat)(const void *this_arg, uint64_t short_channel_id, const struct LDKNodeId *NONNULL_PTR source, const struct LDKNodeId *NONNULL_PTR target, struct LDKChannelUsage usage);
+ /**
+ * Handles updating channel penalties after failing to route through a channel.
+ */
+ void (*payment_path_failed)(void *this_arg, struct LDKCVec_RouteHopZ path, uint64_t short_channel_id);
+ /**
+ * Handles updating channel penalties after successfully routing along a path.
+ */
+ void (*payment_path_successful)(void *this_arg, struct LDKCVec_RouteHopZ path);
+ /**
+ * Serialize the object into a byte array
+ */
+ struct LDKCVec_u8Z (*write)(const void *this_arg);
+ /**
+ * Frees any resources associated with this object given its this_arg pointer.
+ * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ */
+ void (*free)(void *this_arg);
+} LDKScore;
+
+
+
+/**
+ * A concrete implementation of [`LockableScore`] which supports multi-threading.
+ */
+typedef struct MUST_USE_STRUCT LDKMultiThreadedLockableScore {
+ /**
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeMultiThreadedLockableScore *inner;
+ /**
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
+ */
+ bool is_owned;
+} LDKMultiThreadedLockableScore;
+
+/**
+ * Trait that handles persisting a [`ChannelManager`], [`NetworkGraph`], and [`MultiThreadedLockableScore`] to disk.
+ */
+typedef struct LDKPersister {
+ /**
+ * 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;
+ /**
+ * Persist the given ['ChannelManager'] to disk, returning an error if persistence failed.
+ */
+ struct LDKCResult_NoneErrorZ (*persist_manager)(const void *this_arg, const struct LDKChannelManager *NONNULL_PTR channel_manager);
+ /**
+ * Persist the given [`NetworkGraph`] to disk, returning an error if persistence failed.
+ */
+ struct LDKCResult_NoneErrorZ (*persist_graph)(const void *this_arg, const struct LDKNetworkGraph *NONNULL_PTR network_graph);
+ /**
+ * Persist the given [`MultiThreadedLockableScore`] to disk, returning an error if persistence failed.
+ */
+ struct LDKCResult_NoneErrorZ (*persist_scorer)(const void *this_arg, const struct LDKMultiThreadedLockableScore *NONNULL_PTR scorer);
+ /**
+ * Frees any resources associated with this object given its this_arg pointer.
+ * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ */
+ void (*free)(void *this_arg);
+} LDKPersister;
+
+
+
/**
* Configuration we set when applicable.
*
* sourcing chain data using a block-oriented API should prefer this interface over [`Confirm`].
* Such clients fetch the entire header chain whereas clients using [`Confirm`] only fetch headers
* when needed.
+ *
+ * By using [`Listen::filtered_block_connected`] this interface supports clients fetching the
+ * entire header chain and only blocks with matching transaction data using BIP 157 filters or
+ * other similar filtering.
*/
typedef struct LDKListen {
/**
* This has no meaning in the LDK, and can be NULL or any other value.
*/
void *this_arg;
+ /**
+ * Notifies the listener that a block was added at the given height, with the transaction data
+ * possibly filtered.
+ */
+ void (*filtered_block_connected)(const void *this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
/**
* Notifies the listener that a block was added at the given height.
*/
*/
void (*handle_funding_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingSigned *NONNULL_PTR msg);
/**
- * Handle an incoming funding_locked message from the given peer.
+ * Handle an incoming channel_ready message from the given peer.
*/
- void (*handle_funding_locked)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingLocked *NONNULL_PTR msg);
+ void (*handle_channel_ready)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReady *NONNULL_PTR msg);
/**
* Handle an incoming shutdown message from the given peer.
*/
+/**
+ * A set of keys that were HKDF-expanded from an initial call to
+ * [`KeysInterface::get_inbound_payment_key_material`].
+ *
+ * [`KeysInterface::get_inbound_payment_key_material`]: crate::chain::keysinterface::KeysInterface::get_inbound_payment_key_material
+ */
+typedef struct MUST_USE_STRUCT LDKExpandedKey {
+ /**
+ * 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.
+ */
+ LDKnativeExpandedKey *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;
+} LDKExpandedKey;
+
+
+
/**
* Proof that the sender knows the per-commitment secret of the previous commitment transaction.
* This is used to convince the recipient that the channel is at a certain commitment
bool is_owned;
} LDKDirectedChannelTransactionParameters;
+/**
+ * Integer in the range `0..=16`
+ */
+typedef struct LDKWitnessVersion {
+ uint8_t _0;
+} LDKWitnessVersion;
+
/**
* Serves as an [`EventHandler`] for applying updates from [`Event::PaymentPathFailed`] to the
* [`NetworkGraph`].
*/
-typedef struct MUST_USE_STRUCT LDKNetGraphMsgHandler {
+typedef struct MUST_USE_STRUCT LDKP2PGossipSync {
/**
* A pointer to the opaque Rust object.
* Nearly everywhere, inner must be non-null, however in places where
* the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- LDKnativeNetGraphMsgHandler *inner;
+ LDKnativeP2PGossipSync *inner;
/**
* Indicates that this is the only struct which contains the same pointer.
* Rust functions which take ownership of an object provided via an argument require
* this to be true and invalidate the object pointed to by inner.
*/
bool is_owned;
-} LDKNetGraphMsgHandler;
+} LDKP2PGossipSync;
};
} LDKEffectiveCapacity;
-/**
- * An interface used to score payment channels for path finding.
- *
- *\tScoring is in terms of fees willing to be paid in order to avoid routing through a channel.
- */
-typedef struct LDKScore {
- /**
- * An opaque pointer which is passed to your function implementations as an argument.
- * This has no meaning in the LDK, and can be NULL or any other value.
- */
- void *this_arg;
- /**
- * Returns the fee in msats willing to be paid to avoid routing `send_amt_msat` through the
- * given channel in the direction from `source` to `target`.
- *
- * The channel's capacity (less any other MPP parts that are also being considered for use in
- * the same payment) is given by `capacity_msat`. It may be determined from various sources
- * such as a chain data, network gossip, or invoice hints. For invoice hints, a capacity near
- * [`u64::max_value`] is given to indicate sufficient capacity for the invoice's full amount.
- * Thus, implementations should be overflow-safe.
- */
- uint64_t (*channel_penalty_msat)(const void *this_arg, uint64_t short_channel_id, uint64_t send_amt_msat, uint64_t capacity_msat, const struct LDKNodeId *NONNULL_PTR source, const struct LDKNodeId *NONNULL_PTR target);
- /**
- * Handles updating channel penalties after failing to route through a channel.
- */
- void (*payment_path_failed)(void *this_arg, struct LDKCVec_RouteHopZ path, uint64_t short_channel_id);
- /**
- * Handles updating channel penalties after successfully routing along a path.
- */
- void (*payment_path_successful)(void *this_arg, struct LDKCVec_RouteHopZ path);
- /**
- * Serialize the object into a byte array
- */
- struct LDKCVec_u8Z (*write)(const void *this_arg);
- /**
- * Frees any resources associated with this object given its this_arg pointer.
- * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
- */
- void (*free)(void *this_arg);
-} LDKScore;
-
/**
* A scorer that is accessed under a lock.
*
/**
* An opaque pointer which is passed to your function implementations as an argument.
* This has no meaning in the LDK, and can be NULL or any other value.
- */
- void *this_arg;
- /**
- * Returns the locked scorer.
- */
- struct LDKScore (*lock)(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);
-} LDKLockableScore;
-
-
-
-/**
- * A concrete implementation of [`LockableScore`] which supports multi-threading.
- */
-typedef struct MUST_USE_STRUCT LDKMultiThreadedLockableScore {
+ */
+ void *this_arg;
/**
- * A pointer to the opaque Rust object.
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ * Returns the locked scorer.
*/
- LDKnativeMultiThreadedLockableScore *inner;
+ struct LDKScore (*lock)(const void *this_arg);
/**
- * Indicates that this is the only struct which contains the same pointer.
- * Rust functions which take ownership of an object provided via an argument require
- * this to be true and invalidate the object pointed to by inner.
+ * Frees any resources associated with this object given its this_arg pointer.
+ * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
*/
- bool is_owned;
-} LDKMultiThreadedLockableScore;
+ void (*free)(void *this_arg);
+} LDKLockableScore;
* [`ChannelManager`] persistence should be done in the background.
* * Calling [`ChannelManager::timer_tick_occurred`] and [`PeerManager::timer_tick_occurred`]
* at the appropriate intervals.
- * * Calling [`NetworkGraph::remove_stale_channels`] (if a [`NetGraphMsgHandler`] is provided to
- * [`BackgroundProcessor::start`]).
+ * * Calling [`NetworkGraph::remove_stale_channels`] (if a [`GossipSync`] with a [`NetworkGraph`]
+ * is provided to [`BackgroundProcessor::start`]).
*
* It will also call [`PeerManager::process_events`] periodically though this shouldn't be relied
* upon as doing so may result in high latency.
bool is_owned;
} LDKBackgroundProcessor;
+
+
/**
- * Trait that handles persisting a [`ChannelManager`] and [`NetworkGraph`] to disk.
+ * Rapid Gossip Sync struct
+ * See [crate-level documentation] for usage.
+ *
+ * [crate-level documentation]: crate
*/
-typedef struct LDKPersister {
+typedef struct MUST_USE_STRUCT LDKRapidGossipSync {
/**
- * An opaque pointer which is passed to your function implementations as an argument.
- * This has no meaning in the LDK, and can be NULL or any other value.
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- void *this_arg;
+ LDKnativeRapidGossipSync *inner;
/**
- * Persist the given [`ChannelManager`] to disk, returning an error if persistence failed
- * (which will cause the [`BackgroundProcessor`] which called this method to exit).
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
*/
- struct LDKCResult_NoneErrorZ (*persist_manager)(const void *this_arg, const struct LDKChannelManager *NONNULL_PTR channel_manager);
+ bool is_owned;
+} LDKRapidGossipSync;
+
+/**
+ * Either [`P2PGossipSync`] or [`RapidGossipSync`].
+ */
+typedef enum LDKGossipSync_Tag {
/**
- * Persist the given [`NetworkGraph`] to disk, returning an error if persistence failed.
+ * Gossip sync via the lightning peer-to-peer network as defined by BOLT 7.
*/
- struct LDKCResult_NoneErrorZ (*persist_graph)(const void *this_arg, const struct LDKNetworkGraph *NONNULL_PTR network_graph);
+ LDKGossipSync_P2P,
/**
- * 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.
+ * Rapid gossip sync from a trusted server.
*/
- void (*free)(void *this_arg);
-} LDKPersister;
+ LDKGossipSync_Rapid,
+ /**
+ * No gossip sync.
+ */
+ LDKGossipSync_None,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKGossipSync_Sentinel,
+} LDKGossipSync_Tag;
+
+typedef struct MUST_USE_STRUCT LDKGossipSync {
+ LDKGossipSync_Tag tag;
+ union {
+ struct {
+ /**
+ * Note that this field is expected to be a reference.
+ */
+ struct LDKP2PGossipSync p2p;
+ };
+ struct {
+ /**
+ * Note that this field is expected to be a reference.
+ */
+ struct LDKRapidGossipSync rapid;
+ };
+ };
+} LDKGossipSync;
bool is_owned;
} LDKInvoicePayer;
-
-
/**
- * Number of attempts to retry payment path failures for an [`Invoice`].
+ * Strategies available to retry payment path failures for an [`Invoice`].
*
- * Note that this is the number of *path* failures, not full payment retries. For multi-path
- * payments, if this is less than the total number of paths, we will never even retry all of the
- * payment's paths.
*/
-typedef struct MUST_USE_STRUCT LDKRetryAttempts {
+typedef enum LDKRetry_Tag {
/**
- * A pointer to the opaque Rust object.
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ * Max number of attempts to retry payment.
+ *
+ * Note that this is the number of *path* failures, not full payment retries. For multi-path
+ * payments, if this is less than the total number of paths, we will never even retry all of the
+ * payment's paths.
*/
- LDKnativeRetryAttempts *inner;
+ LDKRetry_Attempts,
/**
- * 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.
+ * Time elapsed before abandoning retries for a payment.
*/
- bool is_owned;
-} LDKRetryAttempts;
+ LDKRetry_Timeout,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKRetry_Sentinel,
+} LDKRetry_Tag;
+
+typedef struct MUST_USE_STRUCT LDKRetry {
+ LDKRetry_Tag tag;
+ union {
+ struct {
+ uintptr_t attempts;
+ };
+ struct {
+ uint64_t timeout;
+ };
+ };
+} LDKRetry;
*/
struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_clone(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR orig);
-/**
- * Creates a new CResult_TxOutAccessErrorZ in the success state.
- */
-struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_ok(struct LDKTxOut o);
-
-/**
- * Creates a new CResult_TxOutAccessErrorZ in the error state.
- */
-struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_err(enum LDKAccessError e);
-
-/**
- * Checks if the given object is currently in the success state
- */
-bool CResult_TxOutAccessErrorZ_is_ok(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR o);
-
-/**
- * Frees any resources used by the CResult_TxOutAccessErrorZ.
- */
-void CResult_TxOutAccessErrorZ_free(struct LDKCResult_TxOutAccessErrorZ _res);
-
-/**
- * Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
- * but with all dynamically-allocated buffers duplicated in new buffers.
- */
-struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_clone(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR orig);
-
-/**
- * Creates a new tuple which has the same data as `orig`
- * but with all dynamically-allocated buffers duplicated in new buffers.
- */
-struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_clone(const struct LDKC2Tuple_usizeTransactionZ *NONNULL_PTR orig);
-
-/**
- * Creates a new C2Tuple_usizeTransactionZ from the contained elements.
- */
-struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b);
-
-/**
- * Frees any resources used by the C2Tuple_usizeTransactionZ.
- */
-void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res);
-
-/**
- * Frees the buffer pointed to by `data` if `datalen` is non-0.
- */
-void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res);
-
/**
* Frees the buffer pointed to by `data` if `datalen` is non-0.
*/
-void CVec_TxidZ_free(struct LDKCVec_TxidZ _res);
+void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res);
/**
- * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
+ * Creates a new CResult_PaymentPurposeDecodeErrorZ in the success state.
*/
-struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_ok(void);
+struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_ok(struct LDKPaymentPurpose o);
/**
- * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
+ * Creates a new CResult_PaymentPurposeDecodeErrorZ in the error state.
*/
-struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_err(enum LDKChannelMonitorUpdateErr e);
+struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_err(struct LDKDecodeError e);
/**
* Checks if the given object is currently in the success state
*/
-bool CResult_NoneChannelMonitorUpdateErrZ_is_ok(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR o);
-
-/**
- * Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
- */
-void CResult_NoneChannelMonitorUpdateErrZ_free(struct LDKCResult_NoneChannelMonitorUpdateErrZ _res);
-
-/**
- * Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
- * but with all dynamically-allocated buffers duplicated in new buffers.
- */
-struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_clone(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR orig);
-
-/**
- * Frees the buffer pointed to by `data` if `datalen` is non-0.
- */
-void CVec_MonitorEventZ_free(struct LDKCVec_MonitorEventZ _res);
-
-/**
- * Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
- */
-struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_some(struct LDKC2Tuple_usizeTransactionZ o);
-
-/**
- * Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
- */
-struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_none(void);
+bool CResult_PaymentPurposeDecodeErrorZ_is_ok(const struct LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR o);
/**
- * Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
+ * Frees any resources used by the CResult_PaymentPurposeDecodeErrorZ.
*/
-void COption_C2Tuple_usizeTransactionZZ_free(struct LDKCOption_C2Tuple_usizeTransactionZZ _res);
+void CResult_PaymentPurposeDecodeErrorZ_free(struct LDKCResult_PaymentPurposeDecodeErrorZ _res);
/**
- * Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
+ * Creates a new CResult_PaymentPurposeDecodeErrorZ which has the same data as `orig`
* but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_clone(const struct LDKCOption_C2Tuple_usizeTransactionZZ *NONNULL_PTR orig);
+struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_clone(const struct LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR orig);
/**
* Constructs a new COption_ClosureReasonZ containing a crate::lightning::util::events::ClosureReason
struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_clone(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR orig);
/**
- * Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::network_graph::NetworkUpdate
+ * Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::gossip::NetworkUpdate
*/
struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_some(struct LDKNetworkUpdate o);
struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_none(void);
/**
- * Frees any resources associated with the crate::lightning::routing::network_graph::NetworkUpdate, if we are in the Some state
+ * Frees any resources associated with the crate::lightning::routing::gossip::NetworkUpdate, if we are in the Some state
*/
void COption_NetworkUpdateZ_free(struct LDKCOption_NetworkUpdateZ _res);
void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res);
/**
- * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
+ * Creates a new CResult_TxOutAccessErrorZ in the success state.
*/
-struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_ok(struct LDKFixedPenaltyScorer o);
+struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_ok(struct LDKTxOut o);
/**
- * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
+ * Creates a new CResult_TxOutAccessErrorZ in the error state.
*/
-struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_err(struct LDKDecodeError e);
+struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_err(enum LDKAccessError e);
/**
* Checks if the given object is currently in the success state
*/
-bool CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(const struct LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR o);
+bool CResult_TxOutAccessErrorZ_is_ok(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR o);
/**
- * Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
+ * Frees any resources used by the CResult_TxOutAccessErrorZ.
*/
-void CResult_FixedPenaltyScorerDecodeErrorZ_free(struct LDKCResult_FixedPenaltyScorerDecodeErrorZ _res);
+void CResult_TxOutAccessErrorZ_free(struct LDKCResult_TxOutAccessErrorZ _res);
/**
- * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig`
+ * Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
* but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_clone(const struct LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR orig);
+struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_clone(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new tuple which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_clone(const struct LDKC2Tuple_usizeTransactionZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new C2Tuple_usizeTransactionZ from the contained elements.
+ */
+struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b);
+
+/**
+ * Frees any resources used by the C2Tuple_usizeTransactionZ.
+ */
+void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res);
+
+/**
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ */
+void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res);
+
+/**
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ */
+void CVec_TxidZ_free(struct LDKCVec_TxidZ _res);
/**
- * Creates a new CResult_ScoringParametersDecodeErrorZ in the success state.
+ * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
*/
-struct LDKCResult_ScoringParametersDecodeErrorZ CResult_ScoringParametersDecodeErrorZ_ok(struct LDKScoringParameters o);
+struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_ok(void);
/**
- * Creates a new CResult_ScoringParametersDecodeErrorZ in the error state.
+ * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
*/
-struct LDKCResult_ScoringParametersDecodeErrorZ CResult_ScoringParametersDecodeErrorZ_err(struct LDKDecodeError e);
+struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_err(enum LDKChannelMonitorUpdateErr e);
/**
* Checks if the given object is currently in the success state
*/
-bool CResult_ScoringParametersDecodeErrorZ_is_ok(const struct LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR o);
+bool CResult_NoneChannelMonitorUpdateErrZ_is_ok(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
+ */
+void CResult_NoneChannelMonitorUpdateErrZ_free(struct LDKCResult_NoneChannelMonitorUpdateErrZ _res);
+
+/**
+ * Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_clone(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR orig);
+
+/**
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ */
+void CVec_MonitorEventZ_free(struct LDKCVec_MonitorEventZ _res);
+
+/**
+ * Creates a new tuple which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKC2Tuple_OutPointCVec_MonitorEventZZ C2Tuple_OutPointCVec_MonitorEventZZ_clone(const struct LDKC2Tuple_OutPointCVec_MonitorEventZZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new C2Tuple_OutPointCVec_MonitorEventZZ from the contained elements.
+ */
+struct LDKC2Tuple_OutPointCVec_MonitorEventZZ C2Tuple_OutPointCVec_MonitorEventZZ_new(struct LDKOutPoint a, struct LDKCVec_MonitorEventZ b);
+
+/**
+ * Frees any resources used by the C2Tuple_OutPointCVec_MonitorEventZZ.
+ */
+void C2Tuple_OutPointCVec_MonitorEventZZ_free(struct LDKC2Tuple_OutPointCVec_MonitorEventZZ _res);
+
+/**
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ */
+void CVec_C2Tuple_OutPointCVec_MonitorEventZZZ_free(struct LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ _res);
+
+/**
+ * Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
+ */
+struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_some(struct LDKC2Tuple_usizeTransactionZ o);
+
+/**
+ * Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
+ */
+struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_none(void);
/**
- * Frees any resources used by the CResult_ScoringParametersDecodeErrorZ.
+ * Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
*/
-void CResult_ScoringParametersDecodeErrorZ_free(struct LDKCResult_ScoringParametersDecodeErrorZ _res);
+void COption_C2Tuple_usizeTransactionZZ_free(struct LDKCOption_C2Tuple_usizeTransactionZZ _res);
/**
- * Creates a new CResult_ScoringParametersDecodeErrorZ which has the same data as `orig`
+ * Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
* but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCResult_ScoringParametersDecodeErrorZ CResult_ScoringParametersDecodeErrorZ_clone(const struct LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR orig);
+struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_clone(const struct LDKCOption_C2Tuple_usizeTransactionZZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
+ */
+struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_ok(struct LDKFixedPenaltyScorer o);
/**
- * Creates a new CResult_ScorerDecodeErrorZ in the success state.
+ * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
*/
-struct LDKCResult_ScorerDecodeErrorZ CResult_ScorerDecodeErrorZ_ok(struct LDKScorer o);
+struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_err(struct LDKDecodeError e);
/**
- * Creates a new CResult_ScorerDecodeErrorZ in the error state.
+ * Checks if the given object is currently in the success state
*/
-struct LDKCResult_ScorerDecodeErrorZ CResult_ScorerDecodeErrorZ_err(struct LDKDecodeError e);
+bool CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(const struct LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR o);
/**
- * Checks if the given object is currently in the success state
+ * Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
*/
-bool CResult_ScorerDecodeErrorZ_is_ok(const struct LDKCResult_ScorerDecodeErrorZ *NONNULL_PTR o);
+void CResult_FixedPenaltyScorerDecodeErrorZ_free(struct LDKCResult_FixedPenaltyScorerDecodeErrorZ _res);
/**
- * Frees any resources used by the CResult_ScorerDecodeErrorZ.
+ * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
*/
-void CResult_ScorerDecodeErrorZ_free(struct LDKCResult_ScorerDecodeErrorZ _res);
+struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_clone(const struct LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR orig);
/**
* Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state.
*/
void CResult_InitFeaturesDecodeErrorZ_free(struct LDKCResult_InitFeaturesDecodeErrorZ _res);
+/**
+ * Creates a new CResult_InitFeaturesDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_clone(const struct LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR orig);
+
/**
* Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
*/
*/
void CResult_ChannelFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelFeaturesDecodeErrorZ _res);
+/**
+ * Creates a new CResult_ChannelFeaturesDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_clone(const struct LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR orig);
+
/**
* Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
*/
*/
void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res);
+/**
+ * Creates a new CResult_NodeFeaturesDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_clone(const struct LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR orig);
+
/**
* Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
*/
*/
void CResult_InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_InvoiceFeaturesDecodeErrorZ _res);
+/**
+ * Creates a new CResult_InvoiceFeaturesDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_clone(const struct LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR orig);
+
/**
* Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
*/
void CResult_ChannelTypeFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res);
/**
- * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
+ * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKDelayedPaymentOutputDescriptor o);
+struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_clone(const struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR orig);
/**
- * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
+ * Creates a new CResult_NodeIdDecodeErrorZ in the success state.
*/
-struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
+struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_ok(struct LDKNodeId o);
+
+/**
+ * Creates a new CResult_NodeIdDecodeErrorZ in the error state.
+ */
+struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_err(struct LDKDecodeError e);
/**
* Checks if the given object is currently in the success state
*/
-bool CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
+bool CResult_NodeIdDecodeErrorZ_is_ok(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR o);
/**
- * Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
+ * Frees any resources used by the CResult_NodeIdDecodeErrorZ.
*/
-void CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res);
+void CResult_NodeIdDecodeErrorZ_free(struct LDKCResult_NodeIdDecodeErrorZ _res);
/**
- * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
+ * Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
* but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
+struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_clone(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR orig);
/**
- * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
+ * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
*/
-struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKStaticPaymentOutputDescriptor o);
+struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_ok(struct LDKCOption_NetworkUpdateZ o);
/**
- * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
+ * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
*/
-struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
+struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_err(struct LDKDecodeError e);
/**
* Checks if the given object is currently in the success state
*/
-bool CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
+bool CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR o);
/**
- * Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
+ * Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
*/
-void CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res);
+void CResult_COption_NetworkUpdateZDecodeErrorZ_free(struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res);
/**
- * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
+ * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
* but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
+struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_clone(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR orig);
/**
- * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
+ * Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
*/
-struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_ok(struct LDKSpendableOutputDescriptor o);
+struct LDKCOption_AccessZ COption_AccessZ_some(struct LDKAccess o);
/**
- * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
+ * Constructs a new COption_AccessZ containing nothing
*/
-struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
+struct LDKCOption_AccessZ COption_AccessZ_none(void);
/**
- * Checks if the given object is currently in the success state
+ * Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
*/
-bool CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
+void COption_AccessZ_free(struct LDKCOption_AccessZ _res);
/**
- * Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
+ * Creates a new CResult_boolLightningErrorZ in the success state.
*/
-void CResult_SpendableOutputDescriptorDecodeErrorZ_free(struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res);
+struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o);
/**
- * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
- * but with all dynamically-allocated buffers duplicated in new buffers.
+ * Creates a new CResult_boolLightningErrorZ in the error state.
*/
-struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
+struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e);
/**
- * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ * Checks if the given object is currently in the success state
*/
-void CVec_PaymentPreimageZ_free(struct LDKCVec_PaymentPreimageZ _res);
+bool CResult_boolLightningErrorZ_is_ok(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_boolLightningErrorZ.
+ */
+void CResult_boolLightningErrorZ_free(struct LDKCResult_boolLightningErrorZ _res);
+
+/**
+ * Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_clone(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR orig);
/**
* Creates a new tuple which has the same data as `orig`
* but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_clone(const struct LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR orig);
+struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(const struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR orig);
/**
- * Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
+ * Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
*/
-struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(struct LDKSignature a, struct LDKCVec_SignatureZ b);
+struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c);
/**
- * Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
+ * Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
*/
-void C2Tuple_SignatureCVec_SignatureZZ_free(struct LDKC2Tuple_SignatureCVec_SignatureZZ _res);
+void C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res);
/**
- * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
*/
-struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(struct LDKC2Tuple_SignatureCVec_SignatureZZ o);
+void CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res);
/**
- * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
*/
-struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void);
+void CVec_NodeAnnouncementZ_free(struct LDKCVec_NodeAnnouncementZ _res);
+
+/**
+ * Creates a new CResult_NoneLightningErrorZ in the success state.
+ */
+struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void);
+
+/**
+ * Creates a new CResult_NoneLightningErrorZ in the error state.
+ */
+struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e);
/**
* Checks if the given object is currently in the success state
*/
-bool CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR o);
+bool CResult_NoneLightningErrorZ_is_ok(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR o);
/**
- * Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
+ * Frees any resources used by the CResult_NoneLightningErrorZ.
*/
-void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res);
+void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res);
/**
- * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
+ * Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
* but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR orig);
+struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_clone(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR orig);
/**
- * Creates a new CResult_SignatureNoneZ in the success state.
+ * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
*/
-struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_ok(struct LDKSignature o);
+struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_ok(struct LDKChannelUpdateInfo o);
/**
- * Creates a new CResult_SignatureNoneZ in the error state.
+ * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
*/
-struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void);
+struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_err(struct LDKDecodeError e);
/**
* Checks if the given object is currently in the success state
*/
-bool CResult_SignatureNoneZ_is_ok(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR o);
+bool CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(const struct LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR o);
/**
- * Frees any resources used by the CResult_SignatureNoneZ.
+ * Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
*/
-void CResult_SignatureNoneZ_free(struct LDKCResult_SignatureNoneZ _res);
+void CResult_ChannelUpdateInfoDecodeErrorZ_free(struct LDKCResult_ChannelUpdateInfoDecodeErrorZ _res);
/**
- * Creates a new CResult_SignatureNoneZ which has the same data as `orig`
+ * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
* but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_clone(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR orig);
+struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR orig);
/**
- * Creates a new tuple which has the same data as `orig`
- * but with all dynamically-allocated buffers duplicated in new buffers.
+ * Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
*/
-struct LDKC2Tuple_SignatureSignatureZ C2Tuple_SignatureSignatureZ_clone(const struct LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR orig);
+struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_ok(struct LDKChannelInfo o);
/**
- * Creates a new C2Tuple_SignatureSignatureZ from the contained elements.
+ * Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
*/
-struct LDKC2Tuple_SignatureSignatureZ C2Tuple_SignatureSignatureZ_new(struct LDKSignature a, struct LDKSignature b);
+struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
/**
- * Frees any resources used by the C2Tuple_SignatureSignatureZ.
+ * Checks if the given object is currently in the success state
*/
-void C2Tuple_SignatureSignatureZ_free(struct LDKC2Tuple_SignatureSignatureZ _res);
+bool CResult_ChannelInfoDecodeErrorZ_is_ok(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR o);
/**
- * Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the success state.
+ * Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
*/
-struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ CResult_C2Tuple_SignatureSignatureZNoneZ_ok(struct LDKC2Tuple_SignatureSignatureZ o);
+void CResult_ChannelInfoDecodeErrorZ_free(struct LDKCResult_ChannelInfoDecodeErrorZ _res);
/**
- * Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the error state.
+ * Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ CResult_C2Tuple_SignatureSignatureZNoneZ_err(void);
+struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
+ */
+struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o);
+
+/**
+ * Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
+ */
+struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e);
/**
* Checks if the given object is currently in the success state
*/
-bool CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(const struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR o);
+bool CResult_RoutingFeesDecodeErrorZ_is_ok(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR o);
/**
- * Frees any resources used by the CResult_C2Tuple_SignatureSignatureZNoneZ.
+ * Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
*/
-void CResult_C2Tuple_SignatureSignatureZNoneZ_free(struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ _res);
+void CResult_RoutingFeesDecodeErrorZ_free(struct LDKCResult_RoutingFeesDecodeErrorZ _res);
/**
- * Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ which has the same data as `orig`
+ * Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
* but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ CResult_C2Tuple_SignatureSignatureZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR orig);
+struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_clone(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR orig);
/**
- * Creates a new CResult_SecretKeyNoneZ in the success state.
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
*/
-struct LDKCResult_SecretKeyNoneZ CResult_SecretKeyNoneZ_ok(struct LDKSecretKey o);
+void CVec_NetAddressZ_free(struct LDKCVec_NetAddressZ _res);
/**
- * Creates a new CResult_SecretKeyNoneZ in the error state.
+ * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
*/
-struct LDKCResult_SecretKeyNoneZ CResult_SecretKeyNoneZ_err(void);
+struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_ok(struct LDKNodeAnnouncementInfo o);
+
+/**
+ * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
+ */
+struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_err(struct LDKDecodeError e);
/**
* Checks if the given object is currently in the success state
*/
-bool CResult_SecretKeyNoneZ_is_ok(const struct LDKCResult_SecretKeyNoneZ *NONNULL_PTR o);
+bool CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR o);
/**
- * Frees any resources used by the CResult_SecretKeyNoneZ.
+ * Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
*/
-void CResult_SecretKeyNoneZ_free(struct LDKCResult_SecretKeyNoneZ _res);
+void CResult_NodeAnnouncementInfoDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res);
/**
- * Creates a new CResult_SecretKeyNoneZ which has the same data as `orig`
+ * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
* but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCResult_SecretKeyNoneZ CResult_SecretKeyNoneZ_clone(const struct LDKCResult_SecretKeyNoneZ *NONNULL_PTR orig);
+struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR orig);
/**
- * Creates a new CResult_SignDecodeErrorZ in the success state.
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
*/
-struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_ok(struct LDKSign o);
+void CVec_u64Z_free(struct LDKCVec_u64Z _res);
/**
- * Creates a new CResult_SignDecodeErrorZ in the error state.
+ * Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
*/
-struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_err(struct LDKDecodeError e);
+struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_ok(struct LDKNodeInfo o);
+
+/**
+ * Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
+ */
+struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_err(struct LDKDecodeError e);
/**
* Checks if the given object is currently in the success state
*/
-bool CResult_SignDecodeErrorZ_is_ok(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR o);
+bool CResult_NodeInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR o);
/**
- * Frees any resources used by the CResult_SignDecodeErrorZ.
+ * Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
*/
-void CResult_SignDecodeErrorZ_free(struct LDKCResult_SignDecodeErrorZ _res);
+void CResult_NodeInfoDecodeErrorZ_free(struct LDKCResult_NodeInfoDecodeErrorZ _res);
/**
- * Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
+ * Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
* but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_clone(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR orig);
+struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_clone(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR orig);
/**
- * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ * Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
*/
-void CVec_u5Z_free(struct LDKCVec_u5Z _res);
+struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_ok(struct LDKNetworkGraph o);
/**
- * Creates a new CResult_RecoverableSignatureNoneZ in the success state.
+ * Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
*/
-struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_ok(struct LDKRecoverableSignature o);
+struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(struct LDKDecodeError e);
/**
- * Creates a new CResult_RecoverableSignatureNoneZ in the error state.
+ * Checks if the given object is currently in the success state
*/
-struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_err(void);
+bool CResult_NetworkGraphDecodeErrorZ_is_ok(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR o);
/**
- * Checks if the given object is currently in the success state
+ * Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
*/
-bool CResult_RecoverableSignatureNoneZ_is_ok(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR o);
+void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res);
/**
- * Frees any resources used by the CResult_RecoverableSignatureNoneZ.
+ * Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
*/
-void CResult_RecoverableSignatureNoneZ_free(struct LDKCResult_RecoverableSignatureNoneZ _res);
+struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_some(struct LDKCVec_NetAddressZ o);
/**
- * Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
- * but with all dynamically-allocated buffers duplicated in new buffers.
+ * Constructs a new COption_CVec_NetAddressZZ containing nothing
*/
-struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_clone(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR orig);
+struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_none(void);
/**
- * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ * Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
*/
-void CVec_u8Z_free(struct LDKCVec_u8Z _res);
+void COption_CVec_NetAddressZZ_free(struct LDKCOption_CVec_NetAddressZZ _res);
/**
- * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ * Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
*/
-void CVec_CVec_u8ZZ_free(struct LDKCVec_CVec_u8ZZ _res);
+struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_clone(const struct LDKCOption_CVec_NetAddressZZ *NONNULL_PTR orig);
/**
- * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
+ * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
*/
-struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_ok(struct LDKCVec_CVec_u8ZZ o);
+struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKDelayedPaymentOutputDescriptor o);
/**
- * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
+ * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
*/
-struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_err(void);
+struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
/**
* Checks if the given object is currently in the success state
*/
-bool CResult_CVec_CVec_u8ZZNoneZ_is_ok(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR o);
+bool CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
/**
- * Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
+ * Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
*/
-void CResult_CVec_CVec_u8ZZNoneZ_free(struct LDKCResult_CVec_CVec_u8ZZNoneZ _res);
+void CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res);
/**
- * Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
+ * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
* but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_clone(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR orig);
+struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
/**
- * Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
+ * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
*/
-struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_ok(struct LDKInMemorySigner o);
+struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKStaticPaymentOutputDescriptor o);
/**
- * Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
+ * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
*/
-struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_err(struct LDKDecodeError e);
+struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
/**
* Checks if the given object is currently in the success state
*/
-bool CResult_InMemorySignerDecodeErrorZ_is_ok(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR o);
+bool CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
/**
- * Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
+ * Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
*/
-void CResult_InMemorySignerDecodeErrorZ_free(struct LDKCResult_InMemorySignerDecodeErrorZ _res);
+void CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res);
/**
- * Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
+ * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
* but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_clone(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR orig);
-
-/**
- * Frees the buffer pointed to by `data` if `datalen` is non-0.
- */
-void CVec_TxOutZ_free(struct LDKCVec_TxOutZ _res);
+struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
/**
- * Creates a new CResult_TransactionNoneZ in the success state.
+ * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
*/
-struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_ok(struct LDKTransaction o);
+struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_ok(struct LDKSpendableOutputDescriptor o);
/**
- * Creates a new CResult_TransactionNoneZ in the error state.
+ * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
*/
-struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_err(void);
+struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
/**
* Checks if the given object is currently in the success state
*/
-bool CResult_TransactionNoneZ_is_ok(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR o);
+bool CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
/**
- * Frees any resources used by the CResult_TransactionNoneZ.
+ * Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
*/
-void CResult_TransactionNoneZ_free(struct LDKCResult_TransactionNoneZ _res);
+void CResult_SpendableOutputDescriptorDecodeErrorZ_free(struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res);
/**
- * Creates a new CResult_TransactionNoneZ which has the same data as `orig`
+ * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
* but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_clone(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR orig);
-
-/**
- * Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
- */
-struct LDKC2Tuple_BlockHashChannelMonitorZ C2Tuple_BlockHashChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b);
-
-/**
- * Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
- */
-void C2Tuple_BlockHashChannelMonitorZ_free(struct LDKC2Tuple_BlockHashChannelMonitorZ _res);
+struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
/**
* Frees the buffer pointed to by `data` if `datalen` is non-0.
*/
-void CVec_C2Tuple_BlockHashChannelMonitorZZ_free(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res);
+void CVec_PaymentPreimageZ_free(struct LDKCVec_PaymentPreimageZ _res);
/**
- * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
+ * Creates a new tuple which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o);
+struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_clone(const struct LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR orig);
/**
- * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
+ * Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
*/
-struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(enum LDKIOError e);
+struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(struct LDKSignature a, struct LDKCVec_SignatureZ b);
/**
- * Checks if the given object is currently in the success state
+ * Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
*/
-bool CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(const struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR o);
+void C2Tuple_SignatureCVec_SignatureZZ_free(struct LDKC2Tuple_SignatureCVec_SignatureZZ _res);
/**
- * Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
+ * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
*/
-void CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res);
+struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(struct LDKC2Tuple_SignatureCVec_SignatureZZ o);
/**
- * Constructs a new COption_u16Z containing a u16
+ * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
*/
-struct LDKCOption_u16Z COption_u16Z_some(uint16_t o);
+struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void);
/**
- * Constructs a new COption_u16Z containing nothing
+ * Checks if the given object is currently in the success state
*/
-struct LDKCOption_u16Z COption_u16Z_none(void);
+bool CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR o);
/**
- * Frees any resources associated with the u16, if we are in the Some state
+ * Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
*/
-void COption_u16Z_free(struct LDKCOption_u16Z _res);
+void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res);
/**
- * Creates a new COption_u16Z which has the same data as `orig`
+ * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
* but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCOption_u16Z COption_u16Z_clone(const struct LDKCOption_u16Z *NONNULL_PTR orig);
+struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR orig);
/**
- * Creates a new CResult_NoneAPIErrorZ in the success state.
+ * Creates a new CResult_SignatureNoneZ in the success state.
*/
-struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void);
+struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_ok(struct LDKSignature o);
/**
- * Creates a new CResult_NoneAPIErrorZ in the error state.
+ * Creates a new CResult_SignatureNoneZ in the error state.
*/
-struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e);
+struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void);
/**
* Checks if the given object is currently in the success state
*/
-bool CResult_NoneAPIErrorZ_is_ok(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR o);
+bool CResult_SignatureNoneZ_is_ok(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR o);
/**
- * Frees any resources used by the CResult_NoneAPIErrorZ.
+ * Frees any resources used by the CResult_SignatureNoneZ.
*/
-void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res);
+void CResult_SignatureNoneZ_free(struct LDKCResult_SignatureNoneZ _res);
/**
- * Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
+ * Creates a new CResult_SignatureNoneZ which has the same data as `orig`
* but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR orig);
+struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_clone(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR orig);
/**
- * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ * Creates a new tuple which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
*/
-void CVec_CResult_NoneAPIErrorZZ_free(struct LDKCVec_CResult_NoneAPIErrorZZ _res);
+struct LDKC2Tuple_SignatureSignatureZ C2Tuple_SignatureSignatureZ_clone(const struct LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR orig);
/**
- * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ * Creates a new C2Tuple_SignatureSignatureZ from the contained elements.
*/
-void CVec_APIErrorZ_free(struct LDKCVec_APIErrorZ _res);
+struct LDKC2Tuple_SignatureSignatureZ C2Tuple_SignatureSignatureZ_new(struct LDKSignature a, struct LDKSignature b);
/**
- * Creates a new CResult__u832APIErrorZ in the success state.
+ * Frees any resources used by the C2Tuple_SignatureSignatureZ.
*/
-struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_ok(struct LDKThirtyTwoBytes o);
+void C2Tuple_SignatureSignatureZ_free(struct LDKC2Tuple_SignatureSignatureZ _res);
/**
- * Creates a new CResult__u832APIErrorZ in the error state.
+ * Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the success state.
*/
-struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_err(struct LDKAPIError e);
+struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ CResult_C2Tuple_SignatureSignatureZNoneZ_ok(struct LDKC2Tuple_SignatureSignatureZ o);
+
+/**
+ * Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the error state.
+ */
+struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ CResult_C2Tuple_SignatureSignatureZNoneZ_err(void);
/**
* Checks if the given object is currently in the success state
*/
-bool CResult__u832APIErrorZ_is_ok(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR o);
+bool CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(const struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR o);
/**
- * Frees any resources used by the CResult__u832APIErrorZ.
+ * Frees any resources used by the CResult_C2Tuple_SignatureSignatureZNoneZ.
*/
-void CResult__u832APIErrorZ_free(struct LDKCResult__u832APIErrorZ _res);
+void CResult_C2Tuple_SignatureSignatureZNoneZ_free(struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ _res);
/**
- * Creates a new CResult__u832APIErrorZ which has the same data as `orig`
+ * Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ which has the same data as `orig`
* but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_clone(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR orig);
+struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ CResult_C2Tuple_SignatureSignatureZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR orig);
/**
- * Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state.
+ * Creates a new CResult_SecretKeyNoneZ in the success state.
*/
-struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_ok(struct LDKThirtyTwoBytes o);
+struct LDKCResult_SecretKeyNoneZ CResult_SecretKeyNoneZ_ok(struct LDKSecretKey o);
/**
- * Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state.
+ * Creates a new CResult_SecretKeyNoneZ in the error state.
*/
-struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
+struct LDKCResult_SecretKeyNoneZ CResult_SecretKeyNoneZ_err(void);
/**
* Checks if the given object is currently in the success state
*/
-bool CResult_PaymentIdPaymentSendFailureZ_is_ok(const struct LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR o);
+bool CResult_SecretKeyNoneZ_is_ok(const struct LDKCResult_SecretKeyNoneZ *NONNULL_PTR o);
/**
- * Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ.
+ * Frees any resources used by the CResult_SecretKeyNoneZ.
*/
-void CResult_PaymentIdPaymentSendFailureZ_free(struct LDKCResult_PaymentIdPaymentSendFailureZ _res);
+void CResult_SecretKeyNoneZ_free(struct LDKCResult_SecretKeyNoneZ _res);
/**
- * Creates a new CResult_PaymentIdPaymentSendFailureZ which has the same data as `orig`
+ * Creates a new CResult_SecretKeyNoneZ which has the same data as `orig`
* but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_clone(const struct LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR orig);
+struct LDKCResult_SecretKeyNoneZ CResult_SecretKeyNoneZ_clone(const struct LDKCResult_SecretKeyNoneZ *NONNULL_PTR orig);
/**
- * Creates a new CResult_NonePaymentSendFailureZ in the success state.
+ * Creates a new CResult_SignDecodeErrorZ in the success state.
*/
-struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void);
+struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_ok(struct LDKSign o);
/**
- * Creates a new CResult_NonePaymentSendFailureZ in the error state.
+ * Creates a new CResult_SignDecodeErrorZ in the error state.
*/
-struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
+struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_err(struct LDKDecodeError e);
/**
* Checks if the given object is currently in the success state
*/
-bool CResult_NonePaymentSendFailureZ_is_ok(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR o);
-
-/**
- * Frees any resources used by the CResult_NonePaymentSendFailureZ.
- */
-void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailureZ _res);
+bool CResult_SignDecodeErrorZ_is_ok(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR o);
/**
- * Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
- * but with all dynamically-allocated buffers duplicated in new buffers.
+ * Frees any resources used by the CResult_SignDecodeErrorZ.
*/
-struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_clone(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR orig);
+void CResult_SignDecodeErrorZ_free(struct LDKCResult_SignDecodeErrorZ _res);
/**
- * Creates a new tuple which has the same data as `orig`
+ * Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
* but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_clone(const struct LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR orig);
-
-/**
- * Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
- */
-struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b);
+struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_clone(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR orig);
/**
- * Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
*/
-void C2Tuple_PaymentHashPaymentIdZ_free(struct LDKC2Tuple_PaymentHashPaymentIdZ _res);
+void CVec_u5Z_free(struct LDKCVec_u5Z _res);
/**
- * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
+ * Creates a new CResult_RecoverableSignatureNoneZ in the success state.
*/
-struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(struct LDKC2Tuple_PaymentHashPaymentIdZ o);
+struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_ok(struct LDKRecoverableSignature o);
/**
- * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
+ * Creates a new CResult_RecoverableSignatureNoneZ in the error state.
*/
-struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
+struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_err(void);
/**
* Checks if the given object is currently in the success state
*/
-bool CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR o);
-
-/**
- * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
- */
-void CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res);
-
-/**
- * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
- * but with all dynamically-allocated buffers duplicated in new buffers.
- */
-struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR orig);
+bool CResult_RecoverableSignatureNoneZ_is_ok(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR o);
/**
- * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ * Frees any resources used by the CResult_RecoverableSignatureNoneZ.
*/
-void CVec_NetAddressZ_free(struct LDKCVec_NetAddressZ _res);
+void CResult_RecoverableSignatureNoneZ_free(struct LDKCResult_RecoverableSignatureNoneZ _res);
/**
- * Creates a new tuple which has the same data as `orig`
+ * Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
* but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_clone(const struct LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR orig);
+struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_clone(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR orig);
/**
- * Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
*/
-struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b);
+void CVec_u8Z_free(struct LDKCVec_u8Z _res);
/**
- * Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
*/
-void C2Tuple_PaymentHashPaymentSecretZ_free(struct LDKC2Tuple_PaymentHashPaymentSecretZ _res);
+void CVec_CVec_u8ZZ_free(struct LDKCVec_CVec_u8ZZ _res);
/**
- * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state.
+ * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
*/
-struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(struct LDKC2Tuple_PaymentHashPaymentSecretZ o);
+struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_ok(struct LDKCVec_CVec_u8ZZ o);
/**
- * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state.
+ * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
*/
-struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err(void);
+struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_err(void);
/**
* Checks if the given object is currently in the success state
*/
-bool CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR o);
+bool CResult_CVec_CVec_u8ZZNoneZ_is_ok(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR o);
/**
- * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ.
+ * Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
*/
-void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res);
+void CResult_CVec_CVec_u8ZZNoneZ_free(struct LDKCResult_CVec_CVec_u8ZZNoneZ _res);
/**
- * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig`
+ * Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
* but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR orig);
+struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_clone(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR orig);
/**
- * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state.
+ * Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
*/
-struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(struct LDKC2Tuple_PaymentHashPaymentSecretZ o);
+struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_ok(struct LDKInMemorySigner o);
/**
- * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state.
+ * Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
*/
-struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(struct LDKAPIError e);
+struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_err(struct LDKDecodeError e);
/**
* Checks if the given object is currently in the success state
*/
-bool CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR o);
+bool CResult_InMemorySignerDecodeErrorZ_is_ok(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR o);
/**
- * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.
+ * Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
*/
-void CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res);
+void CResult_InMemorySignerDecodeErrorZ_free(struct LDKCResult_InMemorySignerDecodeErrorZ _res);
/**
- * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig`
+ * Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
* but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR orig);
-
-/**
- * Creates a new CResult_PaymentSecretNoneZ in the success state.
- */
-struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_ok(struct LDKThirtyTwoBytes o);
+struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_clone(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR orig);
/**
- * Creates a new CResult_PaymentSecretNoneZ in the error state.
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
*/
-struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_err(void);
+void CVec_TxOutZ_free(struct LDKCVec_TxOutZ _res);
/**
- * Checks if the given object is currently in the success state
+ * Creates a new CResult_TransactionNoneZ in the success state.
*/
-bool CResult_PaymentSecretNoneZ_is_ok(const struct LDKCResult_PaymentSecretNoneZ *NONNULL_PTR o);
+struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_ok(struct LDKTransaction o);
/**
- * Frees any resources used by the CResult_PaymentSecretNoneZ.
+ * Creates a new CResult_TransactionNoneZ in the error state.
*/
-void CResult_PaymentSecretNoneZ_free(struct LDKCResult_PaymentSecretNoneZ _res);
+struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_err(void);
/**
- * Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig`
- * but with all dynamically-allocated buffers duplicated in new buffers.
+ * Checks if the given object is currently in the success state
*/
-struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_clone(const struct LDKCResult_PaymentSecretNoneZ *NONNULL_PTR orig);
+bool CResult_TransactionNoneZ_is_ok(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR o);
/**
- * Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
+ * Frees any resources used by the CResult_TransactionNoneZ.
*/
-struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_ok(struct LDKThirtyTwoBytes o);
+void CResult_TransactionNoneZ_free(struct LDKCResult_TransactionNoneZ _res);
/**
- * Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
+ * Creates a new CResult_TransactionNoneZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_err(struct LDKAPIError e);
+struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_clone(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR orig);
/**
- * Checks if the given object is currently in the success state
+ * Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
*/
-bool CResult_PaymentSecretAPIErrorZ_is_ok(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR o);
+struct LDKC2Tuple_BlockHashChannelMonitorZ C2Tuple_BlockHashChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b);
/**
- * Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
+ * Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
*/
-void CResult_PaymentSecretAPIErrorZ_free(struct LDKCResult_PaymentSecretAPIErrorZ _res);
+void C2Tuple_BlockHashChannelMonitorZ_free(struct LDKC2Tuple_BlockHashChannelMonitorZ _res);
/**
- * Creates a new CResult_PaymentSecretAPIErrorZ 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_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_clone(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR orig);
+void CVec_C2Tuple_BlockHashChannelMonitorZZ_free(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res);
/**
- * Creates a new CResult_PaymentPreimageAPIErrorZ in the success state.
+ * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
*/
-struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_ok(struct LDKThirtyTwoBytes o);
+struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o);
/**
- * Creates a new CResult_PaymentPreimageAPIErrorZ in the error state.
+ * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
*/
-struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_err(struct LDKAPIError e);
+struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(enum LDKIOError e);
/**
* Checks if the given object is currently in the success state
*/
-bool CResult_PaymentPreimageAPIErrorZ_is_ok(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR o);
+bool CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(const struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR o);
/**
- * Frees any resources used by the CResult_PaymentPreimageAPIErrorZ.
+ * Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
*/
-void CResult_PaymentPreimageAPIErrorZ_free(struct LDKCResult_PaymentPreimageAPIErrorZ _res);
+void CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res);
/**
- * Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig`
- * but with all dynamically-allocated buffers duplicated in new buffers.
+ * Constructs a new COption_u16Z containing a u16
*/
-struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_clone(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR orig);
+struct LDKCOption_u16Z COption_u16Z_some(uint16_t o);
/**
- * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
+ * Constructs a new COption_u16Z containing nothing
*/
-struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(struct LDKCounterpartyForwardingInfo o);
+struct LDKCOption_u16Z COption_u16Z_none(void);
/**
- * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
+ * Frees any resources associated with the u16, if we are in the Some state
*/
-struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_err(struct LDKDecodeError e);
+void COption_u16Z_free(struct LDKCOption_u16Z _res);
/**
- * Checks if the given object is currently in the success state
+ * Creates a new COption_u16Z which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
*/
-bool CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR o);
+struct LDKCOption_u16Z COption_u16Z_clone(const struct LDKCOption_u16Z *NONNULL_PTR orig);
/**
- * Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
+ * Creates a new CResult_NoneAPIErrorZ in the success state.
*/
-void CResult_CounterpartyForwardingInfoDecodeErrorZ_free(struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res);
+struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void);
/**
- * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
- * but with all dynamically-allocated buffers duplicated in new buffers.
+ * Creates a new CResult_NoneAPIErrorZ in the error state.
*/
-struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(const struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR orig);
+struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e);
/**
- * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
+ * Checks if the given object is currently in the success state
*/
-struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_ok(struct LDKChannelCounterparty o);
+bool CResult_NoneAPIErrorZ_is_ok(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR o);
/**
- * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
+ * Frees any resources used by the CResult_NoneAPIErrorZ.
*/
-struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_err(struct LDKDecodeError e);
+void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res);
/**
- * Checks if the given object is currently in the success state
+ * Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
*/
-bool CResult_ChannelCounterpartyDecodeErrorZ_is_ok(const struct LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR o);
+struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR orig);
/**
- * Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
*/
-void CResult_ChannelCounterpartyDecodeErrorZ_free(struct LDKCResult_ChannelCounterpartyDecodeErrorZ _res);
+void CVec_CResult_NoneAPIErrorZZ_free(struct LDKCVec_CResult_NoneAPIErrorZZ _res);
/**
- * Creates a new CResult_ChannelCounterpartyDecodeErrorZ 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_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_clone(const struct LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR orig);
+void CVec_APIErrorZ_free(struct LDKCVec_APIErrorZ _res);
/**
- * Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
+ * Creates a new CResult__u832APIErrorZ in the success state.
*/
-struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_ok(struct LDKChannelDetails o);
+struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_ok(struct LDKThirtyTwoBytes o);
/**
- * Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
+ * Creates a new CResult__u832APIErrorZ in the error state.
*/
-struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_err(struct LDKDecodeError e);
+struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_err(struct LDKAPIError e);
/**
* Checks if the given object is currently in the success state
*/
-bool CResult_ChannelDetailsDecodeErrorZ_is_ok(const struct LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR o);
+bool CResult__u832APIErrorZ_is_ok(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR o);
/**
- * Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
+ * Frees any resources used by the CResult__u832APIErrorZ.
*/
-void CResult_ChannelDetailsDecodeErrorZ_free(struct LDKCResult_ChannelDetailsDecodeErrorZ _res);
+void CResult__u832APIErrorZ_free(struct LDKCResult__u832APIErrorZ _res);
/**
- * Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
+ * Creates a new CResult__u832APIErrorZ which has the same data as `orig`
* but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_clone(const struct LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR orig);
+struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_clone(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR orig);
/**
- * Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
+ * Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state.
*/
-struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_ok(struct LDKPhantomRouteHints o);
+struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_ok(struct LDKThirtyTwoBytes o);
/**
- * Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
+ * Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state.
*/
-struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_err(struct LDKDecodeError e);
+struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
/**
* Checks if the given object is currently in the success state
*/
-bool CResult_PhantomRouteHintsDecodeErrorZ_is_ok(const struct LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR o);
+bool CResult_PaymentIdPaymentSendFailureZ_is_ok(const struct LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR o);
/**
- * Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
+ * Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ.
*/
-void CResult_PhantomRouteHintsDecodeErrorZ_free(struct LDKCResult_PhantomRouteHintsDecodeErrorZ _res);
+void CResult_PaymentIdPaymentSendFailureZ_free(struct LDKCResult_PaymentIdPaymentSendFailureZ _res);
/**
- * Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig`
+ * Creates a new CResult_PaymentIdPaymentSendFailureZ which has the same data as `orig`
* but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_clone(const struct LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR orig);
+struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_clone(const struct LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR orig);
/**
- * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ * Creates a new CResult_NonePaymentSendFailureZ in the success state.
*/
-void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res);
+struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void);
/**
- * Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
+ * Creates a new CResult_NonePaymentSendFailureZ in the error state.
*/
-struct LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b);
+struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
/**
- * Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
+ * Checks if the given object is currently in the success state
*/
-void C2Tuple_BlockHashChannelManagerZ_free(struct LDKC2Tuple_BlockHashChannelManagerZ _res);
+bool CResult_NonePaymentSendFailureZ_is_ok(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR o);
/**
- * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
+ * Frees any resources used by the CResult_NonePaymentSendFailureZ.
*/
-struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelManagerZ o);
+void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailureZ _res);
/**
- * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
+ * Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e);
+struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_clone(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR orig);
/**
- * Checks if the given object is currently in the success state
+ * Creates a new tuple which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
*/
-bool CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR o);
+struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_clone(const struct LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR orig);
/**
- * Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
+ * Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
*/
-void CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res);
+struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b);
/**
- * Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
+ * Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
*/
-struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_ok(struct LDKChannelConfig o);
+void C2Tuple_PaymentHashPaymentIdZ_free(struct LDKC2Tuple_PaymentHashPaymentIdZ _res);
/**
- * Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
+ * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
*/
-struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_err(struct LDKDecodeError e);
+struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(struct LDKC2Tuple_PaymentHashPaymentIdZ o);
+
+/**
+ * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
+ */
+struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
/**
* Checks if the given object is currently in the success state
*/
-bool CResult_ChannelConfigDecodeErrorZ_is_ok(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR o);
+bool CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR o);
/**
- * Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
+ * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
*/
-void CResult_ChannelConfigDecodeErrorZ_free(struct LDKCResult_ChannelConfigDecodeErrorZ _res);
+void CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res);
/**
- * Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
+ * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
* but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_clone(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR orig);
+struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR orig);
/**
- * Creates a new CResult_OutPointDecodeErrorZ in the success state.
+ * Creates a new tuple which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_ok(struct LDKOutPoint o);
+struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_clone(const struct LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR orig);
/**
- * Creates a new CResult_OutPointDecodeErrorZ in the error state.
+ * Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
*/
-struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_err(struct LDKDecodeError e);
+struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b);
+
+/**
+ * Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
+ */
+void C2Tuple_PaymentHashPaymentSecretZ_free(struct LDKC2Tuple_PaymentHashPaymentSecretZ _res);
/**
- * Checks if the given object is currently in the success state
+ * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state.
*/
-bool CResult_OutPointDecodeErrorZ_is_ok(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR o);
+struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(struct LDKC2Tuple_PaymentHashPaymentSecretZ o);
/**
- * Frees any resources used by the CResult_OutPointDecodeErrorZ.
+ * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state.
*/
-void CResult_OutPointDecodeErrorZ_free(struct LDKCResult_OutPointDecodeErrorZ _res);
+struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err(void);
/**
- * Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
- * but with all dynamically-allocated buffers duplicated in new buffers.
+ * Checks if the given object is currently in the success state
*/
-struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_clone(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR orig);
+bool CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR o);
/**
- * Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
+ * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ.
*/
-struct LDKCOption_TypeZ COption_TypeZ_some(struct LDKType o);
+void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res);
/**
- * Constructs a new COption_TypeZ containing nothing
+ * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCOption_TypeZ COption_TypeZ_none(void);
+struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR orig);
/**
- * Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
+ * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state.
*/
-void COption_TypeZ_free(struct LDKCOption_TypeZ _res);
+struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(struct LDKC2Tuple_PaymentHashPaymentSecretZ o);
/**
- * Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
+ * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state.
*/
-struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_ok(struct LDKCOption_TypeZ o);
+struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(struct LDKAPIError e);
/**
- * Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
+ * Checks if the given object is currently in the success state
*/
-struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_err(struct LDKDecodeError e);
+bool CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR o);
/**
- * Checks if the given object is currently in the success state
+ * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.
*/
-bool CResult_COption_TypeZDecodeErrorZ_is_ok(const struct LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR o);
+void CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res);
/**
- * Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
+ * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
*/
-void CResult_COption_TypeZDecodeErrorZ_free(struct LDKCResult_COption_TypeZDecodeErrorZ _res);
+struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR orig);
/**
- * Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
+ * Creates a new CResult_PaymentSecretNoneZ in the success state.
*/
-struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_ok(struct LDKThirtyTwoBytes o);
+struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_ok(struct LDKThirtyTwoBytes o);
/**
- * Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
+ * Creates a new CResult_PaymentSecretNoneZ in the error state.
*/
-struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_err(struct LDKPaymentError e);
+struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_err(void);
/**
* Checks if the given object is currently in the success state
*/
-bool CResult_PaymentIdPaymentErrorZ_is_ok(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR o);
+bool CResult_PaymentSecretNoneZ_is_ok(const struct LDKCResult_PaymentSecretNoneZ *NONNULL_PTR o);
/**
- * Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
+ * Frees any resources used by the CResult_PaymentSecretNoneZ.
*/
-void CResult_PaymentIdPaymentErrorZ_free(struct LDKCResult_PaymentIdPaymentErrorZ _res);
+void CResult_PaymentSecretNoneZ_free(struct LDKCResult_PaymentSecretNoneZ _res);
/**
- * Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
+ * Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig`
* but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_clone(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR orig);
+struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_clone(const struct LDKCResult_PaymentSecretNoneZ *NONNULL_PTR orig);
/**
- * Creates a new CResult_SiPrefixParseErrorZ in the success state.
+ * Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
*/
-struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_ok(enum LDKSiPrefix o);
+struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_ok(struct LDKThirtyTwoBytes o);
/**
- * Creates a new CResult_SiPrefixParseErrorZ in the error state.
+ * Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
*/
-struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_err(struct LDKParseError e);
+struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_err(struct LDKAPIError e);
/**
* Checks if the given object is currently in the success state
*/
-bool CResult_SiPrefixParseErrorZ_is_ok(const struct LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR o);
+bool CResult_PaymentSecretAPIErrorZ_is_ok(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR o);
/**
- * Frees any resources used by the CResult_SiPrefixParseErrorZ.
+ * Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
*/
-void CResult_SiPrefixParseErrorZ_free(struct LDKCResult_SiPrefixParseErrorZ _res);
+void CResult_PaymentSecretAPIErrorZ_free(struct LDKCResult_PaymentSecretAPIErrorZ _res);
/**
- * Creates a new CResult_SiPrefixParseErrorZ which has the same data as `orig`
+ * Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
* but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_clone(const struct LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR orig);
+struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_clone(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR orig);
/**
- * Creates a new CResult_InvoiceParseOrSemanticErrorZ in the success state.
+ * Creates a new CResult_PaymentPreimageAPIErrorZ in the success state.
*/
-struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_ok(struct LDKInvoice o);
+struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_ok(struct LDKThirtyTwoBytes o);
/**
- * Creates a new CResult_InvoiceParseOrSemanticErrorZ in the error state.
+ * Creates a new CResult_PaymentPreimageAPIErrorZ in the error state.
*/
-struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_err(struct LDKParseOrSemanticError e);
+struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_err(struct LDKAPIError e);
/**
* Checks if the given object is currently in the success state
*/
-bool CResult_InvoiceParseOrSemanticErrorZ_is_ok(const struct LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR o);
+bool CResult_PaymentPreimageAPIErrorZ_is_ok(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR o);
/**
- * Frees any resources used by the CResult_InvoiceParseOrSemanticErrorZ.
+ * Frees any resources used by the CResult_PaymentPreimageAPIErrorZ.
*/
-void CResult_InvoiceParseOrSemanticErrorZ_free(struct LDKCResult_InvoiceParseOrSemanticErrorZ _res);
+void CResult_PaymentPreimageAPIErrorZ_free(struct LDKCResult_PaymentPreimageAPIErrorZ _res);
/**
- * Creates a new CResult_InvoiceParseOrSemanticErrorZ which has the same data as `orig`
+ * Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig`
* but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_clone(const struct LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR orig);
+struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_clone(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR orig);
/**
- * Creates a new CResult_SignedRawInvoiceParseErrorZ in the success state.
+ * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
*/
-struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_ok(struct LDKSignedRawInvoice o);
+struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(struct LDKCounterpartyForwardingInfo o);
/**
- * Creates a new CResult_SignedRawInvoiceParseErrorZ in the error state.
+ * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
*/
-struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_err(struct LDKParseError e);
+struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_err(struct LDKDecodeError e);
/**
* Checks if the given object is currently in the success state
*/
-bool CResult_SignedRawInvoiceParseErrorZ_is_ok(const struct LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR o);
+bool CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR o);
/**
- * Frees any resources used by the CResult_SignedRawInvoiceParseErrorZ.
+ * Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
*/
-void CResult_SignedRawInvoiceParseErrorZ_free(struct LDKCResult_SignedRawInvoiceParseErrorZ _res);
+void CResult_CounterpartyForwardingInfoDecodeErrorZ_free(struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res);
/**
- * Creates a new CResult_SignedRawInvoiceParseErrorZ which has the same data as `orig`
+ * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
* but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_clone(const struct LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR orig);
+struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(const struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR orig);
/**
- * Creates a new tuple which has the same data as `orig`
- * but with all dynamically-allocated buffers duplicated in new buffers.
+ * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
*/
-struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(const struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR orig);
+struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_ok(struct LDKChannelCounterparty o);
/**
- * Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
+ * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
*/
-struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(struct LDKRawInvoice a, struct LDKThirtyTwoBytes b, struct LDKInvoiceSignature c);
+struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_err(struct LDKDecodeError e);
/**
- * Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
+ * Checks if the given object is currently in the success state
*/
-void C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res);
+bool CResult_ChannelCounterpartyDecodeErrorZ_is_ok(const struct LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR o);
/**
- * Creates a new CResult_PayeePubKeyErrorZ in the success state.
+ * Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
*/
-struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_ok(struct LDKPayeePubKey o);
+void CResult_ChannelCounterpartyDecodeErrorZ_free(struct LDKCResult_ChannelCounterpartyDecodeErrorZ _res);
/**
- * Creates a new CResult_PayeePubKeyErrorZ in the error state.
+ * Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_err(enum LDKSecp256k1Error e);
+struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_clone(const struct LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR orig);
/**
- * Checks if the given object is currently in the success state
+ * Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
*/
-bool CResult_PayeePubKeyErrorZ_is_ok(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR o);
+struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_ok(struct LDKChannelDetails o);
/**
- * Frees any resources used by the CResult_PayeePubKeyErrorZ.
+ * Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
*/
-void CResult_PayeePubKeyErrorZ_free(struct LDKCResult_PayeePubKeyErrorZ _res);
+struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_err(struct LDKDecodeError e);
/**
- * Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
- * but with all dynamically-allocated buffers duplicated in new buffers.
+ * Checks if the given object is currently in the success state
*/
-struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_clone(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR orig);
+bool CResult_ChannelDetailsDecodeErrorZ_is_ok(const struct LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR o);
/**
- * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ * Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
*/
-void CVec_PrivateRouteZ_free(struct LDKCVec_PrivateRouteZ _res);
+void CResult_ChannelDetailsDecodeErrorZ_free(struct LDKCResult_ChannelDetailsDecodeErrorZ _res);
/**
- * Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
+ * Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_ok(struct LDKPositiveTimestamp o);
+struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_clone(const struct LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR orig);
/**
- * Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
+ * Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
*/
-struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_err(enum LDKCreationError e);
+struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_ok(struct LDKPhantomRouteHints o);
+
+/**
+ * Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
+ */
+struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_err(struct LDKDecodeError e);
/**
* Checks if the given object is currently in the success state
*/
-bool CResult_PositiveTimestampCreationErrorZ_is_ok(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR o);
+bool CResult_PhantomRouteHintsDecodeErrorZ_is_ok(const struct LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR o);
/**
- * Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
+ * Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
*/
-void CResult_PositiveTimestampCreationErrorZ_free(struct LDKCResult_PositiveTimestampCreationErrorZ _res);
+void CResult_PhantomRouteHintsDecodeErrorZ_free(struct LDKCResult_PhantomRouteHintsDecodeErrorZ _res);
/**
- * Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
+ * Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig`
* but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_clone(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR orig);
+struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_clone(const struct LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR orig);
/**
- * Creates a new CResult_NoneSemanticErrorZ in the success state.
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
*/
-struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_ok(void);
+void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res);
/**
- * Creates a new CResult_NoneSemanticErrorZ in the error state.
+ * Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
*/
-struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_err(enum LDKSemanticError e);
+struct LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b);
/**
- * Checks if the given object is currently in the success state
+ * Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
*/
-bool CResult_NoneSemanticErrorZ_is_ok(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR o);
+void C2Tuple_BlockHashChannelManagerZ_free(struct LDKC2Tuple_BlockHashChannelManagerZ _res);
/**
- * Frees any resources used by the CResult_NoneSemanticErrorZ.
+ * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
*/
-void CResult_NoneSemanticErrorZ_free(struct LDKCResult_NoneSemanticErrorZ _res);
+struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelManagerZ o);
/**
- * Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
- * but with all dynamically-allocated buffers duplicated in new buffers.
+ * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
*/
-struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_clone(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR orig);
+struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e);
/**
- * Creates a new CResult_InvoiceSemanticErrorZ in the success state.
+ * Checks if the given object is currently in the success state
*/
-struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_ok(struct LDKInvoice o);
+bool CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR o);
/**
- * Creates a new CResult_InvoiceSemanticErrorZ in the error state.
+ * Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
*/
-struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_err(enum LDKSemanticError e);
+void CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res);
/**
- * Checks if the given object is currently in the success state
+ * Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
*/
-bool CResult_InvoiceSemanticErrorZ_is_ok(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR o);
+struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_ok(struct LDKChannelConfig o);
/**
- * Frees any resources used by the CResult_InvoiceSemanticErrorZ.
+ * Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
*/
-void CResult_InvoiceSemanticErrorZ_free(struct LDKCResult_InvoiceSemanticErrorZ _res);
+struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_err(struct LDKDecodeError e);
/**
- * Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
- * but with all dynamically-allocated buffers duplicated in new buffers.
+ * Checks if the given object is currently in the success state
*/
-struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_clone(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR orig);
+bool CResult_ChannelConfigDecodeErrorZ_is_ok(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR o);
/**
- * Creates a new CResult_DescriptionCreationErrorZ in the success state.
+ * Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
*/
-struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_ok(struct LDKDescription o);
+void CResult_ChannelConfigDecodeErrorZ_free(struct LDKCResult_ChannelConfigDecodeErrorZ _res);
/**
- * Creates a new CResult_DescriptionCreationErrorZ in the error state.
+ * Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_err(enum LDKCreationError e);
+struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_clone(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR orig);
/**
- * Checks if the given object is currently in the success state
+ * Creates a new CResult_OutPointDecodeErrorZ in the success state.
*/
-bool CResult_DescriptionCreationErrorZ_is_ok(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR o);
+struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_ok(struct LDKOutPoint o);
/**
- * Frees any resources used by the CResult_DescriptionCreationErrorZ.
+ * Creates a new CResult_OutPointDecodeErrorZ in the error state.
*/
-void CResult_DescriptionCreationErrorZ_free(struct LDKCResult_DescriptionCreationErrorZ _res);
+struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_err(struct LDKDecodeError e);
/**
- * Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
- * but with all dynamically-allocated buffers duplicated in new buffers.
+ * Checks if the given object is currently in the success state
*/
-struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_clone(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR orig);
+bool CResult_OutPointDecodeErrorZ_is_ok(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR o);
/**
- * Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
+ * Frees any resources used by the CResult_OutPointDecodeErrorZ.
*/
-struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_ok(struct LDKPrivateRoute o);
+void CResult_OutPointDecodeErrorZ_free(struct LDKCResult_OutPointDecodeErrorZ _res);
/**
- * Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
+ * Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_err(enum LDKCreationError e);
+struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_clone(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR orig);
/**
- * Checks if the given object is currently in the success state
+ * Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
*/
-bool CResult_PrivateRouteCreationErrorZ_is_ok(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR o);
+struct LDKCOption_TypeZ COption_TypeZ_some(struct LDKType o);
/**
- * Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
+ * Constructs a new COption_TypeZ containing nothing
*/
-void CResult_PrivateRouteCreationErrorZ_free(struct LDKCResult_PrivateRouteCreationErrorZ _res);
+struct LDKCOption_TypeZ COption_TypeZ_none(void);
/**
- * Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
- * but with all dynamically-allocated buffers duplicated in new buffers.
+ * Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
*/
-struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_clone(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR orig);
+void COption_TypeZ_free(struct LDKCOption_TypeZ _res);
/**
- * Creates a new CResult_StringErrorZ in the success state.
+ * Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
*/
-struct LDKCResult_StringErrorZ CResult_StringErrorZ_ok(struct LDKStr o);
+struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_ok(struct LDKCOption_TypeZ o);
/**
- * Creates a new CResult_StringErrorZ in the error state.
+ * Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
*/
-struct LDKCResult_StringErrorZ CResult_StringErrorZ_err(enum LDKSecp256k1Error e);
+struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_err(struct LDKDecodeError e);
/**
* Checks if the given object is currently in the success state
*/
-bool CResult_StringErrorZ_is_ok(const struct LDKCResult_StringErrorZ *NONNULL_PTR o);
+bool CResult_COption_TypeZDecodeErrorZ_is_ok(const struct LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR o);
/**
- * Frees any resources used by the CResult_StringErrorZ.
+ * Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
*/
-void CResult_StringErrorZ_free(struct LDKCResult_StringErrorZ _res);
+void CResult_COption_TypeZDecodeErrorZ_free(struct LDKCResult_COption_TypeZDecodeErrorZ _res);
/**
- * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
+ * Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
*/
-struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o);
+struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_ok(struct LDKThirtyTwoBytes o);
/**
- * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
+ * Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
*/
-struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e);
+struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_err(struct LDKPaymentError e);
/**
* Checks if the given object is currently in the success state
*/
-bool CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR o);
+bool CResult_PaymentIdPaymentErrorZ_is_ok(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR o);
/**
- * Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
+ * Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
*/
-void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res);
+void CResult_PaymentIdPaymentErrorZ_free(struct LDKCResult_PaymentIdPaymentErrorZ _res);
/**
- * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
+ * Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
* but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR orig);
+struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_clone(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR orig);
/**
- * Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
+ * Creates a new CResult_SiPrefixParseErrorZ in the success state.
*/
-struct LDKCOption_MonitorEventZ COption_MonitorEventZ_some(struct LDKMonitorEvent o);
+struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_ok(enum LDKSiPrefix o);
/**
- * Constructs a new COption_MonitorEventZ containing nothing
+ * Creates a new CResult_SiPrefixParseErrorZ in the error state.
*/
-struct LDKCOption_MonitorEventZ COption_MonitorEventZ_none(void);
+struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_err(struct LDKParseError e);
/**
- * Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
+ * Checks if the given object is currently in the success state
*/
-void COption_MonitorEventZ_free(struct LDKCOption_MonitorEventZ _res);
+bool CResult_SiPrefixParseErrorZ_is_ok(const struct LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR o);
/**
- * Creates a new COption_MonitorEventZ which has the same data as `orig`
+ * Frees any resources used by the CResult_SiPrefixParseErrorZ.
+ */
+void CResult_SiPrefixParseErrorZ_free(struct LDKCResult_SiPrefixParseErrorZ _res);
+
+/**
+ * Creates a new CResult_SiPrefixParseErrorZ which has the same data as `orig`
* but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCOption_MonitorEventZ COption_MonitorEventZ_clone(const struct LDKCOption_MonitorEventZ *NONNULL_PTR orig);
+struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_clone(const struct LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR orig);
/**
- * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
+ * Creates a new CResult_InvoiceParseOrSemanticErrorZ in the success state.
*/
-struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_ok(struct LDKCOption_MonitorEventZ o);
+struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_ok(struct LDKInvoice o);
/**
- * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
+ * Creates a new CResult_InvoiceParseOrSemanticErrorZ in the error state.
*/
-struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_err(struct LDKDecodeError e);
+struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_err(struct LDKParseOrSemanticError e);
/**
* Checks if the given object is currently in the success state
*/
-bool CResult_COption_MonitorEventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR o);
+bool CResult_InvoiceParseOrSemanticErrorZ_is_ok(const struct LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR o);
/**
- * Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
+ * Frees any resources used by the CResult_InvoiceParseOrSemanticErrorZ.
*/
-void CResult_COption_MonitorEventZDecodeErrorZ_free(struct LDKCResult_COption_MonitorEventZDecodeErrorZ _res);
+void CResult_InvoiceParseOrSemanticErrorZ_free(struct LDKCResult_InvoiceParseOrSemanticErrorZ _res);
/**
- * Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
+ * Creates a new CResult_InvoiceParseOrSemanticErrorZ which has the same data as `orig`
* but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_clone(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR orig);
+struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_clone(const struct LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR orig);
/**
- * Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
+ * Creates a new CResult_SignedRawInvoiceParseErrorZ in the success state.
*/
-struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_ok(struct LDKHTLCUpdate o);
+struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_ok(struct LDKSignedRawInvoice o);
/**
- * Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
+ * Creates a new CResult_SignedRawInvoiceParseErrorZ in the error state.
*/
-struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_err(struct LDKDecodeError e);
+struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_err(struct LDKParseError e);
/**
* Checks if the given object is currently in the success state
*/
-bool CResult_HTLCUpdateDecodeErrorZ_is_ok(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR o);
+bool CResult_SignedRawInvoiceParseErrorZ_is_ok(const struct LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR o);
/**
- * Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
+ * Frees any resources used by the CResult_SignedRawInvoiceParseErrorZ.
*/
-void CResult_HTLCUpdateDecodeErrorZ_free(struct LDKCResult_HTLCUpdateDecodeErrorZ _res);
+void CResult_SignedRawInvoiceParseErrorZ_free(struct LDKCResult_SignedRawInvoiceParseErrorZ _res);
/**
- * Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
+ * Creates a new CResult_SignedRawInvoiceParseErrorZ which has the same data as `orig`
* but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_clone(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR orig);
+struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_clone(const struct LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR orig);
/**
* Creates a new tuple which has the same data as `orig`
* but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_clone(const struct LDKC2Tuple_OutPointScriptZ *NONNULL_PTR orig);
+struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(const struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR orig);
/**
- * Creates a new C2Tuple_OutPointScriptZ from the contained elements.
+ * Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
*/
-struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b);
+struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(struct LDKRawInvoice a, struct LDKThirtyTwoBytes b, struct LDKInvoiceSignature c);
/**
- * Frees any resources used by the C2Tuple_OutPointScriptZ.
+ * Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
*/
-void C2Tuple_OutPointScriptZ_free(struct LDKC2Tuple_OutPointScriptZ _res);
+void C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res);
/**
- * Creates a new tuple which has the same data as `orig`
- * but with all dynamically-allocated buffers duplicated in new buffers.
+ * Creates a new CResult_PayeePubKeyErrorZ in the success state.
*/
-struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_clone(const struct LDKC2Tuple_u32ScriptZ *NONNULL_PTR orig);
+struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_ok(struct LDKPayeePubKey o);
/**
- * Creates a new C2Tuple_u32ScriptZ from the contained elements.
+ * Creates a new CResult_PayeePubKeyErrorZ in the error state.
*/
-struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_new(uint32_t a, struct LDKCVec_u8Z b);
+struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_err(enum LDKSecp256k1Error e);
/**
- * Frees any resources used by the C2Tuple_u32ScriptZ.
+ * Checks if the given object is currently in the success state
*/
-void C2Tuple_u32ScriptZ_free(struct LDKC2Tuple_u32ScriptZ _res);
+bool CResult_PayeePubKeyErrorZ_is_ok(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR o);
/**
- * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ * Frees any resources used by the CResult_PayeePubKeyErrorZ.
*/
-void CVec_C2Tuple_u32ScriptZZ_free(struct LDKCVec_C2Tuple_u32ScriptZZ _res);
+void CResult_PayeePubKeyErrorZ_free(struct LDKCResult_PayeePubKeyErrorZ _res);
/**
- * Creates a new tuple which has the same data as `orig`
+ * Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
* but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR orig);
+struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_clone(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR orig);
/**
- * Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
*/
-struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32ScriptZZ b);
+void CVec_PrivateRouteZ_free(struct LDKCVec_PrivateRouteZ _res);
/**
- * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
+ * Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
*/
-void C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res);
+struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_ok(struct LDKPositiveTimestamp o);
/**
- * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ * Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
*/
-void CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res);
+struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_err(enum LDKCreationError e);
/**
- * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ * Checks if the given object is currently in the success state
*/
-void CVec_EventZ_free(struct LDKCVec_EventZ _res);
+bool CResult_PositiveTimestampCreationErrorZ_is_ok(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR o);
/**
- * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ * Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
*/
-void CVec_TransactionZ_free(struct LDKCVec_TransactionZ _res);
+void CResult_PositiveTimestampCreationErrorZ_free(struct LDKCResult_PositiveTimestampCreationErrorZ _res);
/**
- * Creates a new tuple which has the same data as `orig`
+ * Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
* but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_clone(const struct LDKC2Tuple_u32TxOutZ *NONNULL_PTR orig);
+struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_clone(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR orig);
/**
- * Creates a new C2Tuple_u32TxOutZ from the contained elements.
+ * Creates a new CResult_NoneSemanticErrorZ in the success state.
*/
-struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b);
+struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_ok(void);
/**
- * Frees any resources used by the C2Tuple_u32TxOutZ.
+ * Creates a new CResult_NoneSemanticErrorZ in the error state.
*/
-void C2Tuple_u32TxOutZ_free(struct LDKC2Tuple_u32TxOutZ _res);
+struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_err(enum LDKSemanticError e);
/**
- * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ * Checks if the given object is currently in the success state
*/
-void CVec_C2Tuple_u32TxOutZZ_free(struct LDKCVec_C2Tuple_u32TxOutZZ _res);
+bool CResult_NoneSemanticErrorZ_is_ok(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR o);
/**
- * Creates a new tuple which has the same data as `orig`
- * but with all dynamically-allocated buffers duplicated in new buffers.
+ * Frees any resources used by the CResult_NoneSemanticErrorZ.
*/
-struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR orig);
+void CResult_NoneSemanticErrorZ_free(struct LDKCResult_NoneSemanticErrorZ _res);
/**
- * Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
+ * Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b);
+struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_clone(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR orig);
/**
- * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
+ * Creates a new CResult_InvoiceSemanticErrorZ in the success state.
*/
-void C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res);
+struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_ok(struct LDKInvoice o);
/**
- * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ * Creates a new CResult_InvoiceSemanticErrorZ in the error state.
*/
-void CVec_TransactionOutputsZ_free(struct LDKCVec_TransactionOutputsZ _res);
+struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_err(enum LDKSemanticError e);
/**
- * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ * Checks if the given object is currently in the success state
*/
-void CVec_BalanceZ_free(struct LDKCVec_BalanceZ _res);
+bool CResult_InvoiceSemanticErrorZ_is_ok(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR o);
/**
- * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
+ * Frees any resources used by the CResult_InvoiceSemanticErrorZ.
*/
-struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelMonitorZ o);
+void CResult_InvoiceSemanticErrorZ_free(struct LDKCResult_InvoiceSemanticErrorZ _res);
/**
- * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
+ * Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e);
+struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_clone(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR orig);
/**
- * Checks if the given object is currently in the success state
+ * Creates a new CResult_DescriptionCreationErrorZ in the success state.
*/
-bool CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR o);
+struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_ok(struct LDKDescription o);
/**
- * Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
+ * Creates a new CResult_DescriptionCreationErrorZ in the error state.
*/
-void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res);
+struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_err(enum LDKCreationError e);
/**
- * Creates a new CResult_NoneLightningErrorZ in the success state.
+ * Checks if the given object is currently in the success state
*/
-struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void);
+bool CResult_DescriptionCreationErrorZ_is_ok(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR o);
/**
- * Creates a new CResult_NoneLightningErrorZ in the error state.
+ * Frees any resources used by the CResult_DescriptionCreationErrorZ.
*/
-struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e);
+void CResult_DescriptionCreationErrorZ_free(struct LDKCResult_DescriptionCreationErrorZ _res);
/**
- * Checks if the given object is currently in the success state
+ * Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
*/
-bool CResult_NoneLightningErrorZ_is_ok(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR o);
+struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_clone(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR orig);
/**
- * Frees any resources used by the CResult_NoneLightningErrorZ.
+ * Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
*/
-void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res);
+struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_ok(struct LDKPrivateRoute o);
/**
- * Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
- * but with all dynamically-allocated buffers duplicated in new buffers.
+ * Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
*/
-struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_clone(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR orig);
+struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_err(enum LDKCreationError e);
/**
- * Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
+ * Checks if the given object is currently in the success state
*/
-struct LDKC2Tuple_PublicKeyTypeZ C2Tuple_PublicKeyTypeZ_new(struct LDKPublicKey a, struct LDKType b);
+bool CResult_PrivateRouteCreationErrorZ_is_ok(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR o);
/**
- * Frees any resources used by the C2Tuple_PublicKeyTypeZ.
+ * Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
*/
-void C2Tuple_PublicKeyTypeZ_free(struct LDKC2Tuple_PublicKeyTypeZ _res);
+void CResult_PrivateRouteCreationErrorZ_free(struct LDKCResult_PrivateRouteCreationErrorZ _res);
/**
- * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ * Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
*/
-void CVec_C2Tuple_PublicKeyTypeZZ_free(struct LDKCVec_C2Tuple_PublicKeyTypeZZ _res);
+struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_clone(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR orig);
/**
- * Creates a new CResult_boolLightningErrorZ in the success state.
+ * Creates a new CResult_StringErrorZ in the success state.
*/
-struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o);
+struct LDKCResult_StringErrorZ CResult_StringErrorZ_ok(struct LDKStr o);
/**
- * Creates a new CResult_boolLightningErrorZ in the error state.
+ * Creates a new CResult_StringErrorZ in the error state.
*/
-struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e);
+struct LDKCResult_StringErrorZ CResult_StringErrorZ_err(enum LDKSecp256k1Error e);
/**
* Checks if the given object is currently in the success state
*/
-bool CResult_boolLightningErrorZ_is_ok(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR o);
-
-/**
- * Frees any resources used by the CResult_boolLightningErrorZ.
- */
-void CResult_boolLightningErrorZ_free(struct LDKCResult_boolLightningErrorZ _res);
+bool CResult_StringErrorZ_is_ok(const struct LDKCResult_StringErrorZ *NONNULL_PTR o);
/**
- * Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
- * but with all dynamically-allocated buffers duplicated in new buffers.
+ * Frees any resources used by the CResult_StringErrorZ.
*/
-struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_clone(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR orig);
+void CResult_StringErrorZ_free(struct LDKCResult_StringErrorZ _res);
/**
- * Creates a new tuple which has the same data as `orig`
+ * Creates a new CResult_StringErrorZ which has the same data as `orig`
* but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(const struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR orig);
+struct LDKCResult_StringErrorZ CResult_StringErrorZ_clone(const struct LDKCResult_StringErrorZ *NONNULL_PTR orig);
/**
- * Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
+ * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
*/
-struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c);
+struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o);
/**
- * Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
+ * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
*/
-void C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res);
+struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e);
/**
- * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ * Checks if the given object is currently in the success state
*/
-void CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res);
+bool CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR o);
/**
- * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ * Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
*/
-void CVec_NodeAnnouncementZ_free(struct LDKCVec_NodeAnnouncementZ _res);
+void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res);
/**
- * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
*/
-void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res);
+struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR orig);
/**
- * Constructs a new COption_NetAddressZ containing a crate::lightning::ln::msgs::NetAddress
+ * Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
*/
-struct LDKCOption_NetAddressZ COption_NetAddressZ_some(struct LDKNetAddress o);
+struct LDKCOption_MonitorEventZ COption_MonitorEventZ_some(struct LDKMonitorEvent o);
/**
- * Constructs a new COption_NetAddressZ containing nothing
+ * Constructs a new COption_MonitorEventZ containing nothing
*/
-struct LDKCOption_NetAddressZ COption_NetAddressZ_none(void);
+struct LDKCOption_MonitorEventZ COption_MonitorEventZ_none(void);
/**
- * Frees any resources associated with the crate::lightning::ln::msgs::NetAddress, if we are in the Some state
+ * Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
*/
-void COption_NetAddressZ_free(struct LDKCOption_NetAddressZ _res);
+void COption_MonitorEventZ_free(struct LDKCOption_MonitorEventZ _res);
/**
- * Creates a new COption_NetAddressZ which has the same data as `orig`
+ * Creates a new COption_MonitorEventZ which has the same data as `orig`
* but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCOption_NetAddressZ COption_NetAddressZ_clone(const struct LDKCOption_NetAddressZ *NONNULL_PTR orig);
+struct LDKCOption_MonitorEventZ COption_MonitorEventZ_clone(const struct LDKCOption_MonitorEventZ *NONNULL_PTR orig);
/**
- * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
+ * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
*/
-struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o);
+struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_ok(struct LDKCOption_MonitorEventZ o);
/**
- * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
+ * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
*/
-struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e);
+struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_err(struct LDKDecodeError e);
/**
* Checks if the given object is currently in the success state
*/
-bool CResult_CVec_u8ZPeerHandleErrorZ_is_ok(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR o);
+bool CResult_COption_MonitorEventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR o);
/**
- * Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
+ * Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
*/
-void CResult_CVec_u8ZPeerHandleErrorZ_free(struct LDKCResult_CVec_u8ZPeerHandleErrorZ _res);
+void CResult_COption_MonitorEventZDecodeErrorZ_free(struct LDKCResult_COption_MonitorEventZDecodeErrorZ _res);
/**
- * Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
+ * Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
* but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_clone(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR orig);
+struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_clone(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR orig);
/**
- * Creates a new CResult_NonePeerHandleErrorZ in the success state.
+ * Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
*/
-struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void);
+struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_ok(struct LDKHTLCUpdate o);
/**
- * Creates a new CResult_NonePeerHandleErrorZ in the error state.
+ * Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
*/
-struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e);
+struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_err(struct LDKDecodeError e);
/**
* Checks if the given object is currently in the success state
*/
-bool CResult_NonePeerHandleErrorZ_is_ok(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR o);
+bool CResult_HTLCUpdateDecodeErrorZ_is_ok(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR o);
/**
- * Frees any resources used by the CResult_NonePeerHandleErrorZ.
+ * Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
*/
-void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res);
+void CResult_HTLCUpdateDecodeErrorZ_free(struct LDKCResult_HTLCUpdateDecodeErrorZ _res);
/**
- * Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
+ * Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
* but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_clone(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR orig);
-
-/**
- * Creates a new CResult_boolPeerHandleErrorZ in the success state.
- */
-struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o);
+struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_clone(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR orig);
/**
- * Creates a new CResult_boolPeerHandleErrorZ 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_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e);
+struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_clone(const struct LDKC2Tuple_OutPointScriptZ *NONNULL_PTR orig);
/**
- * Checks if the given object is currently in the success state
+ * Creates a new C2Tuple_OutPointScriptZ from the contained elements.
*/
-bool CResult_boolPeerHandleErrorZ_is_ok(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR o);
+struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b);
/**
- * Frees any resources used by the CResult_boolPeerHandleErrorZ.
+ * Frees any resources used by the C2Tuple_OutPointScriptZ.
*/
-void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _res);
+void C2Tuple_OutPointScriptZ_free(struct LDKC2Tuple_OutPointScriptZ _res);
/**
- * Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
+ * Creates a new tuple which has the same data as `orig`
* but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_clone(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR orig);
+struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_clone(const struct LDKC2Tuple_u32ScriptZ *NONNULL_PTR orig);
/**
- * Creates a new CResult_NodeIdDecodeErrorZ in the success state.
+ * Creates a new C2Tuple_u32ScriptZ from the contained elements.
*/
-struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_ok(struct LDKNodeId o);
+struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_new(uint32_t a, struct LDKCVec_u8Z b);
/**
- * Creates a new CResult_NodeIdDecodeErrorZ in the error state.
+ * Frees any resources used by the C2Tuple_u32ScriptZ.
*/
-struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_err(struct LDKDecodeError e);
+void C2Tuple_u32ScriptZ_free(struct LDKC2Tuple_u32ScriptZ _res);
/**
- * Checks if the given object is currently in the success state
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
*/
-bool CResult_NodeIdDecodeErrorZ_is_ok(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR o);
+void CVec_C2Tuple_u32ScriptZZ_free(struct LDKCVec_C2Tuple_u32ScriptZZ _res);
/**
- * Frees any resources used by the CResult_NodeIdDecodeErrorZ.
+ * Creates a new tuple which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
*/
-void CResult_NodeIdDecodeErrorZ_free(struct LDKCResult_NodeIdDecodeErrorZ _res);
+struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR orig);
/**
- * Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
- * but with all dynamically-allocated buffers duplicated in new buffers.
+ * Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
*/
-struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_clone(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR orig);
+struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32ScriptZZ b);
/**
- * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
+ * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
*/
-struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_ok(struct LDKCOption_NetworkUpdateZ o);
+void C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res);
/**
- * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
*/
-struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_err(struct LDKDecodeError e);
+void CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res);
/**
- * Checks if the given object is currently in the success state
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
*/
-bool CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR o);
+void CVec_EventZ_free(struct LDKCVec_EventZ _res);
/**
- * Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
*/
-void CResult_COption_NetworkUpdateZDecodeErrorZ_free(struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res);
+void CVec_TransactionZ_free(struct LDKCVec_TransactionZ _res);
/**
- * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
+ * Creates a new tuple which has the same data as `orig`
* but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_clone(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR orig);
+struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_clone(const struct LDKC2Tuple_u32TxOutZ *NONNULL_PTR orig);
/**
- * Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
+ * Creates a new C2Tuple_u32TxOutZ from the contained elements.
*/
-struct LDKCOption_AccessZ COption_AccessZ_some(struct LDKAccess o);
+struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b);
/**
- * Constructs a new COption_AccessZ containing nothing
+ * Frees any resources used by the C2Tuple_u32TxOutZ.
*/
-struct LDKCOption_AccessZ COption_AccessZ_none(void);
+void C2Tuple_u32TxOutZ_free(struct LDKC2Tuple_u32TxOutZ _res);
/**
- * Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
*/
-void COption_AccessZ_free(struct LDKCOption_AccessZ _res);
+void CVec_C2Tuple_u32TxOutZZ_free(struct LDKCVec_C2Tuple_u32TxOutZZ _res);
/**
- * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
+ * Creates a new tuple which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_ok(struct LDKChannelUpdateInfo o);
+struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR orig);
/**
- * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
+ * Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
*/
-struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_err(struct LDKDecodeError e);
+struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b);
/**
- * Checks if the given object is currently in the success state
+ * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
*/
-bool CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(const struct LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR o);
+void C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res);
/**
- * Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
*/
-void CResult_ChannelUpdateInfoDecodeErrorZ_free(struct LDKCResult_ChannelUpdateInfoDecodeErrorZ _res);
+void CVec_TransactionOutputsZ_free(struct LDKCVec_TransactionOutputsZ _res);
/**
- * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ 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_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR orig);
+void CVec_BalanceZ_free(struct LDKCVec_BalanceZ _res);
/**
- * Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
+ * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
*/
-struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_ok(struct LDKChannelInfo o);
+struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelMonitorZ o);
/**
- * Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
+ * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
*/
-struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
+struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e);
/**
* Checks if the given object is currently in the success state
*/
-bool CResult_ChannelInfoDecodeErrorZ_is_ok(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR o);
+bool CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR o);
/**
- * Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
+ * Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
*/
-void CResult_ChannelInfoDecodeErrorZ_free(struct LDKCResult_ChannelInfoDecodeErrorZ _res);
+void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res);
/**
- * Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
- * but with all dynamically-allocated buffers duplicated in new buffers.
+ * Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
*/
-struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR orig);
+struct LDKC2Tuple_PublicKeyTypeZ C2Tuple_PublicKeyTypeZ_new(struct LDKPublicKey a, struct LDKType b);
/**
- * Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
+ * Frees any resources used by the C2Tuple_PublicKeyTypeZ.
*/
-struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o);
+void C2Tuple_PublicKeyTypeZ_free(struct LDKC2Tuple_PublicKeyTypeZ _res);
/**
- * Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
*/
-struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e);
+void CVec_C2Tuple_PublicKeyTypeZZ_free(struct LDKCVec_C2Tuple_PublicKeyTypeZZ _res);
/**
- * Checks if the given object is currently in the success state
+ * Constructs a new COption_NetAddressZ containing a crate::lightning::ln::msgs::NetAddress
*/
-bool CResult_RoutingFeesDecodeErrorZ_is_ok(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR o);
+struct LDKCOption_NetAddressZ COption_NetAddressZ_some(struct LDKNetAddress o);
/**
- * Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
+ * Constructs a new COption_NetAddressZ containing nothing
*/
-void CResult_RoutingFeesDecodeErrorZ_free(struct LDKCResult_RoutingFeesDecodeErrorZ _res);
+struct LDKCOption_NetAddressZ COption_NetAddressZ_none(void);
/**
- * Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
- * but with all dynamically-allocated buffers duplicated in new buffers.
+ * Frees any resources associated with the crate::lightning::ln::msgs::NetAddress, if we are in the Some state
*/
-struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_clone(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR orig);
+void COption_NetAddressZ_free(struct LDKCOption_NetAddressZ _res);
/**
- * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
+ * Creates a new COption_NetAddressZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_ok(struct LDKNodeAnnouncementInfo o);
+struct LDKCOption_NetAddressZ COption_NetAddressZ_clone(const struct LDKCOption_NetAddressZ *NONNULL_PTR orig);
/**
- * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
+ * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
*/
-struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_err(struct LDKDecodeError e);
+struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o);
/**
- * Checks if the given object is currently in the success state
+ * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
*/
-bool CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR o);
+struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e);
/**
- * Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
+ * Checks if the given object is currently in the success state
*/
-void CResult_NodeAnnouncementInfoDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res);
+bool CResult_CVec_u8ZPeerHandleErrorZ_is_ok(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR o);
/**
- * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
- * but with all dynamically-allocated buffers duplicated in new buffers.
+ * Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
*/
-struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR orig);
+void CResult_CVec_u8ZPeerHandleErrorZ_free(struct LDKCResult_CVec_u8ZPeerHandleErrorZ _res);
/**
- * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ * Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
*/
-void CVec_u64Z_free(struct LDKCVec_u64Z _res);
+struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_clone(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR orig);
/**
- * Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
+ * Creates a new CResult_NonePeerHandleErrorZ in the success state.
*/
-struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_ok(struct LDKNodeInfo o);
+struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void);
/**
- * Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
+ * Creates a new CResult_NonePeerHandleErrorZ in the error state.
*/
-struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_err(struct LDKDecodeError e);
+struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e);
/**
* Checks if the given object is currently in the success state
*/
-bool CResult_NodeInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR o);
+bool CResult_NonePeerHandleErrorZ_is_ok(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR o);
/**
- * Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
+ * Frees any resources used by the CResult_NonePeerHandleErrorZ.
*/
-void CResult_NodeInfoDecodeErrorZ_free(struct LDKCResult_NodeInfoDecodeErrorZ _res);
+void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res);
/**
- * Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
+ * Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
* but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_clone(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR orig);
+struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_clone(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR orig);
/**
- * Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
+ * Creates a new CResult_boolPeerHandleErrorZ in the success state.
*/
-struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_ok(struct LDKNetworkGraph o);
+struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o);
/**
- * Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
+ * Creates a new CResult_boolPeerHandleErrorZ in the error state.
*/
-struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(struct LDKDecodeError e);
+struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e);
/**
* Checks if the given object is currently in the success state
*/
-bool CResult_NetworkGraphDecodeErrorZ_is_ok(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR o);
+bool CResult_boolPeerHandleErrorZ_is_ok(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR o);
/**
- * Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
+ * Frees any resources used by the CResult_boolPeerHandleErrorZ.
*/
-void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res);
+void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _res);
/**
- * Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
+ * Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
* but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_clone(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR orig);
+struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_clone(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR orig);
/**
- * Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
+ * Creates a new CResult_u32GraphSyncErrorZ in the success state.
*/
-struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_some(struct LDKCVec_NetAddressZ o);
+struct LDKCResult_u32GraphSyncErrorZ CResult_u32GraphSyncErrorZ_ok(uint32_t o);
/**
- * Constructs a new COption_CVec_NetAddressZZ containing nothing
+ * Creates a new CResult_u32GraphSyncErrorZ in the error state.
*/
-struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_none(void);
+struct LDKCResult_u32GraphSyncErrorZ CResult_u32GraphSyncErrorZ_err(struct LDKGraphSyncError e);
/**
- * Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
+ * Checks if the given object is currently in the success state
*/
-void COption_CVec_NetAddressZZ_free(struct LDKCOption_CVec_NetAddressZZ _res);
+bool CResult_u32GraphSyncErrorZ_is_ok(const struct LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR o);
/**
- * Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
- * but with all dynamically-allocated buffers duplicated in new buffers.
+ * Frees any resources used by the CResult_u32GraphSyncErrorZ.
*/
-struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_clone(const struct LDKCOption_CVec_NetAddressZZ *NONNULL_PTR orig);
+void CResult_u32GraphSyncErrorZ_free(struct LDKCResult_u32GraphSyncErrorZ _res);
/**
* Creates a new CResult_NetAddressDecodeErrorZ in the success state.
struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_clone(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR orig);
/**
- * Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
+ * Creates a new CResult_ChannelReadyDecodeErrorZ in the success state.
*/
-struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_ok(struct LDKFundingLocked o);
+struct LDKCResult_ChannelReadyDecodeErrorZ CResult_ChannelReadyDecodeErrorZ_ok(struct LDKChannelReady o);
/**
- * Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
+ * Creates a new CResult_ChannelReadyDecodeErrorZ in the error state.
*/
-struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_err(struct LDKDecodeError e);
+struct LDKCResult_ChannelReadyDecodeErrorZ CResult_ChannelReadyDecodeErrorZ_err(struct LDKDecodeError e);
/**
* Checks if the given object is currently in the success state
*/
-bool CResult_FundingLockedDecodeErrorZ_is_ok(const struct LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR o);
+bool CResult_ChannelReadyDecodeErrorZ_is_ok(const struct LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR o);
/**
- * Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
+ * Frees any resources used by the CResult_ChannelReadyDecodeErrorZ.
*/
-void CResult_FundingLockedDecodeErrorZ_free(struct LDKCResult_FundingLockedDecodeErrorZ _res);
+void CResult_ChannelReadyDecodeErrorZ_free(struct LDKCResult_ChannelReadyDecodeErrorZ _res);
/**
- * Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
+ * Creates a new CResult_ChannelReadyDecodeErrorZ which has the same data as `orig`
* but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_clone(const struct LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR orig);
+struct LDKCResult_ChannelReadyDecodeErrorZ CResult_ChannelReadyDecodeErrorZ_clone(const struct LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR orig);
/**
* Creates a new CResult_InitDecodeErrorZ in the success state.
*/
struct LDKPaymentPurpose PaymentPurpose_spontaneous_payment(struct LDKThirtyTwoBytes a);
+/**
+ * Serialize the PaymentPurpose object into a byte array which can be read by PaymentPurpose_read
+ */
+struct LDKCVec_u8Z PaymentPurpose_write(const struct LDKPaymentPurpose *NONNULL_PTR obj);
+
+/**
+ * Read a PaymentPurpose from a byte array, created by PaymentPurpose_write
+ */
+struct LDKCResult_PaymentPurposeDecodeErrorZ PaymentPurpose_read(struct LDKu8slice ser);
+
/**
* Frees any resources used by the ClosureReason
*/
/**
* Utility method to constructs a new FundingGenerationReady-variant Event
*/
-struct LDKEvent Event_funding_generation_ready(struct LDKThirtyTwoBytes temporary_channel_id, uint64_t channel_value_satoshis, struct LDKCVec_u8Z output_script, uint64_t user_channel_id);
+struct LDKEvent Event_funding_generation_ready(struct LDKThirtyTwoBytes temporary_channel_id, struct LDKPublicKey counterparty_node_id, uint64_t channel_value_satoshis, struct LDKCVec_u8Z output_script, uint64_t user_channel_id);
/**
* Utility method to constructs a new PaymentReceived-variant Event
*/
-struct LDKEvent Event_payment_received(struct LDKThirtyTwoBytes payment_hash, uint64_t amt, struct LDKPaymentPurpose purpose);
+struct LDKEvent Event_payment_received(struct LDKThirtyTwoBytes payment_hash, uint64_t amount_msat, struct LDKPaymentPurpose purpose);
/**
- * Utility method to constructs a new PaymentSent-variant Event
+ * Utility method to constructs a new PaymentClaimed-variant Event
*/
-struct LDKEvent Event_payment_sent(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z fee_paid_msat);
+struct LDKEvent Event_payment_claimed(struct LDKThirtyTwoBytes payment_hash, uint64_t amount_msat, struct LDKPaymentPurpose purpose);
/**
- * Utility method to constructs a new PaymentPathFailed-variant Event
+ * Utility method to constructs a new PaymentSent-variant Event
*/
-struct LDKEvent Event_payment_path_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, bool rejected_by_dest, struct LDKCOption_NetworkUpdateZ network_update, bool all_paths_failed, struct LDKCVec_RouteHopZ path, struct LDKCOption_u64Z short_channel_id, struct LDKRouteParameters retry);
+struct LDKEvent Event_payment_sent(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z fee_paid_msat);
/**
* Utility method to constructs a new PaymentFailed-variant Event
*/
struct LDKEvent Event_payment_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash);
+/**
+ * Utility method to constructs a new PaymentPathSuccessful-variant Event
+ */
+struct LDKEvent Event_payment_path_successful(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKCVec_RouteHopZ path);
+
+/**
+ * Utility method to constructs a new PaymentPathFailed-variant Event
+ */
+struct LDKEvent Event_payment_path_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, bool rejected_by_dest, struct LDKCOption_NetworkUpdateZ network_update, bool all_paths_failed, struct LDKCVec_RouteHopZ path, struct LDKCOption_u64Z short_channel_id, struct LDKRouteParameters retry);
+
/**
* Utility method to constructs a new PendingHTLCsForwardable-variant Event
*/
/**
* Utility method to constructs a new PaymentForwarded-variant Event
*/
-struct LDKEvent Event_payment_forwarded(struct LDKCOption_u64Z fee_earned_msat, bool claim_from_onchain_tx);
+struct LDKEvent Event_payment_forwarded(struct LDKThirtyTwoBytes prev_channel_id, struct LDKThirtyTwoBytes next_channel_id, struct LDKCOption_u64Z fee_earned_msat, bool claim_from_onchain_tx);
/**
* Utility method to constructs a new ChannelClosed-variant Event
*/
struct LDKEvent Event_discard_funding(struct LDKThirtyTwoBytes channel_id, struct LDKTransaction transaction);
-/**
- * Utility method to constructs a new PaymentPathSuccessful-variant Event
- */
-struct LDKEvent Event_payment_path_successful(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKCVec_RouteHopZ path);
-
/**
* Utility method to constructs a new OpenChannelRequest-variant Event
*/
struct LDKMessageSendEvent MessageSendEvent_send_funding_signed(struct LDKPublicKey node_id, struct LDKFundingSigned msg);
/**
- * Utility method to constructs a new SendFundingLocked-variant MessageSendEvent
+ * Utility method to constructs a new SendChannelReady-variant MessageSendEvent
*/
-struct LDKMessageSendEvent MessageSendEvent_send_funding_locked(struct LDKPublicKey node_id, struct LDKFundingLocked msg);
+struct LDKMessageSendEvent MessageSendEvent_send_channel_ready(struct LDKPublicKey node_id, struct LDKChannelReady msg);
/**
* Utility method to constructs a new SendAnnouncementSignatures-variant MessageSendEvent
*/
struct LDKAPIError APIError_incompatible_shutdown_script(struct LDKShutdownScript script);
+/**
+ * Frees any resources used by the BigSize, if is_owned is set and inner is non-NULL.
+ */
+void BigSize_free(struct LDKBigSize this_obj);
+
+uint64_t BigSize_get_a(const struct LDKBigSize *NONNULL_PTR this_ptr);
+
+void BigSize_set_a(struct LDKBigSize *NONNULL_PTR this_ptr, uint64_t val);
+
+/**
+ * Constructs a new BigSize given each field
+ */
+MUST_USE_RES struct LDKBigSize BigSize_new(uint64_t a_arg);
+
/**
* Creates a digital signature of a message given a SecretKey, like the node's secret.
* A receiver knowing the PublicKey (e.g. the node's id) and the message can be sure that the signature was generated by the caller.
*/
struct LDKCVec_u8Z construct_invoice_preimage(struct LDKu8slice hrp_bytes, struct LDKCVec_u5Z data_without_signature);
+/**
+ * Calls the free function if one is set
+ */
+void Persister_free(struct LDKPersister this_ptr);
+
/**
* Creates a copy of the Level
*/
* Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
* equivalent limit applied to outbound channels).
*
+ * A lower-bound of 1 is applied, requiring all channels to have a confirmed commitment
+ * transaction before operation. If you wish to accept channels with zero confirmations, see
+ * [`UserConfig::manually_accept_inbound_channels`] and
+ * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`].
+ *
* Default value: 6.
+ *
+ * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
+ * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf
*/
uint32_t ChannelHandshakeConfig_get_minimum_depth(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
* Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
* equivalent limit applied to outbound channels).
*
+ * A lower-bound of 1 is applied, requiring all channels to have a confirmed commitment
+ * transaction before operation. If you wish to accept channels with zero confirmations, see
+ * [`UserConfig::manually_accept_inbound_channels`] and
+ * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`].
+ *
* Default value: 6.
+ *
+ * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
+ * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf
*/
void ChannelHandshakeConfig_set_minimum_depth(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val);
*/
void ChannelHandshakeConfig_set_our_htlc_minimum_msat(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint64_t val);
+/**
+ * Sets the percentage of the channel value we will cap the total value of outstanding inbound
+ * HTLCs to.
+ *
+ * This can be set to a value between 1-100, where the value corresponds to the percent of the
+ * channel value in whole percentages.
+ *
+ * Note that:
+ * * If configured to another value than the default value 10, any new channels created with
+ * the non default value will cause versions of LDK prior to 0.0.104 to refuse to read the
+ * `ChannelManager`.
+ *
+ * * This caps the total value for inbound HTLCs in-flight only, and there's currently
+ * no way to configure the cap for the total value of outbound HTLCs in-flight.
+ *
+ * * The requirements for your node being online to ensure the safety of HTLC-encumbered funds
+ * are different from the non-HTLC-encumbered funds. This makes this an important knob to
+ * restrict exposure to loss due to being offline for too long.
+ * See [`ChannelHandshakeConfig::our_to_self_delay`] and [`ChannelConfig::cltv_expiry_delta`]
+ * for more information.
+ *
+ * Default value: 10.
+ * Minimum value: 1, any values less than 1 will be treated as 1 instead.
+ * Maximum value: 100, any values larger than 100 will be treated as 100 instead.
+ */
+uint8_t ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
+
+/**
+ * Sets the percentage of the channel value we will cap the total value of outstanding inbound
+ * HTLCs to.
+ *
+ * This can be set to a value between 1-100, where the value corresponds to the percent of the
+ * channel value in whole percentages.
+ *
+ * Note that:
+ * * If configured to another value than the default value 10, any new channels created with
+ * the non default value will cause versions of LDK prior to 0.0.104 to refuse to read the
+ * `ChannelManager`.
+ *
+ * * This caps the total value for inbound HTLCs in-flight only, and there's currently
+ * no way to configure the cap for the total value of outbound HTLCs in-flight.
+ *
+ * * The requirements for your node being online to ensure the safety of HTLC-encumbered funds
+ * are different from the non-HTLC-encumbered funds. This makes this an important knob to
+ * restrict exposure to loss due to being offline for too long.
+ * See [`ChannelHandshakeConfig::our_to_self_delay`] and [`ChannelConfig::cltv_expiry_delta`]
+ * for more information.
+ *
+ * Default value: 10.
+ * Minimum value: 1, any values less than 1 will be treated as 1 instead.
+ * Maximum value: 100, any values larger than 100 will be treated as 100 instead.
+ */
+void ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint8_t val);
+
/**
* If set, we attempt to negotiate the `scid_privacy` (referred to as `scid_alias` in the
* BOLTs) option for outbound private channels. This provides better privacy by not including
/**
* Constructs a new ChannelHandshakeConfig given each field
*/
-MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_new(uint32_t minimum_depth_arg, uint16_t our_to_self_delay_arg, uint64_t our_htlc_minimum_msat_arg, bool negotiate_scid_privacy_arg);
+MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_new(uint32_t minimum_depth_arg, uint16_t our_to_self_delay_arg, uint64_t our_htlc_minimum_msat_arg, uint8_t max_inbound_htlc_value_in_flight_percent_of_channel_arg, bool negotiate_scid_privacy_arg);
/**
* Creates a copy of the ChannelHandshakeConfig
void ChannelHandshakeLimits_free(struct LDKChannelHandshakeLimits this_obj);
/**
- * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
+ * Minimum allowed satoshis when a channel is funded. This is supplied by the sender and so
* only applies to inbound channels.
*
* Default value: 0.
uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
/**
- * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
+ * Minimum allowed satoshis when a channel is funded. This is supplied by the sender and so
* only applies to inbound channels.
*
* Default value: 0.
*/
void ChannelHandshakeLimits_set_min_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
+/**
+ * Maximum allowed satoshis when a channel is funded. This is supplied by the sender and so
+ * only applies to inbound channels.
+ *
+ * Default value: 2^24 - 1.
+ */
+uint64_t ChannelHandshakeLimits_get_max_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
+
+/**
+ * Maximum allowed satoshis when a channel is funded. This is supplied by the sender and so
+ * only applies to inbound channels.
+ *
+ * Default value: 2^24 - 1.
+ */
+void ChannelHandshakeLimits_set_max_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
+
/**
* The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
* you to limit the maximum minimum-size they can require.
*/
void ChannelHandshakeLimits_set_max_minimum_depth(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint32_t val);
+/**
+ * Whether we implicitly trust funding transactions generated by us for our own outbound
+ * channels to not be double-spent.
+ *
+ * If this is set, we assume that our own funding transactions are *never* double-spent, and
+ * thus we can trust them without any confirmations. This is generally a reasonable
+ * assumption, given we're the only ones who could ever double-spend it (assuming we have sole
+ * control of the signing keys).
+ *
+ * You may wish to un-set this if you allow the user to (or do in an automated fashion)
+ * double-spend the funding transaction to RBF with an alternative channel open.
+ *
+ * This only applies if our counterparty set their confirmations-required value to 0, and we
+ * always trust our own funding transaction at 1 confirmation irrespective of this value.
+ * Thus, this effectively acts as a `min_minimum_depth`, with the only possible values being
+ * `true` (0) and `false` (1).
+ *
+ * Default value: true
+ */
+bool ChannelHandshakeLimits_get_trust_own_funding_0conf(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
+
+/**
+ * Whether we implicitly trust funding transactions generated by us for our own outbound
+ * channels to not be double-spent.
+ *
+ * If this is set, we assume that our own funding transactions are *never* double-spent, and
+ * thus we can trust them without any confirmations. This is generally a reasonable
+ * assumption, given we're the only ones who could ever double-spend it (assuming we have sole
+ * control of the signing keys).
+ *
+ * You may wish to un-set this if you allow the user to (or do in an automated fashion)
+ * double-spend the funding transaction to RBF with an alternative channel open.
+ *
+ * This only applies if our counterparty set their confirmations-required value to 0, and we
+ * always trust our own funding transaction at 1 confirmation irrespective of this value.
+ * Thus, this effectively acts as a `min_minimum_depth`, with the only possible values being
+ * `true` (0) and `false` (1).
+ *
+ * Default value: true
+ */
+void ChannelHandshakeLimits_set_trust_own_funding_0conf(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val);
+
/**
* Set to force an incoming channel to match our announced channel preference in
* [`ChannelConfig::announced_channel`].
/**
* Constructs a new ChannelHandshakeLimits given each field
*/
-MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_new(uint64_t min_funding_satoshis_arg, uint64_t max_htlc_minimum_msat_arg, uint64_t min_max_htlc_value_in_flight_msat_arg, uint64_t max_channel_reserve_satoshis_arg, uint16_t min_max_accepted_htlcs_arg, uint32_t max_minimum_depth_arg, bool force_announced_channel_preference_arg, uint16_t their_to_self_delay_arg);
+MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_new(uint64_t min_funding_satoshis_arg, uint64_t max_funding_satoshis_arg, uint64_t max_htlc_minimum_msat_arg, uint64_t min_max_htlc_value_in_flight_msat_arg, uint64_t max_channel_reserve_satoshis_arg, uint16_t min_max_accepted_htlcs_arg, uint32_t max_minimum_depth_arg, bool trust_own_funding_0conf_arg, bool force_announced_channel_preference_arg, uint16_t their_to_self_delay_arg);
/**
* Creates a copy of the ChannelHandshakeLimits
*/
void ChannelCounterparty_set_forwarding_info(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCounterpartyForwardingInfo val);
+/**
+ * The smallest value HTLC (in msat) the remote peer will accept, for this channel. This field
+ * is only `None` before we have received either the `OpenChannel` or `AcceptChannel` message
+ * from the remote peer, or for `ChannelCounterparty` objects serialized prior to LDK 0.0.107.
+ */
+struct LDKCOption_u64Z ChannelCounterparty_get_outbound_htlc_minimum_msat(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
+
+/**
+ * The smallest value HTLC (in msat) the remote peer will accept, for this channel. This field
+ * is only `None` before we have received either the `OpenChannel` or `AcceptChannel` message
+ * from the remote peer, or for `ChannelCounterparty` objects serialized prior to LDK 0.0.107.
+ */
+void ChannelCounterparty_set_outbound_htlc_minimum_msat(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
+
+/**
+ * The largest value HTLC (in msat) the remote peer currently will accept, for this channel.
+ */
+struct LDKCOption_u64Z ChannelCounterparty_get_outbound_htlc_maximum_msat(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
+
+/**
+ * The largest value HTLC (in msat) the remote peer currently will accept, for this channel.
+ */
+void ChannelCounterparty_set_outbound_htlc_maximum_msat(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
+
/**
* Constructs a new ChannelCounterparty given each field
*/
-MUST_USE_RES struct LDKChannelCounterparty ChannelCounterparty_new(struct LDKPublicKey node_id_arg, struct LDKInitFeatures features_arg, uint64_t unspendable_punishment_reserve_arg, struct LDKCounterpartyForwardingInfo forwarding_info_arg);
+MUST_USE_RES struct LDKChannelCounterparty ChannelCounterparty_new(struct LDKPublicKey node_id_arg, struct LDKInitFeatures features_arg, uint64_t unspendable_punishment_reserve_arg, struct LDKCounterpartyForwardingInfo forwarding_info_arg, struct LDKCOption_u64Z outbound_htlc_minimum_msat_arg, struct LDKCOption_u64Z outbound_htlc_maximum_msat_arg);
/**
* Creates a copy of the ChannelCounterparty
* Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound
* payments instead of this. See [`get_inbound_payment_scid`].
*
+ * For channels with [`confirmations_required`] set to `Some(0)`, [`outbound_scid_alias`] may
+ * be used in place of this in outbound routes. See [`get_outbound_payment_scid`].
+ *
* [`inbound_scid_alias`]: Self::inbound_scid_alias
+ * [`outbound_scid_alias`]: Self::outbound_scid_alias
* [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid
+ * [`get_outbound_payment_scid`]: Self::get_outbound_payment_scid
+ * [`confirmations_required`]: Self::confirmations_required
*/
struct LDKCOption_u64Z ChannelDetails_get_short_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
* Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound
* payments instead of this. See [`get_inbound_payment_scid`].
*
+ * For channels with [`confirmations_required`] set to `Some(0)`, [`outbound_scid_alias`] may
+ * be used in place of this in outbound routes. See [`get_outbound_payment_scid`].
+ *
* [`inbound_scid_alias`]: Self::inbound_scid_alias
+ * [`outbound_scid_alias`]: Self::outbound_scid_alias
* [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid
+ * [`get_outbound_payment_scid`]: Self::get_outbound_payment_scid
+ * [`confirmations_required`]: Self::confirmations_required
*/
void ChannelDetails_set_short_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
+/**
+ * An optional [`short_channel_id`] alias for this channel, randomly generated by us and
+ * usable in place of [`short_channel_id`] to reference the channel in outbound routes when
+ * the channel has not yet been confirmed (as long as [`confirmations_required`] is
+ * `Some(0)`).
+ *
+ * This will be `None` as long as the channel is not available for routing outbound payments.
+ *
+ * [`short_channel_id`]: Self::short_channel_id
+ * [`confirmations_required`]: Self::confirmations_required
+ */
+struct LDKCOption_u64Z ChannelDetails_get_outbound_scid_alias(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
+
+/**
+ * An optional [`short_channel_id`] alias for this channel, randomly generated by us and
+ * usable in place of [`short_channel_id`] to reference the channel in outbound routes when
+ * the channel has not yet been confirmed (as long as [`confirmations_required`] is
+ * `Some(0)`).
+ *
+ * This will be `None` as long as the channel is not available for routing outbound payments.
+ *
+ * [`short_channel_id`]: Self::short_channel_id
+ * [`confirmations_required`]: Self::confirmations_required
+ */
+void ChannelDetails_set_outbound_scid_alias(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
+
/**
* An optional [`short_channel_id`] alias for this channel, randomly generated by our
* counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our
*/
void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
+/**
+ * The available outbound capacity for sending a single HTLC to the remote peer. This is
+ * similar to [`ChannelDetails::outbound_capacity_msat`] but it may be further restricted by
+ * the current state and per-HTLC limit(s). This is intended for use when routing, allowing us
+ * to use a limit as close as possible to the HTLC limit we can currently send.
+ *
+ * See also [`ChannelDetails::balance_msat`] and [`ChannelDetails::outbound_capacity_msat`].
+ */
+uint64_t ChannelDetails_get_next_outbound_htlc_limit_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
+
+/**
+ * The available outbound capacity for sending a single HTLC to the remote peer. This is
+ * similar to [`ChannelDetails::outbound_capacity_msat`] but it may be further restricted by
+ * the current state and per-HTLC limit(s). This is intended for use when routing, allowing us
+ * to use a limit as close as possible to the HTLC limit we can currently send.
+ *
+ * See also [`ChannelDetails::balance_msat`] and [`ChannelDetails::outbound_capacity_msat`].
+ */
+void ChannelDetails_set_next_outbound_htlc_limit_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
+
/**
* The available inbound capacity for the remote peer to send HTLCs to us. This does not
* include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
void ChannelDetails_set_is_outbound(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
/**
- * True if the channel is confirmed, funding_locked messages have been exchanged, and the
- * channel is not currently being shut down. `funding_locked` message exchange implies the
+ * True if the channel is confirmed, channel_ready messages have been exchanged, and the
+ * channel is not currently being shut down. `channel_ready` message exchange implies the
* required confirmation count has been reached (and we were connected to the peer at some
* point after the funding transaction received enough confirmations). The required
* confirmation count is provided in [`confirmations_required`].
*
* [`confirmations_required`]: ChannelDetails::confirmations_required
*/
-bool ChannelDetails_get_is_funding_locked(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
+bool ChannelDetails_get_is_channel_ready(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
/**
- * True if the channel is confirmed, funding_locked messages have been exchanged, and the
- * channel is not currently being shut down. `funding_locked` message exchange implies the
+ * True if the channel is confirmed, channel_ready messages have been exchanged, and the
+ * channel is not currently being shut down. `channel_ready` message exchange implies the
* required confirmation count has been reached (and we were connected to the peer at some
* point after the funding transaction received enough confirmations). The required
* confirmation count is provided in [`confirmations_required`].
*
* [`confirmations_required`]: ChannelDetails::confirmations_required
*/
-void ChannelDetails_set_is_funding_locked(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
+void ChannelDetails_set_is_channel_ready(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
/**
- * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
+ * True if the channel is (a) confirmed and channel_ready messages have been exchanged, (b)
* the peer is connected, and (c) the channel is not currently negotiating a shutdown.
*
- * This is a strict superset of `is_funding_locked`.
+ * This is a strict superset of `is_channel_ready`.
*/
bool ChannelDetails_get_is_usable(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
/**
- * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
+ * True if the channel is (a) confirmed and channel_ready messages have been exchanged, (b)
* the peer is connected, and (c) the channel is not currently negotiating a shutdown.
*
- * This is a strict superset of `is_funding_locked`.
+ * This is a strict superset of `is_channel_ready`.
*/
void ChannelDetails_set_is_usable(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
*/
void ChannelDetails_set_is_public(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
+/**
+ * The smallest value HTLC (in msat) we will accept, for this channel. This field
+ * is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.107
+ */
+struct LDKCOption_u64Z ChannelDetails_get_inbound_htlc_minimum_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
+
+/**
+ * The smallest value HTLC (in msat) we will accept, for this channel. This field
+ * is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.107
+ */
+void ChannelDetails_set_inbound_htlc_minimum_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
+
+/**
+ * The largest value HTLC (in msat) we currently will accept, for this channel.
+ */
+struct LDKCOption_u64Z ChannelDetails_get_inbound_htlc_maximum_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
+
+/**
+ * The largest value HTLC (in msat) we currently will accept, for this channel.
+ */
+void ChannelDetails_set_inbound_htlc_maximum_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
+
/**
* Constructs a new ChannelDetails given each field
*/
-MUST_USE_RES struct LDKChannelDetails ChannelDetails_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKChannelCounterparty counterparty_arg, struct LDKOutPoint funding_txo_arg, struct LDKChannelTypeFeatures channel_type_arg, struct LDKCOption_u64Z short_channel_id_arg, struct LDKCOption_u64Z inbound_scid_alias_arg, uint64_t channel_value_satoshis_arg, struct LDKCOption_u64Z unspendable_punishment_reserve_arg, uint64_t user_channel_id_arg, uint64_t balance_msat_arg, uint64_t outbound_capacity_msat_arg, uint64_t inbound_capacity_msat_arg, struct LDKCOption_u32Z confirmations_required_arg, struct LDKCOption_u16Z force_close_spend_delay_arg, bool is_outbound_arg, bool is_funding_locked_arg, bool is_usable_arg, bool is_public_arg);
+MUST_USE_RES struct LDKChannelDetails ChannelDetails_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKChannelCounterparty counterparty_arg, struct LDKOutPoint funding_txo_arg, struct LDKChannelTypeFeatures channel_type_arg, struct LDKCOption_u64Z short_channel_id_arg, struct LDKCOption_u64Z outbound_scid_alias_arg, struct LDKCOption_u64Z inbound_scid_alias_arg, uint64_t channel_value_satoshis_arg, struct LDKCOption_u64Z unspendable_punishment_reserve_arg, uint64_t user_channel_id_arg, uint64_t balance_msat_arg, uint64_t outbound_capacity_msat_arg, uint64_t next_outbound_htlc_limit_msat_arg, uint64_t inbound_capacity_msat_arg, struct LDKCOption_u32Z confirmations_required_arg, struct LDKCOption_u16Z force_close_spend_delay_arg, bool is_outbound_arg, bool is_channel_ready_arg, bool is_usable_arg, bool is_public_arg, struct LDKCOption_u64Z inbound_htlc_minimum_msat_arg, struct LDKCOption_u64Z inbound_htlc_maximum_msat_arg);
/**
* Creates a copy of the ChannelDetails
*/
MUST_USE_RES struct LDKCOption_u64Z ChannelDetails_get_inbound_payment_scid(const struct LDKChannelDetails *NONNULL_PTR this_arg);
+/**
+ * Gets the current SCID which should be used to identify this channel for outbound payments.
+ * This should be used in [`Route`]s to describe the first hop or in other contexts where
+ * we're sending or forwarding a payment outbound over this channel.
+ *
+ * This is either the [`ChannelDetails::short_channel_id`], if set, or the
+ * [`ChannelDetails::outbound_scid_alias`]. See those for more information.
+ */
+MUST_USE_RES struct LDKCOption_u64Z ChannelDetails_get_outbound_payment_scid(const struct LDKChannelDetails *NONNULL_PTR this_arg);
+
/**
* Frees any resources used by the PaymentSendFailure
*/
*
* Non-proportional fees are fixed according to our risk using the provided fee estimator.
*
- * panics if channel_value_satoshis is >= `MAX_FUNDING_SATOSHIS`!
- *
* Users need to notify the new ChannelManager when a new block is connected or
* disconnected using its `block_connected` and `block_disconnected` methods, starting
* from after `params.latest_hash`.
MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
/**
- * Gets the list of usable channels, in random order. Useful as an argument to
- * get_route to ensure non-announced channels are used.
+ * Gets the list of usable channels, in random order. Useful as an argument to [`find_route`]
+ * to ensure non-announced channels are used.
*
* These are guaranteed to have their [`ChannelDetails::is_usable`] value set to true, see the
* documentation for [`ChannelDetails::is_usable`] for more info on exactly what the criteria
* are.
+ *
+ * [`find_route`]: crate::routing::router::find_route
*/
MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
* [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
* [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
*/
-MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
+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);
/**
* Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
* [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
* [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
*/
-MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel_with_target_feerate(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32], uint32_t target_feerate_sats_per_1000_weight);
+MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel_with_target_feerate(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32], struct LDKPublicKey counterparty_node_id, uint32_t target_feerate_sats_per_1000_weight);
/**
* Force closes a channel, immediately broadcasting the latest local commitment transaction to
- * the chain and rejecting new HTLCs on the given channel. Fails if channel_id is unknown to the manager.
+ * the chain and rejecting new HTLCs on the given channel. Fails if `channel_id` is unknown to
+ * the manager, or if the `counterparty_node_id` isn't the counterparty of the corresponding
+ * channel.
*/
-MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
+MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32], struct LDKPublicKey counterparty_node_id);
/**
* Force close all channels, immediately broadcasting the latest local commitment transaction
* [`Event::FundingGenerationReady`]: crate::util::events::Event::FundingGenerationReady
* [`Event::ChannelClosed`]: crate::util::events::Event::ChannelClosed
*/
-MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_funding_transaction_generated(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*temporary_channel_id)[32], struct LDKTransaction funding_transaction);
+MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_funding_transaction_generated(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*temporary_channel_id)[32], struct LDKPublicKey counterparty_node_id, struct LDKTransaction funding_transaction);
/**
* Regenerates channel_announcements and generates a signed node_announcement from the given
* Indicates that the preimage for payment_hash is unknown or the received amount is incorrect
* after a PaymentReceived event, failing the HTLC back to its origin and freeing resources
* along the path (including in our own channel on which we received it).
- * Returns false if no payment was found to fail backwards, true if the process of failing the
- * HTLC backwards has been started.
+ *
+ * Note that in some cases around unclean shutdown, it is possible the payment may have
+ * already been claimed by you via [`ChannelManager::claim_funds`] prior to you seeing (a
+ * second copy of) the [`events::Event::PaymentReceived`] event. Alternatively, the payment
+ * may have already been failed automatically by LDK if it was nearing its expiration time.
+ *
+ * While LDK will never claim a payment automatically on your behalf (i.e. without you calling
+ * [`ChannelManager::claim_funds`]), you should still monitor for
+ * [`events::Event::PaymentClaimed`] events even for payments you intend to fail, especially on
+ * startup during which time claims that were in-progress at shutdown may be replayed.
*/
-MUST_USE_RES bool ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]);
+void ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]);
/**
* Provides a payment preimage in response to [`Event::PaymentReceived`], generating any
* [`MessageSendEvent`]s needed to claim the payment.
*
+ * Note that calling this method does *not* guarantee that the payment has been claimed. You
+ * *must* wait for an [`Event::PaymentClaimed`] event which upon a successful claim will be
+ * provided to your [`EventHandler`] when [`process_pending_events`] is next called.
+ *
* Note that if you did not set an `amount_msat` when calling [`create_inbound_payment`] or
* [`create_inbound_payment_for_hash`] you must check that the amount in the `PaymentReceived`
* event matches your expectation. If you fail to do so and call this method, you may provide
* the sender \"proof-of-payment\" when they did not fulfill the full expected payment.
*
- * Returns whether any HTLCs were claimed, and thus if any new [`MessageSendEvent`]s are now
- * pending for processing via [`get_and_clear_pending_msg_events`].
- *
* [`Event::PaymentReceived`]: crate::util::events::Event::PaymentReceived
+ * [`Event::PaymentClaimed`]: crate::util::events::Event::PaymentClaimed
+ * [`process_pending_events`]: EventsProvider::process_pending_events
* [`create_inbound_payment`]: Self::create_inbound_payment
* [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
* [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events
*/
-MUST_USE_RES bool ChannelManager_claim_funds(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage);
+void ChannelManager_claim_funds(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage);
/**
* Gets the node_id held by this ChannelManager
MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg);
/**
- * Called to accept a request to open a channel after [`Event::OpenChannelRequest`] has been
- * triggered.
+ * Accepts a request to open a channel after a [`Event::OpenChannelRequest`].
+ *
+ * The `temporary_channel_id` parameter indicates which inbound channel should be accepted,
+ * and the `counterparty_node_id` parameter is the id of the peer which has requested to open
+ * the channel.
+ *
+ * The `user_channel_id` parameter will be provided back in
+ * [`Event::ChannelClosed::user_channel_id`] to allow tracking of which events correspond
+ * with which `accept_inbound_channel`/`accept_inbound_channel_from_trusted_peer_0conf` call.
+ *
+ * Note that this method will return an error and reject the channel, if it requires support
+ * for zero confirmations. Instead, `accept_inbound_channel_from_trusted_peer_0conf` must be
+ * used to accept such channels.
*
- * The `temporary_channel_id` parameter indicates which inbound channel should be accepted.
+ * [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest
+ * [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id
+ */
+MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_accept_inbound_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*temporary_channel_id)[32], struct LDKPublicKey counterparty_node_id, uint64_t user_channel_id);
+
+/**
+ * Accepts a request to open a channel after a [`events::Event::OpenChannelRequest`], treating
+ * it as confirmed immediately.
*
- * For inbound channels, the `user_channel_id` parameter will be provided back in
+ * The `user_channel_id` parameter will be provided back in
* [`Event::ChannelClosed::user_channel_id`] to allow tracking of which events correspond
- * with which `accept_inbound_channel` call.
+ * with which `accept_inbound_channel`/`accept_inbound_channel_from_trusted_peer_0conf` call.
+ *
+ * Unlike [`ChannelManager::accept_inbound_channel`], this method accepts the incoming channel
+ * and (if the counterparty agrees), enables forwarding of payments immediately.
+ *
+ * This fully trusts that the counterparty has honestly and correctly constructed the funding
+ * transaction and blindly assumes that it will eventually confirm.
+ *
+ * If it does not confirm before we decide to close the channel, or if the funding transaction
+ * does not pay to the correct script the correct amount, *you will lose funds*.
*
* [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest
* [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id
*/
-MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_accept_inbound_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*temporary_channel_id)[32], uint64_t user_channel_id);
+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, uint64_t user_channel_id);
/**
* Gets a payment secret and payment hash for use in an invoice given to a third party wishing
*/
struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg);
+/**
+ * Frees any resources used by the ExpandedKey, if is_owned is set and inner is non-NULL.
+ */
+void ExpandedKey_free(struct LDKExpandedKey this_obj);
+
+/**
+ * Create a new [`ExpandedKey`] for generating an inbound payment hash and secret.
+ *
+ * It is recommended to cache this value and not regenerate it for each new inbound payment.
+ */
+MUST_USE_RES struct LDKExpandedKey ExpandedKey_new(const uint8_t (*key_material)[32]);
+
+/**
+ * Equivalent to [`crate::ln::channelmanager::ChannelManager::create_inbound_payment`], but no
+ * `ChannelManager` is required. Useful for generating invoices for [phantom node payments] without
+ * a `ChannelManager`.
+ *
+ * `keys` is generated by calling [`KeysInterface::get_inbound_payment_key_material`] and then
+ * calling [`ExpandedKey::new`] with its result. It is recommended to cache this value and not
+ * regenerate it for each new inbound payment.
+ *
+ * `current_time` is a Unix timestamp representing the current time.
+ *
+ * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
+ */
+struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ create(const struct LDKExpandedKey *NONNULL_PTR keys, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs, const struct LDKKeysInterface *NONNULL_PTR keys_manager, uint64_t current_time);
+
+/**
+ * Equivalent to [`crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash`],
+ * but no `ChannelManager` is required. Useful for generating invoices for [phantom node payments]
+ * without a `ChannelManager`.
+ *
+ * See [`create`] for information on the `keys` and `current_time` parameters.
+ *
+ * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
+ */
+struct LDKCResult_PaymentSecretNoneZ create_from_hash(const struct LDKExpandedKey *NONNULL_PTR keys, struct LDKCOption_u64Z min_value_msat, struct LDKThirtyTwoBytes payment_hash, uint32_t invoice_expiry_delta_secs, uint64_t current_time);
+
/**
* Frees any resources used by the DecodeError, if is_owned is set and inner is non-NULL.
*/
struct LDKFundingSigned FundingSigned_clone(const struct LDKFundingSigned *NONNULL_PTR orig);
/**
- * Frees any resources used by the FundingLocked, if is_owned is set and inner is non-NULL.
+ * Frees any resources used by the ChannelReady, if is_owned is set and inner is non-NULL.
*/
-void FundingLocked_free(struct LDKFundingLocked this_obj);
+void ChannelReady_free(struct LDKChannelReady this_obj);
/**
* The channel ID
*/
-const uint8_t (*FundingLocked_get_channel_id(const struct LDKFundingLocked *NONNULL_PTR this_ptr))[32];
+const uint8_t (*ChannelReady_get_channel_id(const struct LDKChannelReady *NONNULL_PTR this_ptr))[32];
/**
* The channel ID
*/
-void FundingLocked_set_channel_id(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
+void ChannelReady_set_channel_id(struct LDKChannelReady *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
/**
* The per-commitment point of the second commitment transaction
*/
-struct LDKPublicKey FundingLocked_get_next_per_commitment_point(const struct LDKFundingLocked *NONNULL_PTR this_ptr);
+struct LDKPublicKey ChannelReady_get_next_per_commitment_point(const struct LDKChannelReady *NONNULL_PTR this_ptr);
/**
* The per-commitment point of the second commitment transaction
*/
-void FundingLocked_set_next_per_commitment_point(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKPublicKey val);
+void ChannelReady_set_next_per_commitment_point(struct LDKChannelReady *NONNULL_PTR this_ptr, struct LDKPublicKey val);
/**
* If set, provides a short_channel_id alias for this channel. The sender will accept payments
* to be forwarded over this SCID and forward them to this messages' recipient.
*/
-struct LDKCOption_u64Z FundingLocked_get_short_channel_id_alias(const struct LDKFundingLocked *NONNULL_PTR this_ptr);
+struct LDKCOption_u64Z ChannelReady_get_short_channel_id_alias(const struct LDKChannelReady *NONNULL_PTR this_ptr);
/**
* If set, provides a short_channel_id alias for this channel. The sender will accept payments
* to be forwarded over this SCID and forward them to this messages' recipient.
*/
-void FundingLocked_set_short_channel_id_alias(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
+void ChannelReady_set_short_channel_id_alias(struct LDKChannelReady *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
/**
- * Constructs a new FundingLocked given each field
+ * Constructs a new ChannelReady given each field
*/
-MUST_USE_RES struct LDKFundingLocked FundingLocked_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKPublicKey next_per_commitment_point_arg, struct LDKCOption_u64Z short_channel_id_alias_arg);
+MUST_USE_RES struct LDKChannelReady ChannelReady_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKPublicKey next_per_commitment_point_arg, struct LDKCOption_u64Z short_channel_id_alias_arg);
/**
- * Creates a copy of the FundingLocked
+ * Creates a copy of the ChannelReady
*/
-struct LDKFundingLocked FundingLocked_clone(const struct LDKFundingLocked *NONNULL_PTR orig);
+struct LDKChannelReady ChannelReady_clone(const struct LDKChannelReady *NONNULL_PTR orig);
/**
* Frees any resources used by the Shutdown, if is_owned is set and inner is non-NULL.
*/
void UnsignedChannelUpdate_set_fee_proportional_millionths(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
+/**
+ * Excess data which was signed as a part of the message which we do not (yet) understand how
+ * to decode. This is stored to ensure forward-compatibility as new fields are added to the
+ * lightning gossip
+ */
+void UnsignedChannelUpdate_set_excess_data(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
+
/**
* Creates a copy of the UnsignedChannelUpdate
*/
struct LDKCResult_FundingSignedDecodeErrorZ FundingSigned_read(struct LDKu8slice ser);
/**
- * Serialize the FundingLocked object into a byte array which can be read by FundingLocked_read
+ * Serialize the ChannelReady object into a byte array which can be read by ChannelReady_read
*/
-struct LDKCVec_u8Z FundingLocked_write(const struct LDKFundingLocked *NONNULL_PTR obj);
+struct LDKCVec_u8Z ChannelReady_write(const struct LDKChannelReady *NONNULL_PTR obj);
/**
- * Read a FundingLocked from a byte array, created by FundingLocked_write
+ * Read a ChannelReady from a byte array, created by ChannelReady_write
*/
-struct LDKCResult_FundingLockedDecodeErrorZ FundingLocked_read(struct LDKu8slice ser);
+struct LDKCResult_ChannelReadyDecodeErrorZ ChannelReady_read(struct LDKu8slice ser);
/**
* Serialize the Init object into a byte array which can be read by Init_read
/**
* A message handler which handles messages updating our knowledge of the network channel
- * graph. Usually this is just a [`NetGraphMsgHandler`] object or an
- * [`IgnoringMessageHandler`].
+ * graph. Usually this is just a [`P2PGossipSync`] object or an [`IgnoringMessageHandler`].
*
- * [`NetGraphMsgHandler`]: crate::routing::network_graph::NetGraphMsgHandler
+ * [`P2PGossipSync`]: crate::routing::gossip::P2PGossipSync
*/
const struct LDKRoutingMessageHandler *MessageHandler_get_route_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
/**
* A message handler which handles messages updating our knowledge of the network channel
- * graph. Usually this is just a [`NetGraphMsgHandler`] object or an
- * [`IgnoringMessageHandler`].
+ * graph. Usually this is just a [`P2PGossipSync`] object or an [`IgnoringMessageHandler`].
*
- * [`NetGraphMsgHandler`]: crate::routing::network_graph::NetGraphMsgHandler
+ * [`P2PGossipSync`]: crate::routing::gossip::P2PGossipSync
*/
void MessageHandler_set_route_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKRoutingMessageHandler val);
void PeerHandleError_free(struct LDKPeerHandleError this_obj);
/**
- * Used to indicate that we probably can't make any future connections to this peer, implying
- * we should go ahead and force-close any channels we have with it.
+ * Used to indicate that we probably can't make any future connections to this peer (e.g.
+ * because we required features that our peer was missing, or vice versa).
+ *
+ * While LDK's [`ChannelManager`] will not do it automatically, you likely wish to force-close
+ * any channels with this peer or check for new versions of LDK.
+ *
+ * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
*/
bool PeerHandleError_get_no_connection_possible(const struct LDKPeerHandleError *NONNULL_PTR this_ptr);
/**
- * Used to indicate that we probably can't make any future connections to this peer, implying
- * we should go ahead and force-close any channels we have with it.
+ * Used to indicate that we probably can't make any future connections to this peer (e.g.
+ * because we required features that our peer was missing, or vice versa).
+ *
+ * While LDK's [`ChannelManager`] will not do it automatically, you likely wish to force-close
+ * any channels with this peer or check for new versions of LDK.
+ *
+ * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
*/
void PeerHandleError_set_no_connection_possible(struct LDKPeerHandleError *NONNULL_PTR this_ptr, bool val);
* You don't have to call this function explicitly if you are using [`lightning-net-tokio`]
* or one of the other clients provided in our language bindings.
*
+ * Note that if there are any other calls to this function waiting on lock(s) this may return
+ * without doing any work. All available events that need handling will be handled before the
+ * other calls return.
+ *
* [`send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
* [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards
* [`send_data`]: SocketDescriptor::send_data
*
* The returned Vec has one entry for each HTLC, and in the same order.
*
- * This function is only valid in the holder commitment context, it always uses SigHashType::All.
+ * This function is only valid in the holder commitment context, it always uses EcdsaSighashType::All.
*/
MUST_USE_RES struct LDKCResult_CVec_SignatureZNoneZ TrustedCommitmentTransaction_get_htlc_sigs(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg, const uint8_t (*htlc_base_key)[32], const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR channel_parameters);
/**
* Set this feature as optional.
*/
-void InvoiceFeatures_set_basic_mpp_optional(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
+void InvoiceFeatures_set_basic_mpp_optional(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Set this feature as required.
+ */
+void InvoiceFeatures_set_basic_mpp_required(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Checks if this feature is supported.
+ */
+MUST_USE_RES bool InvoiceFeatures_supports_basic_mpp(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Checks if this feature is required.
+ */
+MUST_USE_RES bool InitFeatures_requires_basic_mpp(const struct LDKInitFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Checks if this feature is required.
+ */
+MUST_USE_RES bool NodeFeatures_requires_basic_mpp(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Checks if this feature is required.
+ */
+MUST_USE_RES bool InvoiceFeatures_requires_basic_mpp(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Set this feature as optional.
+ */
+void InitFeatures_set_wumbo_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Set this feature as required.
+ */
+void InitFeatures_set_wumbo_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Checks if this feature is supported.
+ */
+MUST_USE_RES bool InitFeatures_supports_wumbo(const struct LDKInitFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Set this feature as optional.
+ */
+void NodeFeatures_set_wumbo_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
/**
* Set this feature as required.
*/
-void InvoiceFeatures_set_basic_mpp_required(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
+void NodeFeatures_set_wumbo_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
/**
* Checks if this feature is supported.
*/
-MUST_USE_RES bool InvoiceFeatures_supports_basic_mpp(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
-
-/**
- * Checks if this feature is required.
- */
-MUST_USE_RES bool InitFeatures_requires_basic_mpp(const struct LDKInitFeatures *NONNULL_PTR this_arg);
+MUST_USE_RES bool NodeFeatures_supports_wumbo(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
/**
* Checks if this feature is required.
*/
-MUST_USE_RES bool NodeFeatures_requires_basic_mpp(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
+MUST_USE_RES bool InitFeatures_requires_wumbo(const struct LDKInitFeatures *NONNULL_PTR this_arg);
/**
* Checks if this feature is required.
*/
-MUST_USE_RES bool InvoiceFeatures_requires_basic_mpp(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
+MUST_USE_RES bool NodeFeatures_requires_wumbo(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
/**
* Set this feature as optional.
*/
MUST_USE_RES bool ChannelTypeFeatures_requires_scid_privacy(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
+/**
+ * Set this feature as optional.
+ */
+void InitFeatures_set_zero_conf_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Set this feature as required.
+ */
+void InitFeatures_set_zero_conf_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Checks if this feature is supported.
+ */
+MUST_USE_RES bool InitFeatures_supports_zero_conf(const struct LDKInitFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Set this feature as optional.
+ */
+void NodeFeatures_set_zero_conf_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Set this feature as required.
+ */
+void NodeFeatures_set_zero_conf_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Checks if this feature is supported.
+ */
+MUST_USE_RES bool NodeFeatures_supports_zero_conf(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Set this feature as optional.
+ */
+void ChannelTypeFeatures_set_zero_conf_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Set this feature as required.
+ */
+void ChannelTypeFeatures_set_zero_conf_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Checks if this feature is supported.
+ */
+MUST_USE_RES bool ChannelTypeFeatures_supports_zero_conf(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Checks if this feature is required.
+ */
+MUST_USE_RES bool InitFeatures_requires_zero_conf(const struct LDKInitFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Checks if this feature is required.
+ */
+MUST_USE_RES bool NodeFeatures_requires_zero_conf(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Checks if this feature is required.
+ */
+MUST_USE_RES bool ChannelTypeFeatures_requires_zero_conf(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
+
/**
* Set this feature as optional.
*/
/**
* The script that did not meet the requirements from [BOLT #2].
*
- * [BOLT #2]: https://github.com/lightningnetwork/lightning-rfc/blob/master/02-peer-protocol.md
+ * [BOLT #2]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md
*/
struct LDKu8slice InvalidShutdownScript_get_script(const struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr);
/**
* The script that did not meet the requirements from [BOLT #2].
*
- * [BOLT #2]: https://github.com/lightningnetwork/lightning-rfc/blob/master/02-peer-protocol.md
+ * [BOLT #2]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md
*/
void InvalidShutdownScript_set_script(struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
*
* This function may return an error if `program` is invalid for the segwit `version`.
*/
-MUST_USE_RES struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ ShutdownScript_new_witness_program(uint8_t version, struct LDKu8slice program);
+MUST_USE_RES struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ ShutdownScript_new_witness_program(struct LDKWitnessVersion version, struct LDKu8slice program);
/**
* Converts the shutdown script into the underlying [`Script`].
*/
void NetworkGraph_free(struct LDKNetworkGraph this_obj);
-/**
- * Creates a copy of the NetworkGraph
- */
-struct LDKNetworkGraph NetworkGraph_clone(const struct LDKNetworkGraph *NONNULL_PTR orig);
-
/**
* Frees any resources used by the ReadOnlyNetworkGraph, if is_owned is set and inner is non-NULL.
*/
struct LDKNetworkUpdate NetworkUpdate_channel_update_message(struct LDKChannelUpdate msg);
/**
- * Utility method to constructs a new ChannelClosed-variant NetworkUpdate
+ * Utility method to constructs a new ChannelFailure-variant NetworkUpdate
*/
-struct LDKNetworkUpdate NetworkUpdate_channel_closed(uint64_t short_channel_id, bool is_permanent);
+struct LDKNetworkUpdate NetworkUpdate_channel_failure(uint64_t short_channel_id, bool is_permanent);
/**
* Utility method to constructs a new NodeFailure-variant NetworkUpdate
struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ NetworkUpdate_read(struct LDKu8slice ser);
/**
- * Constructs a new EventHandler which calls the relevant methods on this_arg.
- * This copies the `inner` pointer in this_arg and thus the returned EventHandler must be freed before this_arg is
- */
-struct LDKEventHandler NetGraphMsgHandler_as_EventHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
-
-/**
- * Frees any resources used by the NetGraphMsgHandler, if is_owned is set and inner is non-NULL.
+ * Frees any resources used by the P2PGossipSync, if is_owned is set and inner is non-NULL.
*/
-void NetGraphMsgHandler_free(struct LDKNetGraphMsgHandler this_obj);
+void P2PGossipSync_free(struct LDKP2PGossipSync this_obj);
/**
* Creates a new tracker of the actual state of the network of channels and nodes,
* channel data is correct, and that the announcement is signed with
* channel owners' keys.
*/
-MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKCOption_AccessZ chain_access, struct LDKLogger logger);
+MUST_USE_RES struct LDKP2PGossipSync P2PGossipSync_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKCOption_AccessZ chain_access, struct LDKLogger logger);
/**
* Adds a provider used to check new announcements. Does not affect
* existing announcements unless they are updated.
* Add, update or remove the provider would replace the current one.
*/
-void NetGraphMsgHandler_add_chain_access(struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg, struct LDKCOption_AccessZ chain_access);
+void P2PGossipSync_add_chain_access(struct LDKP2PGossipSync *NONNULL_PTR this_arg, struct LDKCOption_AccessZ chain_access);
+
+/**
+ * Constructs a new EventHandler which calls the relevant methods on this_arg.
+ * This copies the `inner` pointer in this_arg and thus the returned EventHandler must be freed before this_arg is
+ */
+struct LDKEventHandler NetworkGraph_as_EventHandler(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
/**
* Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
* This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
*/
-struct LDKRoutingMessageHandler NetGraphMsgHandler_as_RoutingMessageHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
+struct LDKRoutingMessageHandler P2PGossipSync_as_RoutingMessageHandler(const struct LDKP2PGossipSync *NONNULL_PTR this_arg);
/**
* Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
* This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
*/
-struct LDKMessageSendEventsProvider NetGraphMsgHandler_as_MessageSendEventsProvider(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
+struct LDKMessageSendEventsProvider P2PGossipSync_as_MessageSendEventsProvider(const struct LDKP2PGossipSync *NONNULL_PTR this_arg);
/**
* Frees any resources used by the ChannelUpdateInfo, if is_owned is set and inner is non-NULL.
*/
struct LDKChannelInfo ChannelInfo_clone(const struct LDKChannelInfo *NONNULL_PTR orig);
+/**
+ * Returns a [`ChannelUpdateInfo`] based on the direction implied by the channel_flag.
+ *
+ * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
+ */
+MUST_USE_RES struct LDKChannelUpdateInfo ChannelInfo_get_directional_info(const struct LDKChannelInfo *NONNULL_PTR this_arg, uint8_t channel_flags);
+
/**
* Serialize the ChannelInfo object into a byte array which can be read by ChannelInfo_read
*/
*/
MUST_USE_RES struct LDKChannelUpdateInfo DirectedChannelInfo_direction(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg);
+/**
+ * Returns the maximum HTLC amount allowed over the channel in the direction.
+ */
+MUST_USE_RES uint64_t DirectedChannelInfo_htlc_maximum_msat(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg);
+
/**
* Returns the [`EffectiveCapacity`] of the channel in the direction.
*
* This is either the total capacity from the funding transaction, if known, or the
* `htlc_maximum_msat` for the direction as advertised by the gossip network, if known,
- * whichever is smaller.
+ * otherwise.
*/
MUST_USE_RES struct LDKEffectiveCapacity DirectedChannelInfo_effective_capacity(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg);
/**
* Read a NetworkGraph from a byte array, created by NetworkGraph_write
*/
-struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser);
+struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser, struct LDKLogger arg);
/**
* Creates a new, empty, network graph.
*/
-MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(struct LDKThirtyTwoBytes genesis_hash);
+MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(struct LDKThirtyTwoBytes genesis_hash, struct LDKLogger logger);
/**
* Returns a read-only view of the network graph.
*/
MUST_USE_RES struct LDKReadOnlyNetworkGraph NetworkGraph_read_only(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
+/**
+ * The unix timestamp provided by the most recent rapid gossip sync.
+ * It will be set by the rapid sync process after every sync completion.
+ */
+MUST_USE_RES struct LDKCOption_u32Z NetworkGraph_get_last_rapid_gossip_sync_timestamp(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
+
+/**
+ * Update the unix timestamp provided by the most recent rapid gossip sync.
+ * This should be done automatically by the rapid sync process after every sync completion.
+ */
+void NetworkGraph_set_last_rapid_gossip_sync_timestamp(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint32_t last_rapid_gossip_sync_timestamp);
+
/**
* For an already known node (from channel announcements), update its stored properties from a
* given node announcement.
*
- * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
+ * 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.
*/
/**
* Store or update channel info from a channel announcement.
*
- * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
+ * 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.
*
MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_unsigned_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg, struct LDKCOption_AccessZ chain_access);
/**
- * Close a channel if a corresponding HTLC fail was sent.
+ * Update channel from partial announcement data received via rapid gossip sync
+ *
+ * `timestamp: u64`: Timestamp emulating the backdated original announcement receipt (by the
+ * rapid gossip sync server)
+ *
+ * All other parameters as used in [`msgs::UnsignedChannelAnnouncement`] fields.
+ */
+MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_add_channel_from_partial_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, uint64_t timestamp, struct LDKChannelFeatures features, struct LDKPublicKey node_id_1, struct LDKPublicKey node_id_2);
+
+/**
+ * Marks a channel in the graph as failed if a corresponding HTLC fail was sent.
* If permanent, removes a channel from the local storage.
* May cause the removal of nodes too, if this was their last channel.
* If not permanent, makes channels unavailable for routing.
*/
-void NetworkGraph_close_channel_from_update(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, bool is_permanent);
+void NetworkGraph_channel_failed(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, bool is_permanent);
/**
* Marks a node in the graph as failed.
*/
-void NetworkGraph_fail_node(const struct LDKNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey _node_id, bool is_permanent);
+void NetworkGraph_node_failed(const struct LDKNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey _node_id, bool is_permanent);
/**
* Removes information about channels that we haven't heard any updates about in some time.
* For an already known (from announcement) channel, update info about one of the directions
* of the channel.
*
- * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
+ * 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.
*
/**
* The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
- * last RouteHop in each path must be the same.
- * Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the
- * destination. Thus, this must always be at least length one. While the maximum length of any
- * given path is variable, keeping the length of any path to less than 20 should currently
- * ensure it is viable.
+ * last RouteHop in each path must be the same. Each entry represents a list of hops, NOT
+ * INCLUDING our own, where the last hop is the destination. Thus, this must always be at
+ * least length one. While the maximum length of any given path is variable, keeping the length
+ * of any path less or equal to 19 should currently ensure it is viable.
*/
struct LDKCVec_CVec_RouteHopZZ Route_get_paths(const struct LDKRoute *NONNULL_PTR this_ptr);
/**
* The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
- * last RouteHop in each path must be the same.
- * Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the
- * destination. Thus, this must always be at least length one. While the maximum length of any
- * given path is variable, keeping the length of any path to less than 20 should currently
- * ensure it is viable.
+ * last RouteHop in each path must be the same. Each entry represents a list of hops, NOT
+ * INCLUDING our own, where the last hop is the destination. Thus, this must always be at
+ * least length one. While the maximum length of any given path is variable, keeping the length
+ * of any path less or equal to 19 should currently ensure it is viable.
*/
void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_CVec_RouteHopZZ val);
* Private routing paths between a public node and the target may be included in `params.payee`.
*
* If some channels aren't announced, it may be useful to fill in `first_hops` with the results
- * from [`ChannelManager::list_usable_channels`]. If it is filled in, the view of our local
- * channels from [`NetworkGraph`] will be ignored, and only those in `first_hops` will be used.
+ * from [`ChannelManager::list_usable_channels`]. If it is filled in, the view of these channels
+ * from `network_graph` will be ignored, and only those in `first_hops` will be used.
*
* The fees on channels from us to the next hop are ignored as they are assumed to all be equal.
* However, the enabled/disabled bit on such channels as well as the `htlc_minimum_msat` /
*
* [`ChannelManager::list_usable_channels`]: crate::ln::channelmanager::ChannelManager::list_usable_channels
* [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
+ * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph
*
* Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
-struct LDKCResult_RouteLightningErrorZ find_route(struct LDKPublicKey our_node_pubkey, const struct LDKRouteParameters *NONNULL_PTR route_params, const struct LDKNetworkGraph *NONNULL_PTR network, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKLogger logger, const struct LDKScore *NONNULL_PTR scorer, const uint8_t (*random_seed_bytes)[32]);
+struct LDKCResult_RouteLightningErrorZ find_route(struct LDKPublicKey our_node_pubkey, const struct LDKRouteParameters *NONNULL_PTR route_params, const struct LDKReadOnlyNetworkGraph *NONNULL_PTR network_graph, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKLogger logger, const struct LDKScore *NONNULL_PTR scorer, const uint8_t (*random_seed_bytes)[32]);
+
+/**
+ * Construct a route from us (payer) to the target node (payee) via the given hops (which should
+ * exclude the payer, but include the payee). This may be useful, e.g., for probing the chosen path.
+ *
+ * Re-uses logic from `find_route`, so the restrictions described there also apply here.
+ */
+struct LDKCResult_RouteLightningErrorZ build_route_from_hops(struct LDKPublicKey our_node_pubkey, struct LDKCVec_PublicKeyZ hops, const struct LDKRouteParameters *NONNULL_PTR route_params, const struct LDKReadOnlyNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger, const uint8_t (*random_seed_bytes)[32]);
/**
* Calls the free function if one is set
void MultiThreadedLockableScore_free(struct LDKMultiThreadedLockableScore this_obj);
/**
- * Creates a new [`MultiThreadedLockableScore`] given an underlying [`Score`].
- */
-MUST_USE_RES struct LDKMultiThreadedLockableScore MultiThreadedLockableScore_new(struct LDKScore score);
-
-/**
- * Frees any resources used by the FixedPenaltyScorer, if is_owned is set and inner is non-NULL.
- */
-void FixedPenaltyScorer_free(struct LDKFixedPenaltyScorer this_obj);
-
-/**
- * Creates a copy of the FixedPenaltyScorer
- */
-struct LDKFixedPenaltyScorer FixedPenaltyScorer_clone(const struct LDKFixedPenaltyScorer *NONNULL_PTR orig);
-
-/**
- * Creates a new scorer using `penalty_msat`.
- */
-MUST_USE_RES struct LDKFixedPenaltyScorer FixedPenaltyScorer_with_penalty(uint64_t penalty_msat);
-
-/**
- * Constructs a new Score which calls the relevant methods on this_arg.
- * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is
- */
-struct LDKScore FixedPenaltyScorer_as_Score(const struct LDKFixedPenaltyScorer *NONNULL_PTR this_arg);
-
-/**
- * Serialize the FixedPenaltyScorer object into a byte array which can be read by FixedPenaltyScorer_read
- */
-struct LDKCVec_u8Z FixedPenaltyScorer_write(const struct LDKFixedPenaltyScorer *NONNULL_PTR obj);
-
-/**
- * Read a FixedPenaltyScorer from a byte array, created by FixedPenaltyScorer_write
- */
-struct LDKCResult_FixedPenaltyScorerDecodeErrorZ FixedPenaltyScorer_read(struct LDKu8slice ser, uint64_t arg);
-
-/**
- * Frees any resources used by the Scorer, if is_owned is set and inner is non-NULL.
- */
-void Scorer_free(struct LDKScorer this_obj);
-
-/**
- * Frees any resources used by the ScoringParameters, if is_owned is set and inner is non-NULL.
- */
-void ScoringParameters_free(struct LDKScoringParameters this_obj);
-
-/**
- * A fixed penalty in msats to apply to each channel.
- *
- * Default value: 500 msat
- */
-uint64_t ScoringParameters_get_base_penalty_msat(const struct LDKScoringParameters *NONNULL_PTR this_ptr);
-
-/**
- * A fixed penalty in msats to apply to each channel.
- *
- * Default value: 500 msat
- */
-void ScoringParameters_set_base_penalty_msat(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
-
-/**
- * A penalty in msats to apply to a channel upon failing to relay a payment.
- *
- * This accumulates for each failure but may be reduced over time based on
- * [`failure_penalty_half_life`] or when successfully routing through a channel.
- *
- * Default value: 1,024,000 msat
- *
- * [`failure_penalty_half_life`]: Self::failure_penalty_half_life
- */
-uint64_t ScoringParameters_get_failure_penalty_msat(const struct LDKScoringParameters *NONNULL_PTR this_ptr);
-
-/**
- * A penalty in msats to apply to a channel upon failing to relay a payment.
- *
- * This accumulates for each failure but may be reduced over time based on
- * [`failure_penalty_half_life`] or when successfully routing through a channel.
- *
- * Default value: 1,024,000 msat
- *
- * [`failure_penalty_half_life`]: Self::failure_penalty_half_life
+ * Serialize the MultiThreadedLockableScore object into a byte array which can be read by MultiThreadedLockableScore_read
*/
-void ScoringParameters_set_failure_penalty_msat(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
+struct LDKCVec_u8Z MultiThreadedLockableScore_write(const struct LDKMultiThreadedLockableScore *NONNULL_PTR obj);
/**
- * When the amount being sent over a channel is this many 1024ths of the total channel
- * capacity, we begin applying [`overuse_penalty_msat_per_1024th`].
- *
- * Default value: 128 1024ths (i.e. begin penalizing when an HTLC uses 1/8th of a channel)
- *
- * [`overuse_penalty_msat_per_1024th`]: Self::overuse_penalty_msat_per_1024th
+ * Creates a new [`MultiThreadedLockableScore`] given an underlying [`Score`].
*/
-uint16_t ScoringParameters_get_overuse_penalty_start_1024th(const struct LDKScoringParameters *NONNULL_PTR this_ptr);
+MUST_USE_RES struct LDKMultiThreadedLockableScore MultiThreadedLockableScore_new(struct LDKScore score);
/**
- * When the amount being sent over a channel is this many 1024ths of the total channel
- * capacity, we begin applying [`overuse_penalty_msat_per_1024th`].
- *
- * Default value: 128 1024ths (i.e. begin penalizing when an HTLC uses 1/8th of a channel)
- *
- * [`overuse_penalty_msat_per_1024th`]: Self::overuse_penalty_msat_per_1024th
+ * Frees any resources used by the ChannelUsage, if is_owned is set and inner is non-NULL.
*/
-void ScoringParameters_set_overuse_penalty_start_1024th(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint16_t val);
+void ChannelUsage_free(struct LDKChannelUsage this_obj);
/**
- * A penalty applied, per whole 1024ths of the channel capacity which the amount being sent
- * over the channel exceeds [`overuse_penalty_start_1024th`] by.
- *
- * Default value: 20 msat (i.e. 2560 msat penalty to use 1/4th of a channel, 7680 msat penalty
- * to use half a channel, and 12,560 msat penalty to use 3/4ths of a channel)
- *
- * [`overuse_penalty_start_1024th`]: Self::overuse_penalty_start_1024th
+ * The amount to send through the channel, denominated in millisatoshis.
*/
-uint64_t ScoringParameters_get_overuse_penalty_msat_per_1024th(const struct LDKScoringParameters *NONNULL_PTR this_ptr);
+uint64_t ChannelUsage_get_amount_msat(const struct LDKChannelUsage *NONNULL_PTR this_ptr);
/**
- * A penalty applied, per whole 1024ths of the channel capacity which the amount being sent
- * over the channel exceeds [`overuse_penalty_start_1024th`] by.
- *
- * Default value: 20 msat (i.e. 2560 msat penalty to use 1/4th of a channel, 7680 msat penalty
- * to use half a channel, and 12,560 msat penalty to use 3/4ths of a channel)
- *
- * [`overuse_penalty_start_1024th`]: Self::overuse_penalty_start_1024th
+ * The amount to send through the channel, denominated in millisatoshis.
*/
-void ScoringParameters_set_overuse_penalty_msat_per_1024th(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
+void ChannelUsage_set_amount_msat(struct LDKChannelUsage *NONNULL_PTR this_ptr, uint64_t val);
/**
- * The time required to elapse before any accumulated [`failure_penalty_msat`] penalties are
- * cut in half.
- *
- * Successfully routing through a channel will immediately cut the penalty in half as well.
- *
- * Default value: 1 hour
- *
- * # Note
- *
- * When built with the `no-std` feature, time will never elapse. Therefore, this penalty will
- * never decay.
- *
- * [`failure_penalty_msat`]: Self::failure_penalty_msat
+ * Total amount, denominated in millisatoshis, already allocated to send through the channel
+ * as part of a multi-path payment.
*/
-uint64_t ScoringParameters_get_failure_penalty_half_life(const struct LDKScoringParameters *NONNULL_PTR this_ptr);
+uint64_t ChannelUsage_get_inflight_htlc_msat(const struct LDKChannelUsage *NONNULL_PTR this_ptr);
/**
- * The time required to elapse before any accumulated [`failure_penalty_msat`] penalties are
- * cut in half.
- *
- * Successfully routing through a channel will immediately cut the penalty in half as well.
- *
- * Default value: 1 hour
- *
- * # Note
- *
- * When built with the `no-std` feature, time will never elapse. Therefore, this penalty will
- * never decay.
- *
- * [`failure_penalty_msat`]: Self::failure_penalty_msat
+ * Total amount, denominated in millisatoshis, already allocated to send through the channel
+ * as part of a multi-path payment.
*/
-void ScoringParameters_set_failure_penalty_half_life(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
+void ChannelUsage_set_inflight_htlc_msat(struct LDKChannelUsage *NONNULL_PTR this_ptr, uint64_t val);
/**
- * Constructs a new ScoringParameters given each field
+ * The effective capacity of the channel.
*/
-MUST_USE_RES struct LDKScoringParameters ScoringParameters_new(uint64_t base_penalty_msat_arg, uint64_t failure_penalty_msat_arg, uint16_t overuse_penalty_start_1024th_arg, uint64_t overuse_penalty_msat_per_1024th_arg, uint64_t failure_penalty_half_life_arg);
+struct LDKEffectiveCapacity ChannelUsage_get_effective_capacity(const struct LDKChannelUsage *NONNULL_PTR this_ptr);
/**
- * Creates a copy of the ScoringParameters
+ * The effective capacity of the channel.
*/
-struct LDKScoringParameters ScoringParameters_clone(const struct LDKScoringParameters *NONNULL_PTR orig);
+void ChannelUsage_set_effective_capacity(struct LDKChannelUsage *NONNULL_PTR this_ptr, struct LDKEffectiveCapacity val);
/**
- * Serialize the ScoringParameters object into a byte array which can be read by ScoringParameters_read
+ * Constructs a new ChannelUsage given each field
*/
-struct LDKCVec_u8Z ScoringParameters_write(const struct LDKScoringParameters *NONNULL_PTR obj);
+MUST_USE_RES struct LDKChannelUsage ChannelUsage_new(uint64_t amount_msat_arg, uint64_t inflight_htlc_msat_arg, struct LDKEffectiveCapacity effective_capacity_arg);
/**
- * Read a ScoringParameters from a byte array, created by ScoringParameters_write
+ * Creates a copy of the ChannelUsage
*/
-struct LDKCResult_ScoringParametersDecodeErrorZ ScoringParameters_read(struct LDKu8slice ser);
+struct LDKChannelUsage ChannelUsage_clone(const struct LDKChannelUsage *NONNULL_PTR orig);
/**
- * Creates a new scorer using the given scoring parameters.
+ * Frees any resources used by the FixedPenaltyScorer, if is_owned is set and inner is non-NULL.
*/
-MUST_USE_RES struct LDKScorer Scorer_new(struct LDKScoringParameters params);
+void FixedPenaltyScorer_free(struct LDKFixedPenaltyScorer this_obj);
/**
- * Creates a "default" Scorer. See struct and individual field documentaiton for details on which values are used.
+ * Creates a copy of the FixedPenaltyScorer
*/
-MUST_USE_RES struct LDKScorer Scorer_default(void);
+struct LDKFixedPenaltyScorer FixedPenaltyScorer_clone(const struct LDKFixedPenaltyScorer *NONNULL_PTR orig);
/**
- * Creates a "default" ScoringParameters. See struct and individual field documentaiton for details on which values are used.
+ * Creates a new scorer using `penalty_msat`.
*/
-MUST_USE_RES struct LDKScoringParameters ScoringParameters_default(void);
+MUST_USE_RES struct LDKFixedPenaltyScorer FixedPenaltyScorer_with_penalty(uint64_t penalty_msat);
/**
* Constructs a new Score which calls the relevant methods on this_arg.
* This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is
*/
-struct LDKScore Scorer_as_Score(const struct LDKScorer *NONNULL_PTR this_arg);
+struct LDKScore FixedPenaltyScorer_as_Score(const struct LDKFixedPenaltyScorer *NONNULL_PTR this_arg);
/**
- * Serialize the Scorer object into a byte array which can be read by Scorer_read
+ * Serialize the FixedPenaltyScorer object into a byte array which can be read by FixedPenaltyScorer_read
*/
-struct LDKCVec_u8Z Scorer_write(const struct LDKScorer *NONNULL_PTR obj);
+struct LDKCVec_u8Z FixedPenaltyScorer_write(const struct LDKFixedPenaltyScorer *NONNULL_PTR obj);
/**
- * Read a Scorer from a byte array, created by Scorer_write
+ * Read a FixedPenaltyScorer from a byte array, created by FixedPenaltyScorer_write
*/
-struct LDKCResult_ScorerDecodeErrorZ Scorer_read(struct LDKu8slice ser);
+struct LDKCResult_FixedPenaltyScorerDecodeErrorZ FixedPenaltyScorer_read(struct LDKu8slice ser, uint64_t arg);
/**
* Frees any resources used by the ProbabilisticScorer, if is_owned is set and inner is non-NULL.
* Creates a new scorer using the given scoring parameters for sending payments from a node
* through a network graph.
*/
-MUST_USE_RES struct LDKProbabilisticScorer ProbabilisticScorer_new(struct LDKProbabilisticScoringParameters params, const struct LDKNetworkGraph *NONNULL_PTR network_graph);
+MUST_USE_RES struct LDKProbabilisticScorer ProbabilisticScorer_new(struct LDKProbabilisticScoringParameters params, const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger);
+
+/**
+ * Dump the contents of this scorer into the configured logger.
+ *
+ * Note that this writes roughly one line per channel for which we have a liquidity estimate,
+ * which may be a substantial amount of log output.
+ */
+void ProbabilisticScorer_debug_log_liquidity_stats(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg);
/**
* Creates a "default" ProbabilisticScoringParameters. See struct and individual field documentaiton for details on which values are used.
/**
* Read a ProbabilisticScorer from a byte array, created by ProbabilisticScorer_write
*/
-struct LDKCResult_ProbabilisticScorerDecodeErrorZ ProbabilisticScorer_read(struct LDKu8slice ser, struct LDKProbabilisticScoringParameters arg_a, const struct LDKNetworkGraph *NONNULL_PTR arg_b);
+struct LDKCResult_ProbabilisticScorerDecodeErrorZ ProbabilisticScorer_read(struct LDKu8slice ser, struct LDKProbabilisticScoringParameters arg_a, const struct LDKNetworkGraph *NONNULL_PTR arg_b, struct LDKLogger arg_c);
/**
* Frees any resources used by the FilesystemPersister, if is_owned is set and inner is non-NULL.
MUST_USE_RES struct LDKStr FilesystemPersister_get_data_dir(const struct LDKFilesystemPersister *NONNULL_PTR this_arg);
/**
- * Writes the provided `ChannelManager` to the path provided at `FilesystemPersister`
- * initialization, within a file called \"manager\".
+ * Read `ChannelMonitor`s from disk.
*/
-MUST_USE_RES struct LDKCResult_NoneErrorZ FilesystemPersister_persist_manager(struct LDKStr data_dir, const struct LDKChannelManager *NONNULL_PTR manager);
+MUST_USE_RES struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ FilesystemPersister_read_channelmonitors(const struct LDKFilesystemPersister *NONNULL_PTR this_arg, struct LDKKeysInterface keys_manager);
/**
- * Write the provided `NetworkGraph` to the path provided at `FilesystemPersister`
- * initialization, within a file called \"network_graph\"
+ * Frees any resources used by the BackgroundProcessor, if is_owned is set and inner is non-NULL.
*/
-MUST_USE_RES struct LDKCResult_NoneErrorZ FilesystemPersister_persist_network_graph(struct LDKStr data_dir, const struct LDKNetworkGraph *NONNULL_PTR network_graph);
+void BackgroundProcessor_free(struct LDKBackgroundProcessor this_obj);
/**
- * Read `ChannelMonitor`s from disk.
+ * Frees any resources used by the GossipSync
*/
-MUST_USE_RES struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ FilesystemPersister_read_channelmonitors(const struct LDKFilesystemPersister *NONNULL_PTR this_arg, struct LDKKeysInterface keys_manager);
+void GossipSync_free(struct LDKGossipSync this_ptr);
/**
- * Constructs a new Persist which calls the relevant methods on this_arg.
- * This copies the `inner` pointer in this_arg and thus the returned Persist must be freed before this_arg is
+ * Utility method to constructs a new P2P-variant GossipSync
*/
-struct LDKPersist FilesystemPersister_as_Persist(const struct LDKFilesystemPersister *NONNULL_PTR this_arg);
+struct LDKGossipSync GossipSync_p2_p(const struct LDKP2PGossipSync *NONNULL_PTR a);
/**
- * Frees any resources used by the BackgroundProcessor, if is_owned is set and inner is non-NULL.
+ * Utility method to constructs a new Rapid-variant GossipSync
*/
-void BackgroundProcessor_free(struct LDKBackgroundProcessor this_obj);
+struct LDKGossipSync GossipSync_rapid(const struct LDKRapidGossipSync *NONNULL_PTR a);
/**
- * Calls the free function if one is set
+ * Utility method to constructs a new None-variant GossipSync
*/
-void Persister_free(struct LDKPersister this_ptr);
+struct LDKGossipSync GossipSync_none(void);
/**
* Start a background thread that takes care of responsibilities enumerated in the [top-level
*
* [`Persister::persist_manager`] is responsible for writing out the [`ChannelManager`] to disk, and/or
* uploading to one or more backup services. See [`ChannelManager::write`] for writing out a
- * [`ChannelManager`]. See [`FilesystemPersister::persist_manager`] for Rust-Lightning's
+ * [`ChannelManager`]. See the `lightning-persister` crate for LDK's
* provided implementation.
*
- * [`Persister::persist_graph`] is responsible for writing out the [`NetworkGraph`] to disk. See
- * [`NetworkGraph::write`] for writing out a [`NetworkGraph`]. See [`FilesystemPersister::persist_network_graph`]
- * for Rust-Lightning's provided implementation.
+ * [`Persister::persist_graph`] is responsible for writing out the [`NetworkGraph`] to disk, if
+ * [`GossipSync`] is supplied. See [`NetworkGraph::write`] for writing out a [`NetworkGraph`].
+ * See the `lightning-persister` crate for LDK's provided implementation.
*
* Typically, users should either implement [`Persister::persist_manager`] to never return an
* error or call [`join`] and handle any error that may arise. For the latter case,
* `event_handler` is responsible for handling events that users should be notified of (e.g.,
* payment failed). [`BackgroundProcessor`] may decorate the given [`EventHandler`] with common
* functionality implemented by other handlers.
- * * [`NetGraphMsgHandler`] if given will update the [`NetworkGraph`] based on payment failures.
+ * * [`P2PGossipSync`] if given will update the [`NetworkGraph`] based on payment failures.
+ *
+ * # Rapid Gossip Sync
+ *
+ * If rapid gossip sync is meant to run at startup, pass a [`RapidGossipSync`] to `gossip_sync`
+ * to indicate that the [`BackgroundProcessor`] should not prune the [`NetworkGraph`] instance
+ * until the [`RapidGossipSync`] instance completes its first sync.
*
* [top-level documentation]: BackgroundProcessor
* [`join`]: Self::join
* [`stop`]: Self::stop
* [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
* [`ChannelManager::write`]: lightning::ln::channelmanager::ChannelManager#impl-Writeable
- * [`FilesystemPersister::persist_manager`]: lightning_persister::FilesystemPersister::persist_manager
- * [`FilesystemPersister::persist_network_graph`]: lightning_persister::FilesystemPersister::persist_network_graph
- * [`NetworkGraph`]: lightning::routing::network_graph::NetworkGraph
- * [`NetworkGraph::write`]: lightning::routing::network_graph::NetworkGraph#impl-Writeable
+ * [`Persister::persist_manager`]: lightning::util::persist::Persister::persist_manager
+ * [`Persister::persist_graph`]: lightning::util::persist::Persister::persist_graph
+ * [`NetworkGraph`]: lightning::routing::gossip::NetworkGraph
+ * [`NetworkGraph::write`]: lightning::routing::gossip::NetworkGraph#impl-Writeable
*
- * Note that net_graph_msg_handler (or a relevant inner pointer) may be NULL or all-0s to represent None
+ * Note that scorer (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
-MUST_USE_RES struct LDKBackgroundProcessor BackgroundProcessor_start(struct LDKPersister persister, struct LDKEventHandler event_handler, const struct LDKChainMonitor *NONNULL_PTR chain_monitor, const struct LDKChannelManager *NONNULL_PTR channel_manager, struct LDKNetGraphMsgHandler net_graph_msg_handler, const struct LDKPeerManager *NONNULL_PTR peer_manager, struct LDKLogger logger);
+MUST_USE_RES struct LDKBackgroundProcessor BackgroundProcessor_start(struct LDKPersister persister, struct LDKEventHandler event_handler, const struct LDKChainMonitor *NONNULL_PTR chain_monitor, const struct LDKChannelManager *NONNULL_PTR channel_manager, struct LDKGossipSync gossip_sync, const struct LDKPeerManager *NONNULL_PTR peer_manager, struct LDKLogger logger, struct LDKMultiThreadedLockableScore scorer);
/**
* Join `BackgroundProcessor`'s thread, returning any error that occurred while persisting
void Router_free(struct LDKRouter this_ptr);
/**
- * Frees any resources used by the RetryAttempts, if is_owned is set and inner is non-NULL.
+ * Frees any resources used by the Retry
*/
-void RetryAttempts_free(struct LDKRetryAttempts this_obj);
+void Retry_free(struct LDKRetry this_ptr);
-uintptr_t RetryAttempts_get_a(const struct LDKRetryAttempts *NONNULL_PTR this_ptr);
-
-void RetryAttempts_set_a(struct LDKRetryAttempts *NONNULL_PTR this_ptr, uintptr_t val);
+/**
+ * Creates a copy of the Retry
+ */
+struct LDKRetry Retry_clone(const struct LDKRetry *NONNULL_PTR orig);
/**
- * Constructs a new RetryAttempts given each field
+ * Utility method to constructs a new Attempts-variant Retry
*/
-MUST_USE_RES struct LDKRetryAttempts RetryAttempts_new(uintptr_t a_arg);
+struct LDKRetry Retry_attempts(uintptr_t a);
/**
- * Creates a copy of the RetryAttempts
+ * Utility method to constructs a new Timeout-variant Retry
*/
-struct LDKRetryAttempts RetryAttempts_clone(const struct LDKRetryAttempts *NONNULL_PTR orig);
+struct LDKRetry Retry_timeout(uint64_t a);
/**
- * Checks if two RetryAttemptss contain equal inner contents.
+ * Checks if two Retrys contain equal inner contents.
* This ignores pointers and is_owned flags and looks at the values in fields.
- * Two objects with NULL inner values will be considered "equal" here.
*/
-bool RetryAttempts_eq(const struct LDKRetryAttempts *NONNULL_PTR a, const struct LDKRetryAttempts *NONNULL_PTR b);
+bool Retry_eq(const struct LDKRetry *NONNULL_PTR a, const struct LDKRetry *NONNULL_PTR b);
/**
- * Checks if two RetryAttemptss contain equal inner contents.
+ * Checks if two Retrys contain equal inner contents.
*/
-uint64_t RetryAttempts_hash(const struct LDKRetryAttempts *NONNULL_PTR o);
+uint64_t Retry_hash(const struct LDKRetry *NONNULL_PTR o);
/**
* Frees any resources used by the PaymentError
* Creates an invoice payer that retries failed payment paths.
*
* Will forward any [`Event::PaymentPathFailed`] events to the decorated `event_handler` once
- * `retry_attempts` has been exceeded for a given [`Invoice`].
+ * `retry` has been exceeded for a given [`Invoice`].
*/
-MUST_USE_RES struct LDKInvoicePayer InvoicePayer_new(struct LDKPayer payer, struct LDKRouter router, const struct LDKMultiThreadedLockableScore *NONNULL_PTR scorer, struct LDKLogger logger, struct LDKEventHandler event_handler, struct LDKRetryAttempts retry_attempts);
+MUST_USE_RES struct LDKInvoicePayer InvoicePayer_new(struct LDKPayer payer, struct LDKRouter router, const struct LDKMultiThreadedLockableScore *NONNULL_PTR scorer, struct LDKLogger logger, struct LDKEventHandler event_handler, struct LDKRetry retry);
/**
* Pays the given [`Invoice`], caching it for later use in case a retry is needed.
* may be too long for QR code scanning. To fix this, `PhantomRouteHints::channels` may be pared
* down
*
- * `payment_hash` and `payment_secret` come from [`ChannelManager::create_inbound_payment`] or
- * [`ChannelManager::create_inbound_payment_for_hash`]. These values can be retrieved from any
- * participating node.
+ * `payment_hash` can be specified if you have a specific need for a custom payment hash (see the difference
+ * between [`ChannelManager::create_inbound_payment`] and [`ChannelManager::create_inbound_payment_for_hash`]).
+ * If `None` is provided for `payment_hash`, then one will be created.
+ *
+ * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
+ * in excess of the current time.
*
* Note that the provided `keys_manager`'s `KeysInterface` implementation must support phantom
* invoices in its `sign_invoice` implementation ([`PhantomKeysManager`] satisfies this
*
* [`PhantomKeysManager`]: lightning::chain::keysinterface::PhantomKeysManager
* [`ChannelManager::get_phantom_route_hints`]: lightning::ln::channelmanager::ChannelManager::get_phantom_route_hints
+ * [`ChannelManager::create_inbound_payment`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment
+ * [`ChannelManager::create_inbound_payment_for_hash`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
* [`PhantomRouteHints::channels`]: lightning::ln::channelmanager::PhantomRouteHints::channels
+ *
+ * Note that payment_hash (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
-struct LDKCResult_InvoiceSignOrCreationErrorZ create_phantom_invoice(struct LDKCOption_u64Z amt_msat, struct LDKStr description, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret, struct LDKCVec_PhantomRouteHintsZ phantom_route_hints, struct LDKKeysInterface keys_manager, enum LDKCurrency network);
+struct LDKCResult_InvoiceSignOrCreationErrorZ create_phantom_invoice(struct LDKCOption_u64Z amt_msat, struct LDKThirtyTwoBytes payment_hash, struct LDKStr description, uint32_t invoice_expiry_delta_secs, struct LDKCVec_PhantomRouteHintsZ phantom_route_hints, struct LDKKeysInterface keys_manager, enum LDKCurrency network);
/**
* Utility to create an invoice that can be paid to one of multiple nodes, or a \"phantom invoice.\"
*
* `description_hash` is a SHA-256 hash of the description text
*
- * `payment_hash` and `payment_secret` come from [`ChannelManager::create_inbound_payment`] or
- * [`ChannelManager::create_inbound_payment_for_hash`]. These values can be retrieved from any
- * participating node.
+ * `payment_hash` can be specified if you have a specific need for a custom payment hash (see the difference
+ * between [`ChannelManager::create_inbound_payment`] and [`ChannelManager::create_inbound_payment_for_hash`]).
+ * If `None` is provided for `payment_hash`, then one will be created.
+ *
+ * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
+ * in excess of the current time.
*
* Note that the provided `keys_manager`'s `KeysInterface` implementation must support phantom
* invoices in its `sign_invoice` implementation ([`PhantomKeysManager`] satisfies this
*
* [`PhantomKeysManager`]: lightning::chain::keysinterface::PhantomKeysManager
* [`ChannelManager::get_phantom_route_hints`]: lightning::ln::channelmanager::ChannelManager::get_phantom_route_hints
+ * [`ChannelManager::create_inbound_payment`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment
+ * [`ChannelManager::create_inbound_payment_for_hash`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
* [`PhantomRouteHints::channels`]: lightning::ln::channelmanager::PhantomRouteHints::channels
+ *
+ * Note that payment_hash (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
-struct LDKCResult_InvoiceSignOrCreationErrorZ create_phantom_invoice_with_description_hash(struct LDKCOption_u64Z amt_msat, struct LDKSha256 description_hash, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret, struct LDKCVec_PhantomRouteHintsZ phantom_route_hints, struct LDKKeysInterface keys_manager, enum LDKCurrency network);
+struct LDKCResult_InvoiceSignOrCreationErrorZ create_phantom_invoice_with_description_hash(struct LDKCOption_u64Z amt_msat, struct LDKThirtyTwoBytes payment_hash, uint32_t invoice_expiry_delta_secs, struct LDKSha256 description_hash, struct LDKCVec_PhantomRouteHintsZ phantom_route_hints, struct LDKKeysInterface keys_manager, enum LDKCurrency network);
/**
* Utility to construct an invoice. Generally, unless you want to do something like a custom
* method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user
* doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify
* that the payment secret is valid when the invoice is paid.
+ *
+ * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
+ * in excess of the current time.
*/
-struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKKeysInterface keys_manager, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKStr description);
+struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKKeysInterface keys_manager, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKStr description, uint32_t invoice_expiry_delta_secs);
/**
* Utility to construct an invoice. Generally, unless you want to do something like a custom
* doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify
* that the payment secret is valid when the invoice is paid.
* Use this variant if you want to pass the `description_hash` to the invoice.
+ *
+ * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
+ * in excess of the current time.
*/
-struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_with_description_hash(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKKeysInterface keys_manager, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKSha256 description_hash);
+struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_with_description_hash(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKKeysInterface keys_manager, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKSha256 description_hash, uint32_t invoice_expiry_delta_secs);
/**
* See [`create_invoice_from_channelmanager_with_description_hash`]
* This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not
* available and the current time is supplied by the caller.
*/
-struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKKeysInterface keys_manager, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKSha256 description_hash, uint64_t duration_since_epoch);
+struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKKeysInterface keys_manager, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKSha256 description_hash, uint64_t duration_since_epoch, uint32_t invoice_expiry_delta_secs);
/**
* See [`create_invoice_from_channelmanager`]
* This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not
* available and the current time is supplied by the caller.
*/
-struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_and_duration_since_epoch(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKKeysInterface keys_manager, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKStr description, uint64_t duration_since_epoch);
+struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_and_duration_since_epoch(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKKeysInterface keys_manager, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKStr description, uint64_t duration_since_epoch, uint32_t invoice_expiry_delta_secs);
/**
* Frees any resources used by the DefaultRouter, if is_owned is set and inner is non-NULL.
*/
struct LDKStr SiPrefix_to_str(const enum LDKSiPrefix *NONNULL_PTR o);
+/**
+ * Frees any resources used by the RapidGossipSync, if is_owned is set and inner is non-NULL.
+ */
+void RapidGossipSync_free(struct LDKRapidGossipSync this_obj);
+
+/**
+ * Instantiate a new [`RapidGossipSync`] instance
+ */
+MUST_USE_RES struct LDKRapidGossipSync RapidGossipSync_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph);
+
+/**
+ * Sync gossip data from a file
+ * Returns the last sync timestamp to be used the next time rapid sync data is queried.
+ *
+ * `network_graph`: The network graph to apply the updates to
+ *
+ * `sync_path`: Path to the file where the gossip update data is located
+ *
+ */
+MUST_USE_RES struct LDKCResult_u32GraphSyncErrorZ RapidGossipSync_sync_network_graph_with_file_path(const struct LDKRapidGossipSync *NONNULL_PTR this_arg, struct LDKStr sync_path);
+
+/**
+ * Returns whether a rapid gossip sync has completed at least once
+ */
+MUST_USE_RES bool RapidGossipSync_is_initial_sync_complete(const struct LDKRapidGossipSync *NONNULL_PTR this_arg);
+
+/**
+ * Frees any resources used by the GraphSyncError
+ */
+void GraphSyncError_free(struct LDKGraphSyncError this_ptr);
+
+/**
+ * Creates a copy of the GraphSyncError
+ */
+struct LDKGraphSyncError GraphSyncError_clone(const struct LDKGraphSyncError *NONNULL_PTR orig);
+
+/**
+ * Utility method to constructs a new DecodeError-variant GraphSyncError
+ */
+struct LDKGraphSyncError GraphSyncError_decode_error(struct LDKDecodeError a);
+
+/**
+ * Utility method to constructs a new LightningError-variant GraphSyncError
+ */
+struct LDKGraphSyncError GraphSyncError_lightning_error(struct LDKLightningError a);
+
+/**
+ * Update network graph from binary data.
+ * Returns the last sync timestamp to be used the next time rapid sync data is queried.
+ *
+ * `network_graph`: network graph to be updated
+ *
+ * `update_data`: `&[u8]` binary stream that comprises the update data
+ */
+MUST_USE_RES struct LDKCResult_u32GraphSyncErrorZ RapidGossipSync_update_network_graph(const struct LDKRapidGossipSync *NONNULL_PTR this_arg, struct LDKu8slice update_data);
+
#endif /* LDK_C_BINDINGS_H */
#include "ldk_ver.h"
class ShutdownScript;
class InvalidShutdownScript;
class BackgroundProcessor;
-class Persister;
+class GossipSync;
class RouteHop;
class Route;
class RouteParameters;
class BroadcasterInterface;
class ConfirmationTarget;
class FeeEstimator;
+class PaymentPurpose;
+class ClosureReason;
+class Event;
+class MessageSendEvent;
+class MessageSendEventsProvider;
+class EventsProvider;
+class EventHandler;
class BestBlock;
class AccessError;
class Access;
class Watch;
class Filter;
class WatchedOutput;
-class PaymentPurpose;
-class ClosureReason;
-class Event;
-class MessageSendEvent;
-class MessageSendEventsProvider;
-class EventsProvider;
-class EventHandler;
class Score;
class LockableScore;
class MultiThreadedLockableScore;
+class ChannelUsage;
class FixedPenaltyScorer;
-class Scorer;
-class ScoringParameters;
class ProbabilisticScorer;
class ProbabilisticScoringParameters;
class InitFeatures;
class ChannelFeatures;
class InvoiceFeatures;
class ChannelTypeFeatures;
+class NodeId;
+class NetworkGraph;
+class ReadOnlyNetworkGraph;
+class NetworkUpdate;
+class P2PGossipSync;
+class ChannelUpdateInfo;
+class ChannelInfo;
+class DirectedChannelInfo;
+class EffectiveCapacity;
+class RoutingFees;
+class NodeAnnouncementInfo;
+class NodeInfo;
class DelayedPaymentOutputDescriptor;
class StaticPaymentOutputDescriptor;
class SpendableOutputDescriptor;
class ChannelConfig;
class UserConfig;
class APIError;
+class BigSize;
class OutPoint;
class CustomMessageReader;
class Type;
class InvoicePayer;
class Payer;
class Router;
-class RetryAttempts;
+class Retry;
class PaymentError;
class ParseError;
class ParseOrSemanticError;
class HTLCUpdate;
class Balance;
class ChannelMonitor;
+class ExpandedKey;
class CustomMessageHandler;
class IgnoringMessageHandler;
class ErroringMessageHandler;
class SocketDescriptor;
class PeerHandleError;
class PeerManager;
-class NodeId;
-class NetworkGraph;
-class ReadOnlyNetworkGraph;
-class NetworkUpdate;
-class NetGraphMsgHandler;
-class ChannelUpdateInfo;
-class ChannelInfo;
-class DirectedChannelInfo;
-class EffectiveCapacity;
-class RoutingFees;
-class NodeAnnouncementInfo;
-class NodeInfo;
+class RapidGossipSync;
+class Persister;
class DecodeError;
class Init;
class ErrorMessage;
class AcceptChannel;
class FundingCreated;
class FundingSigned;
-class FundingLocked;
+class ChannelReady;
class Shutdown;
class ClosingSignedFeeRange;
class ClosingSigned;
class CommitmentUpdate;
class ChannelMessageHandler;
class RoutingMessageHandler;
+class GraphSyncError;
class DefaultRouter;
class Level;
class Record;
class CResult_LockedChannelMonitorNoneZ;
class CResult_PhantomRouteHintsDecodeErrorZ;
class CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ;
-class CResult_ScoringParametersDecodeErrorZ;
+class CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ;
class CResult_HTLCUpdateDecodeErrorZ;
class C2Tuple_SignatureCVec_SignatureZZ;
-class CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ;
class CVec_C2Tuple_u32TxOutZZ;
class CResult_ChannelInfoDecodeErrorZ;
class CResult_FundingCreatedDecodeErrorZ;
class CResult_CommitmentSignedDecodeErrorZ;
class CVec_UpdateAddHTLCZ;
class CResult_UnsignedNodeAnnouncementDecodeErrorZ;
-class COption_u32Z;
class CResult_InitFeaturesDecodeErrorZ;
+class COption_u32Z;
class CResult_StaticPaymentOutputDescriptorDecodeErrorZ;
class CResult_PaymentIdPaymentSendFailureZ;
class CResult_ReplyChannelRangeDecodeErrorZ;
class CResult_ChannelFeaturesDecodeErrorZ;
class CVec_ChannelMonitorZ;
class CVec_TransactionZ;
-class CResult_UpdateFeeDecodeErrorZ;
+class CResult_ChannelReadyDecodeErrorZ;
class CResult_RouteHopDecodeErrorZ;
+class CResult_UpdateFeeDecodeErrorZ;
class CResult_NodeAnnouncementDecodeErrorZ;
class CVec_BalanceZ;
class CResult_HTLCOutputInCommitmentDecodeErrorZ;
class CResult_boolLightningErrorZ;
class CResult_TxCreationKeysErrorZ;
-class C2Tuple_BlockHashChannelMonitorZ;
class CResult_NodeIdDecodeErrorZ;
+class C2Tuple_BlockHashChannelMonitorZ;
class CResult_ShutdownScriptInvalidShutdownScriptZ;
-class CResult_RecoverableSignatureNoneZ;
-class CResult_COption_NetworkUpdateZDecodeErrorZ;
class CResult_NodeAnnouncementInfoDecodeErrorZ;
+class CResult_COption_NetworkUpdateZDecodeErrorZ;
+class CResult_RecoverableSignatureNoneZ;
class C3Tuple_RawInvoice_u832InvoiceSignatureZ;
class CVec_UpdateFailMalformedHTLCZ;
class CResult_FundingSignedDecodeErrorZ;
class CResult_NetworkGraphDecodeErrorZ;
class CVec_RouteHopZ;
+class CResult_NodeInfoDecodeErrorZ;
class CVec_C2Tuple_BlockHashChannelMonitorZZ;
-class CResult_NonePaymentSendFailureZ;
class CResult_RouteLightningErrorZ;
class CResult_ChannelPublicKeysDecodeErrorZ;
class CVec_u8Z;
-class CResult_NodeInfoDecodeErrorZ;
+class CResult_NonePaymentSendFailureZ;
class CResult_ClosingSignedDecodeErrorZ;
class CResult_HolderCommitmentTransactionDecodeErrorZ;
class CVec_CResult_NoneAPIErrorZZ;
class CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ;
class C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ;
class CResult_PaymentParametersDecodeErrorZ;
+class CResult_PaymentPurposeDecodeErrorZ;
class CResult_InitDecodeErrorZ;
class CResult_OutPointDecodeErrorZ;
class CVec_ChannelDetailsZ;
class CResult_SignDecodeErrorZ;
+class C2Tuple_OutPointCVec_MonitorEventZZ;
class CVec_MessageSendEventZ;
class COption_NetAddressZ;
class C2Tuple_OutPointScriptZ;
class CVec_TxidZ;
class COption_AccessZ;
class CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ;
-class CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ;
class CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ;
+class CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ;
class CResult_CVec_CVec_u8ZZNoneZ;
class C2Tuple_SignatureSignatureZ;
class C2Tuple_PaymentHashPaymentSecretZ;
class CResult_AcceptChannelDecodeErrorZ;
class CVec_SignatureZ;
class CVec_u64Z;
-class CResult_ScorerDecodeErrorZ;
+class CResult_PongDecodeErrorZ;
class CResult_DelayedPaymentOutputDescriptorDecodeErrorZ;
class C2Tuple_PaymentHashPaymentIdZ;
class CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ;
class CResult_NoneErrorZ;
class CResult_StringErrorZ;
class C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ;
-class CResult_PongDecodeErrorZ;
class CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ;
class COption_EventZ;
class CResult_ChannelTypeFeaturesDecodeErrorZ;
class CResult__u832APIErrorZ;
class CResult_PaymentIdPaymentErrorZ;
class CResult_DescriptionCreationErrorZ;
-class CResult_COption_MonitorEventZDecodeErrorZ;
+class CResult_RoutingFeesDecodeErrorZ;
class CResult_PayeePubKeyErrorZ;
+class CResult_COption_MonitorEventZDecodeErrorZ;
class CVec_C2Tuple_PublicKeyTypeZZ;
-class CResult_RoutingFeesDecodeErrorZ;
-class CResult_QueryShortChannelIdsDecodeErrorZ;
+class CResult_u32GraphSyncErrorZ;
class CResult_InvoiceSemanticErrorZ;
class CResult_UpdateAddHTLCDecodeErrorZ;
-class CVec_PhantomRouteHintsZ;
+class CResult_QueryShortChannelIdsDecodeErrorZ;
class CResult_CounterpartyChannelTransactionParametersDecodeErrorZ;
class CResult_NoneAPIErrorZ;
class CVec_NetAddressZ;
class CResult_ChannelDetailsDecodeErrorZ;
-class CVec_C2Tuple_usizeTransactionZZ;
class CVec_PublicKeyZ;
+class CVec_C2Tuple_usizeTransactionZZ;
+class CVec_PhantomRouteHintsZ;
class COption_MonitorEventZ;
class COption_TypeZ;
class CResult_COption_TypeZDecodeErrorZ;
class CResult_BuiltCommitmentTransactionDecodeErrorZ;
class COption_NoneZ;
class CVec_TxOutZ;
-class CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ;
class CResult_ChannelUpdateInfoDecodeErrorZ;
+class CVec_C2Tuple_OutPointCVec_MonitorEventZZZ;
+class CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ;
class CVec_UpdateFailHTLCZ;
-class CResult_FundingLockedDecodeErrorZ;
class CResult_ReplyShortChannelIdsEndDecodeErrorZ;
class Str {
const LDKBackgroundProcessor* operator &() const { return &self; }
const LDKBackgroundProcessor* operator ->() const { return &self; }
};
-class Persister {
+class GossipSync {
private:
- LDKPersister self;
+ LDKGossipSync self;
public:
- Persister(const Persister&) = delete;
- Persister(Persister&& o) : self(o.self) { memset(&o, 0, sizeof(Persister)); }
- Persister(LDKPersister&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKPersister)); }
- operator LDKPersister() && { LDKPersister res = self; memset(&self, 0, sizeof(LDKPersister)); return res; }
- ~Persister() { Persister_free(self); }
- Persister& operator=(Persister&& o) { Persister_free(self); self = o.self; memset(&o, 0, sizeof(Persister)); return *this; }
- LDKPersister* operator &() { return &self; }
- LDKPersister* operator ->() { return &self; }
- const LDKPersister* operator &() const { return &self; }
- const LDKPersister* operator ->() const { return &self; }
- /**
- * Persist the given [`ChannelManager`] to disk, returning an error if persistence failed
- * (which will cause the [`BackgroundProcessor`] which called this method to exit).
- */
- inline LDK::CResult_NoneErrorZ persist_manager(const struct LDKChannelManager *NONNULL_PTR channel_manager);
- /**
- * Persist the given [`NetworkGraph`] to disk, returning an error if persistence failed.
- */
- inline LDK::CResult_NoneErrorZ persist_graph(const struct LDKNetworkGraph *NONNULL_PTR network_graph);
+ GossipSync(const GossipSync&) = delete;
+ GossipSync(GossipSync&& o) : self(o.self) { memset(&o, 0, sizeof(GossipSync)); }
+ GossipSync(LDKGossipSync&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKGossipSync)); }
+ operator LDKGossipSync() && { LDKGossipSync res = self; memset(&self, 0, sizeof(LDKGossipSync)); return res; }
+ ~GossipSync() { GossipSync_free(self); }
+ GossipSync& operator=(GossipSync&& o) { GossipSync_free(self); self = o.self; memset(&o, 0, sizeof(GossipSync)); return *this; }
+ LDKGossipSync* operator &() { return &self; }
+ LDKGossipSync* operator ->() { return &self; }
+ const LDKGossipSync* operator &() const { return &self; }
+ const LDKGossipSync* operator ->() const { return &self; }
};
class RouteHop {
private:
*/
inline uint32_t get_est_sat_per_1000_weight(enum LDKConfirmationTarget confirmation_target);
};
+class PaymentPurpose {
+private:
+ LDKPaymentPurpose self;
+public:
+ PaymentPurpose(const PaymentPurpose&) = delete;
+ PaymentPurpose(PaymentPurpose&& o) : self(o.self) { memset(&o, 0, sizeof(PaymentPurpose)); }
+ PaymentPurpose(LDKPaymentPurpose&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKPaymentPurpose)); }
+ operator LDKPaymentPurpose() && { LDKPaymentPurpose res = self; memset(&self, 0, sizeof(LDKPaymentPurpose)); return res; }
+ ~PaymentPurpose() { PaymentPurpose_free(self); }
+ PaymentPurpose& operator=(PaymentPurpose&& o) { PaymentPurpose_free(self); self = o.self; memset(&o, 0, sizeof(PaymentPurpose)); return *this; }
+ LDKPaymentPurpose* operator &() { return &self; }
+ LDKPaymentPurpose* operator ->() { return &self; }
+ const LDKPaymentPurpose* operator &() const { return &self; }
+ const LDKPaymentPurpose* operator ->() const { return &self; }
+};
+class ClosureReason {
+private:
+ LDKClosureReason self;
+public:
+ ClosureReason(const ClosureReason&) = delete;
+ ClosureReason(ClosureReason&& o) : self(o.self) { memset(&o, 0, sizeof(ClosureReason)); }
+ ClosureReason(LDKClosureReason&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKClosureReason)); }
+ operator LDKClosureReason() && { LDKClosureReason res = self; memset(&self, 0, sizeof(LDKClosureReason)); return res; }
+ ~ClosureReason() { ClosureReason_free(self); }
+ ClosureReason& operator=(ClosureReason&& o) { ClosureReason_free(self); self = o.self; memset(&o, 0, sizeof(ClosureReason)); return *this; }
+ LDKClosureReason* operator &() { return &self; }
+ LDKClosureReason* operator ->() { return &self; }
+ const LDKClosureReason* operator &() const { return &self; }
+ const LDKClosureReason* operator ->() const { return &self; }
+};
+class Event {
+private:
+ LDKEvent self;
+public:
+ Event(const Event&) = delete;
+ Event(Event&& o) : self(o.self) { memset(&o, 0, sizeof(Event)); }
+ Event(LDKEvent&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKEvent)); }
+ operator LDKEvent() && { LDKEvent res = self; memset(&self, 0, sizeof(LDKEvent)); return res; }
+ ~Event() { Event_free(self); }
+ Event& operator=(Event&& o) { Event_free(self); self = o.self; memset(&o, 0, sizeof(Event)); return *this; }
+ LDKEvent* operator &() { return &self; }
+ LDKEvent* operator ->() { return &self; }
+ const LDKEvent* operator &() const { return &self; }
+ const LDKEvent* operator ->() const { return &self; }
+};
+class MessageSendEvent {
+private:
+ LDKMessageSendEvent self;
+public:
+ MessageSendEvent(const MessageSendEvent&) = delete;
+ MessageSendEvent(MessageSendEvent&& o) : self(o.self) { memset(&o, 0, sizeof(MessageSendEvent)); }
+ MessageSendEvent(LDKMessageSendEvent&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKMessageSendEvent)); }
+ operator LDKMessageSendEvent() && { LDKMessageSendEvent res = self; memset(&self, 0, sizeof(LDKMessageSendEvent)); return res; }
+ ~MessageSendEvent() { MessageSendEvent_free(self); }
+ MessageSendEvent& operator=(MessageSendEvent&& o) { MessageSendEvent_free(self); self = o.self; memset(&o, 0, sizeof(MessageSendEvent)); return *this; }
+ LDKMessageSendEvent* operator &() { return &self; }
+ LDKMessageSendEvent* operator ->() { return &self; }
+ const LDKMessageSendEvent* operator &() const { return &self; }
+ const LDKMessageSendEvent* operator ->() const { return &self; }
+};
+class MessageSendEventsProvider {
+private:
+ LDKMessageSendEventsProvider self;
+public:
+ MessageSendEventsProvider(const MessageSendEventsProvider&) = delete;
+ MessageSendEventsProvider(MessageSendEventsProvider&& o) : self(o.self) { memset(&o, 0, sizeof(MessageSendEventsProvider)); }
+ MessageSendEventsProvider(LDKMessageSendEventsProvider&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKMessageSendEventsProvider)); }
+ operator LDKMessageSendEventsProvider() && { LDKMessageSendEventsProvider res = self; memset(&self, 0, sizeof(LDKMessageSendEventsProvider)); return res; }
+ ~MessageSendEventsProvider() { MessageSendEventsProvider_free(self); }
+ MessageSendEventsProvider& operator=(MessageSendEventsProvider&& o) { MessageSendEventsProvider_free(self); self = o.self; memset(&o, 0, sizeof(MessageSendEventsProvider)); return *this; }
+ LDKMessageSendEventsProvider* operator &() { return &self; }
+ LDKMessageSendEventsProvider* operator ->() { return &self; }
+ const LDKMessageSendEventsProvider* operator &() const { return &self; }
+ const LDKMessageSendEventsProvider* operator ->() const { return &self; }
+ /**
+ * Gets the list of pending events which were generated by previous actions, clearing the list
+ * in the process.
+ */
+ inline LDK::CVec_MessageSendEventZ get_and_clear_pending_msg_events();
+};
+class EventsProvider {
+private:
+ LDKEventsProvider self;
+public:
+ EventsProvider(const EventsProvider&) = delete;
+ EventsProvider(EventsProvider&& o) : self(o.self) { memset(&o, 0, sizeof(EventsProvider)); }
+ EventsProvider(LDKEventsProvider&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKEventsProvider)); }
+ operator LDKEventsProvider() && { LDKEventsProvider res = self; memset(&self, 0, sizeof(LDKEventsProvider)); return res; }
+ ~EventsProvider() { EventsProvider_free(self); }
+ EventsProvider& operator=(EventsProvider&& o) { EventsProvider_free(self); self = o.self; memset(&o, 0, sizeof(EventsProvider)); return *this; }
+ LDKEventsProvider* operator &() { return &self; }
+ LDKEventsProvider* operator ->() { return &self; }
+ const LDKEventsProvider* operator &() const { return &self; }
+ const LDKEventsProvider* operator ->() const { return &self; }
+ /**
+ * Processes any events generated since the last call using the given event handler.
+ *
+ * Subsequent calls must only process new events. However, handlers must be capable of handling
+ * duplicate events across process restarts. This may occur if the provider was recovered from
+ * an old state (i.e., it hadn't been successfully persisted after processing pending events).
+ */
+ inline void process_pending_events(struct LDKEventHandler handler);
+};
+class EventHandler {
+private:
+ LDKEventHandler self;
+public:
+ EventHandler(const EventHandler&) = delete;
+ EventHandler(EventHandler&& o) : self(o.self) { memset(&o, 0, sizeof(EventHandler)); }
+ EventHandler(LDKEventHandler&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKEventHandler)); }
+ operator LDKEventHandler() && { LDKEventHandler res = self; memset(&self, 0, sizeof(LDKEventHandler)); return res; }
+ ~EventHandler() { EventHandler_free(self); }
+ EventHandler& operator=(EventHandler&& o) { EventHandler_free(self); self = o.self; memset(&o, 0, sizeof(EventHandler)); return *this; }
+ LDKEventHandler* operator &() { return &self; }
+ LDKEventHandler* operator ->() { return &self; }
+ const LDKEventHandler* operator &() const { return &self; }
+ const LDKEventHandler* operator ->() const { return &self; }
+ /**
+ * Handles the given [`Event`].
+ *
+ * See [`EventsProvider`] for details that must be considered when implementing this method.
+ */
+ inline void handle_event(const struct LDKEvent *NONNULL_PTR event);
+};
class BestBlock {
private:
LDKBestBlock self;
* Returns an error if `genesis_hash` is for a different chain or if such a transaction output
* is unknown.
*
- * [`short_channel_id`]: https://github.com/lightningnetwork/lightning-rfc/blob/master/07-routing-gossip.md#definition-of-short_channel_id
+ * [`short_channel_id`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#definition-of-short_channel_id
*/
inline LDK::CResult_TxOutAccessErrorZ get_utxo(const uint8_t (*genesis_hash)[32], uint64_t short_channel_id);
};
LDKListen* operator ->() { return &self; }
const LDKListen* operator &() const { return &self; }
const LDKListen* operator ->() const { return &self; }
+ /**
+ * Notifies the listener that a block was added at the given height, with the transaction data
+ * possibly filtered.
+ */
+ inline void filtered_block_connected(const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
/**
* Notifies the listener that a block was added at the given height.
*/
* For details on asynchronous [`ChannelMonitor`] updating and returning
* [`MonitorEvent::UpdateCompleted`] here, see [`ChannelMonitorUpdateErr::TemporaryFailure`].
*/
- inline LDK::CVec_MonitorEventZ release_pending_monitor_events();
+ inline LDK::CVec_C2Tuple_OutPointCVec_MonitorEventZZZ release_pending_monitor_events();
};
class Filter {
private:
const LDKWatchedOutput* operator &() const { return &self; }
const LDKWatchedOutput* operator ->() const { return &self; }
};
-class PaymentPurpose {
-private:
- LDKPaymentPurpose self;
-public:
- PaymentPurpose(const PaymentPurpose&) = delete;
- PaymentPurpose(PaymentPurpose&& o) : self(o.self) { memset(&o, 0, sizeof(PaymentPurpose)); }
- PaymentPurpose(LDKPaymentPurpose&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKPaymentPurpose)); }
- operator LDKPaymentPurpose() && { LDKPaymentPurpose res = self; memset(&self, 0, sizeof(LDKPaymentPurpose)); return res; }
- ~PaymentPurpose() { PaymentPurpose_free(self); }
- PaymentPurpose& operator=(PaymentPurpose&& o) { PaymentPurpose_free(self); self = o.self; memset(&o, 0, sizeof(PaymentPurpose)); return *this; }
- LDKPaymentPurpose* operator &() { return &self; }
- LDKPaymentPurpose* operator ->() { return &self; }
- const LDKPaymentPurpose* operator &() const { return &self; }
- const LDKPaymentPurpose* operator ->() const { return &self; }
-};
-class ClosureReason {
-private:
- LDKClosureReason self;
-public:
- ClosureReason(const ClosureReason&) = delete;
- ClosureReason(ClosureReason&& o) : self(o.self) { memset(&o, 0, sizeof(ClosureReason)); }
- ClosureReason(LDKClosureReason&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKClosureReason)); }
- operator LDKClosureReason() && { LDKClosureReason res = self; memset(&self, 0, sizeof(LDKClosureReason)); return res; }
- ~ClosureReason() { ClosureReason_free(self); }
- ClosureReason& operator=(ClosureReason&& o) { ClosureReason_free(self); self = o.self; memset(&o, 0, sizeof(ClosureReason)); return *this; }
- LDKClosureReason* operator &() { return &self; }
- LDKClosureReason* operator ->() { return &self; }
- const LDKClosureReason* operator &() const { return &self; }
- const LDKClosureReason* operator ->() const { return &self; }
-};
-class Event {
+class Score {
private:
- LDKEvent self;
-public:
- Event(const Event&) = delete;
- Event(Event&& o) : self(o.self) { memset(&o, 0, sizeof(Event)); }
- Event(LDKEvent&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKEvent)); }
- operator LDKEvent() && { LDKEvent res = self; memset(&self, 0, sizeof(LDKEvent)); return res; }
- ~Event() { Event_free(self); }
- Event& operator=(Event&& o) { Event_free(self); self = o.self; memset(&o, 0, sizeof(Event)); return *this; }
- LDKEvent* operator &() { return &self; }
- LDKEvent* operator ->() { return &self; }
- const LDKEvent* operator &() const { return &self; }
- const LDKEvent* operator ->() const { return &self; }
-};
-class MessageSendEvent {
-private:
- LDKMessageSendEvent self;
-public:
- MessageSendEvent(const MessageSendEvent&) = delete;
- MessageSendEvent(MessageSendEvent&& o) : self(o.self) { memset(&o, 0, sizeof(MessageSendEvent)); }
- MessageSendEvent(LDKMessageSendEvent&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKMessageSendEvent)); }
- operator LDKMessageSendEvent() && { LDKMessageSendEvent res = self; memset(&self, 0, sizeof(LDKMessageSendEvent)); return res; }
- ~MessageSendEvent() { MessageSendEvent_free(self); }
- MessageSendEvent& operator=(MessageSendEvent&& o) { MessageSendEvent_free(self); self = o.self; memset(&o, 0, sizeof(MessageSendEvent)); return *this; }
- LDKMessageSendEvent* operator &() { return &self; }
- LDKMessageSendEvent* operator ->() { return &self; }
- const LDKMessageSendEvent* operator &() const { return &self; }
- const LDKMessageSendEvent* operator ->() const { return &self; }
-};
-class MessageSendEventsProvider {
-private:
- LDKMessageSendEventsProvider self;
-public:
- MessageSendEventsProvider(const MessageSendEventsProvider&) = delete;
- MessageSendEventsProvider(MessageSendEventsProvider&& o) : self(o.self) { memset(&o, 0, sizeof(MessageSendEventsProvider)); }
- MessageSendEventsProvider(LDKMessageSendEventsProvider&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKMessageSendEventsProvider)); }
- operator LDKMessageSendEventsProvider() && { LDKMessageSendEventsProvider res = self; memset(&self, 0, sizeof(LDKMessageSendEventsProvider)); return res; }
- ~MessageSendEventsProvider() { MessageSendEventsProvider_free(self); }
- MessageSendEventsProvider& operator=(MessageSendEventsProvider&& o) { MessageSendEventsProvider_free(self); self = o.self; memset(&o, 0, sizeof(MessageSendEventsProvider)); return *this; }
- LDKMessageSendEventsProvider* operator &() { return &self; }
- LDKMessageSendEventsProvider* operator ->() { return &self; }
- const LDKMessageSendEventsProvider* operator &() const { return &self; }
- const LDKMessageSendEventsProvider* operator ->() const { return &self; }
- /**
- * Gets the list of pending events which were generated by previous actions, clearing the list
- * in the process.
- */
- inline LDK::CVec_MessageSendEventZ get_and_clear_pending_msg_events();
-};
-class EventsProvider {
-private:
- LDKEventsProvider self;
-public:
- EventsProvider(const EventsProvider&) = delete;
- EventsProvider(EventsProvider&& o) : self(o.self) { memset(&o, 0, sizeof(EventsProvider)); }
- EventsProvider(LDKEventsProvider&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKEventsProvider)); }
- operator LDKEventsProvider() && { LDKEventsProvider res = self; memset(&self, 0, sizeof(LDKEventsProvider)); return res; }
- ~EventsProvider() { EventsProvider_free(self); }
- EventsProvider& operator=(EventsProvider&& o) { EventsProvider_free(self); self = o.self; memset(&o, 0, sizeof(EventsProvider)); return *this; }
- LDKEventsProvider* operator &() { return &self; }
- LDKEventsProvider* operator ->() { return &self; }
- const LDKEventsProvider* operator &() const { return &self; }
- const LDKEventsProvider* operator ->() const { return &self; }
- /**
- * Processes any events generated since the last call using the given event handler.
- *
- * Subsequent calls must only process new events. However, handlers must be capable of handling
- * duplicate events across process restarts. This may occur if the provider was recovered from
- * an old state (i.e., it hadn't been successfully persisted after processing pending events).
- */
- inline void process_pending_events(struct LDKEventHandler handler);
-};
-class EventHandler {
-private:
- LDKEventHandler self;
-public:
- EventHandler(const EventHandler&) = delete;
- EventHandler(EventHandler&& o) : self(o.self) { memset(&o, 0, sizeof(EventHandler)); }
- EventHandler(LDKEventHandler&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKEventHandler)); }
- operator LDKEventHandler() && { LDKEventHandler res = self; memset(&self, 0, sizeof(LDKEventHandler)); return res; }
- ~EventHandler() { EventHandler_free(self); }
- EventHandler& operator=(EventHandler&& o) { EventHandler_free(self); self = o.self; memset(&o, 0, sizeof(EventHandler)); return *this; }
- LDKEventHandler* operator &() { return &self; }
- LDKEventHandler* operator ->() { return &self; }
- const LDKEventHandler* operator &() const { return &self; }
- const LDKEventHandler* operator ->() const { return &self; }
- /**
- * Handles the given [`Event`].
- *
- * See [`EventsProvider`] for details that must be considered when implementing this method.
- */
- inline void handle_event(const struct LDKEvent *NONNULL_PTR event);
-};
-class Score {
-private:
- LDKScore self;
+ LDKScore self;
public:
Score(const Score&) = delete;
Score(Score&& o) : self(o.self) { memset(&o, 0, sizeof(Score)); }
* [`u64::max_value`] is given to indicate sufficient capacity for the invoice's full amount.
* Thus, implementations should be overflow-safe.
*/
- inline uint64_t channel_penalty_msat(uint64_t short_channel_id, uint64_t send_amt_msat, uint64_t capacity_msat, const struct LDKNodeId *NONNULL_PTR source, const struct LDKNodeId *NONNULL_PTR target);
+ inline uint64_t channel_penalty_msat(uint64_t short_channel_id, const struct LDKNodeId *NONNULL_PTR source, const struct LDKNodeId *NONNULL_PTR target, struct LDKChannelUsage usage);
/**
* Handles updating channel penalties after failing to route through a channel.
*/
const LDKMultiThreadedLockableScore* operator &() const { return &self; }
const LDKMultiThreadedLockableScore* operator ->() const { return &self; }
};
+class ChannelUsage {
+private:
+ LDKChannelUsage self;
+public:
+ ChannelUsage(const ChannelUsage&) = delete;
+ ChannelUsage(ChannelUsage&& o) : self(o.self) { memset(&o, 0, sizeof(ChannelUsage)); }
+ ChannelUsage(LDKChannelUsage&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChannelUsage)); }
+ operator LDKChannelUsage() && { LDKChannelUsage res = self; memset(&self, 0, sizeof(LDKChannelUsage)); return res; }
+ ~ChannelUsage() { ChannelUsage_free(self); }
+ ChannelUsage& operator=(ChannelUsage&& o) { ChannelUsage_free(self); self = o.self; memset(&o, 0, sizeof(ChannelUsage)); return *this; }
+ LDKChannelUsage* operator &() { return &self; }
+ LDKChannelUsage* operator ->() { return &self; }
+ const LDKChannelUsage* operator &() const { return &self; }
+ const LDKChannelUsage* operator ->() const { return &self; }
+};
class FixedPenaltyScorer {
private:
LDKFixedPenaltyScorer self;
const LDKFixedPenaltyScorer* operator &() const { return &self; }
const LDKFixedPenaltyScorer* operator ->() const { return &self; }
};
-class Scorer {
-private:
- LDKScorer self;
-public:
- Scorer(const Scorer&) = delete;
- Scorer(Scorer&& o) : self(o.self) { memset(&o, 0, sizeof(Scorer)); }
- Scorer(LDKScorer&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKScorer)); }
- operator LDKScorer() && { LDKScorer res = self; memset(&self, 0, sizeof(LDKScorer)); return res; }
- ~Scorer() { Scorer_free(self); }
- Scorer& operator=(Scorer&& o) { Scorer_free(self); self = o.self; memset(&o, 0, sizeof(Scorer)); return *this; }
- LDKScorer* operator &() { return &self; }
- LDKScorer* operator ->() { return &self; }
- const LDKScorer* operator &() const { return &self; }
- const LDKScorer* operator ->() const { return &self; }
-};
-class ScoringParameters {
-private:
- LDKScoringParameters self;
-public:
- ScoringParameters(const ScoringParameters&) = delete;
- ScoringParameters(ScoringParameters&& o) : self(o.self) { memset(&o, 0, sizeof(ScoringParameters)); }
- ScoringParameters(LDKScoringParameters&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKScoringParameters)); }
- operator LDKScoringParameters() && { LDKScoringParameters res = self; memset(&self, 0, sizeof(LDKScoringParameters)); return res; }
- ~ScoringParameters() { ScoringParameters_free(self); }
- ScoringParameters& operator=(ScoringParameters&& o) { ScoringParameters_free(self); self = o.self; memset(&o, 0, sizeof(ScoringParameters)); return *this; }
- LDKScoringParameters* operator &() { return &self; }
- LDKScoringParameters* operator ->() { return &self; }
- const LDKScoringParameters* operator &() const { return &self; }
- const LDKScoringParameters* operator ->() const { return &self; }
-};
class ProbabilisticScorer {
private:
LDKProbabilisticScorer self;
const LDKNodeFeatures* operator &() const { return &self; }
const LDKNodeFeatures* operator ->() const { return &self; }
};
-class ChannelFeatures {
+class ChannelFeatures {
+private:
+ LDKChannelFeatures self;
+public:
+ ChannelFeatures(const ChannelFeatures&) = delete;
+ ChannelFeatures(ChannelFeatures&& o) : self(o.self) { memset(&o, 0, sizeof(ChannelFeatures)); }
+ ChannelFeatures(LDKChannelFeatures&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChannelFeatures)); }
+ operator LDKChannelFeatures() && { LDKChannelFeatures res = self; memset(&self, 0, sizeof(LDKChannelFeatures)); return res; }
+ ~ChannelFeatures() { ChannelFeatures_free(self); }
+ ChannelFeatures& operator=(ChannelFeatures&& o) { ChannelFeatures_free(self); self = o.self; memset(&o, 0, sizeof(ChannelFeatures)); return *this; }
+ LDKChannelFeatures* operator &() { return &self; }
+ LDKChannelFeatures* operator ->() { return &self; }
+ const LDKChannelFeatures* operator &() const { return &self; }
+ const LDKChannelFeatures* operator ->() const { return &self; }
+};
+class InvoiceFeatures {
+private:
+ LDKInvoiceFeatures self;
+public:
+ InvoiceFeatures(const InvoiceFeatures&) = delete;
+ InvoiceFeatures(InvoiceFeatures&& o) : self(o.self) { memset(&o, 0, sizeof(InvoiceFeatures)); }
+ InvoiceFeatures(LDKInvoiceFeatures&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKInvoiceFeatures)); }
+ operator LDKInvoiceFeatures() && { LDKInvoiceFeatures res = self; memset(&self, 0, sizeof(LDKInvoiceFeatures)); return res; }
+ ~InvoiceFeatures() { InvoiceFeatures_free(self); }
+ InvoiceFeatures& operator=(InvoiceFeatures&& o) { InvoiceFeatures_free(self); self = o.self; memset(&o, 0, sizeof(InvoiceFeatures)); return *this; }
+ LDKInvoiceFeatures* operator &() { return &self; }
+ LDKInvoiceFeatures* operator ->() { return &self; }
+ const LDKInvoiceFeatures* operator &() const { return &self; }
+ const LDKInvoiceFeatures* operator ->() const { return &self; }
+};
+class ChannelTypeFeatures {
+private:
+ LDKChannelTypeFeatures self;
+public:
+ ChannelTypeFeatures(const ChannelTypeFeatures&) = delete;
+ ChannelTypeFeatures(ChannelTypeFeatures&& o) : self(o.self) { memset(&o, 0, sizeof(ChannelTypeFeatures)); }
+ ChannelTypeFeatures(LDKChannelTypeFeatures&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChannelTypeFeatures)); }
+ operator LDKChannelTypeFeatures() && { LDKChannelTypeFeatures res = self; memset(&self, 0, sizeof(LDKChannelTypeFeatures)); return res; }
+ ~ChannelTypeFeatures() { ChannelTypeFeatures_free(self); }
+ ChannelTypeFeatures& operator=(ChannelTypeFeatures&& o) { ChannelTypeFeatures_free(self); self = o.self; memset(&o, 0, sizeof(ChannelTypeFeatures)); return *this; }
+ LDKChannelTypeFeatures* operator &() { return &self; }
+ LDKChannelTypeFeatures* operator ->() { return &self; }
+ const LDKChannelTypeFeatures* operator &() const { return &self; }
+ const LDKChannelTypeFeatures* operator ->() const { return &self; }
+};
+class NodeId {
+private:
+ LDKNodeId self;
+public:
+ NodeId(const NodeId&) = delete;
+ NodeId(NodeId&& o) : self(o.self) { memset(&o, 0, sizeof(NodeId)); }
+ NodeId(LDKNodeId&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKNodeId)); }
+ operator LDKNodeId() && { LDKNodeId res = self; memset(&self, 0, sizeof(LDKNodeId)); return res; }
+ ~NodeId() { NodeId_free(self); }
+ NodeId& operator=(NodeId&& o) { NodeId_free(self); self = o.self; memset(&o, 0, sizeof(NodeId)); return *this; }
+ LDKNodeId* operator &() { return &self; }
+ LDKNodeId* operator ->() { return &self; }
+ const LDKNodeId* operator &() const { return &self; }
+ const LDKNodeId* operator ->() const { return &self; }
+};
+class NetworkGraph {
+private:
+ LDKNetworkGraph self;
+public:
+ NetworkGraph(const NetworkGraph&) = delete;
+ NetworkGraph(NetworkGraph&& o) : self(o.self) { memset(&o, 0, sizeof(NetworkGraph)); }
+ NetworkGraph(LDKNetworkGraph&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKNetworkGraph)); }
+ operator LDKNetworkGraph() && { LDKNetworkGraph res = self; memset(&self, 0, sizeof(LDKNetworkGraph)); return res; }
+ ~NetworkGraph() { NetworkGraph_free(self); }
+ NetworkGraph& operator=(NetworkGraph&& o) { NetworkGraph_free(self); self = o.self; memset(&o, 0, sizeof(NetworkGraph)); return *this; }
+ LDKNetworkGraph* operator &() { return &self; }
+ LDKNetworkGraph* operator ->() { return &self; }
+ const LDKNetworkGraph* operator &() const { return &self; }
+ const LDKNetworkGraph* operator ->() const { return &self; }
+};
+class ReadOnlyNetworkGraph {
+private:
+ LDKReadOnlyNetworkGraph self;
+public:
+ ReadOnlyNetworkGraph(const ReadOnlyNetworkGraph&) = delete;
+ ReadOnlyNetworkGraph(ReadOnlyNetworkGraph&& o) : self(o.self) { memset(&o, 0, sizeof(ReadOnlyNetworkGraph)); }
+ ReadOnlyNetworkGraph(LDKReadOnlyNetworkGraph&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKReadOnlyNetworkGraph)); }
+ operator LDKReadOnlyNetworkGraph() && { LDKReadOnlyNetworkGraph res = self; memset(&self, 0, sizeof(LDKReadOnlyNetworkGraph)); return res; }
+ ~ReadOnlyNetworkGraph() { ReadOnlyNetworkGraph_free(self); }
+ ReadOnlyNetworkGraph& operator=(ReadOnlyNetworkGraph&& o) { ReadOnlyNetworkGraph_free(self); self = o.self; memset(&o, 0, sizeof(ReadOnlyNetworkGraph)); return *this; }
+ LDKReadOnlyNetworkGraph* operator &() { return &self; }
+ LDKReadOnlyNetworkGraph* operator ->() { return &self; }
+ const LDKReadOnlyNetworkGraph* operator &() const { return &self; }
+ const LDKReadOnlyNetworkGraph* operator ->() const { return &self; }
+};
+class NetworkUpdate {
+private:
+ LDKNetworkUpdate self;
+public:
+ NetworkUpdate(const NetworkUpdate&) = delete;
+ NetworkUpdate(NetworkUpdate&& o) : self(o.self) { memset(&o, 0, sizeof(NetworkUpdate)); }
+ NetworkUpdate(LDKNetworkUpdate&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKNetworkUpdate)); }
+ operator LDKNetworkUpdate() && { LDKNetworkUpdate res = self; memset(&self, 0, sizeof(LDKNetworkUpdate)); return res; }
+ ~NetworkUpdate() { NetworkUpdate_free(self); }
+ NetworkUpdate& operator=(NetworkUpdate&& o) { NetworkUpdate_free(self); self = o.self; memset(&o, 0, sizeof(NetworkUpdate)); return *this; }
+ LDKNetworkUpdate* operator &() { return &self; }
+ LDKNetworkUpdate* operator ->() { return &self; }
+ const LDKNetworkUpdate* operator &() const { return &self; }
+ const LDKNetworkUpdate* operator ->() const { return &self; }
+};
+class P2PGossipSync {
+private:
+ LDKP2PGossipSync self;
+public:
+ P2PGossipSync(const P2PGossipSync&) = delete;
+ P2PGossipSync(P2PGossipSync&& o) : self(o.self) { memset(&o, 0, sizeof(P2PGossipSync)); }
+ P2PGossipSync(LDKP2PGossipSync&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKP2PGossipSync)); }
+ operator LDKP2PGossipSync() && { LDKP2PGossipSync res = self; memset(&self, 0, sizeof(LDKP2PGossipSync)); return res; }
+ ~P2PGossipSync() { P2PGossipSync_free(self); }
+ P2PGossipSync& operator=(P2PGossipSync&& o) { P2PGossipSync_free(self); self = o.self; memset(&o, 0, sizeof(P2PGossipSync)); return *this; }
+ LDKP2PGossipSync* operator &() { return &self; }
+ LDKP2PGossipSync* operator ->() { return &self; }
+ const LDKP2PGossipSync* operator &() const { return &self; }
+ const LDKP2PGossipSync* operator ->() const { return &self; }
+};
+class ChannelUpdateInfo {
+private:
+ LDKChannelUpdateInfo self;
+public:
+ ChannelUpdateInfo(const ChannelUpdateInfo&) = delete;
+ ChannelUpdateInfo(ChannelUpdateInfo&& o) : self(o.self) { memset(&o, 0, sizeof(ChannelUpdateInfo)); }
+ ChannelUpdateInfo(LDKChannelUpdateInfo&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChannelUpdateInfo)); }
+ operator LDKChannelUpdateInfo() && { LDKChannelUpdateInfo res = self; memset(&self, 0, sizeof(LDKChannelUpdateInfo)); return res; }
+ ~ChannelUpdateInfo() { ChannelUpdateInfo_free(self); }
+ ChannelUpdateInfo& operator=(ChannelUpdateInfo&& o) { ChannelUpdateInfo_free(self); self = o.self; memset(&o, 0, sizeof(ChannelUpdateInfo)); return *this; }
+ LDKChannelUpdateInfo* operator &() { return &self; }
+ LDKChannelUpdateInfo* operator ->() { return &self; }
+ const LDKChannelUpdateInfo* operator &() const { return &self; }
+ const LDKChannelUpdateInfo* operator ->() const { return &self; }
+};
+class ChannelInfo {
+private:
+ LDKChannelInfo self;
+public:
+ ChannelInfo(const ChannelInfo&) = delete;
+ ChannelInfo(ChannelInfo&& o) : self(o.self) { memset(&o, 0, sizeof(ChannelInfo)); }
+ ChannelInfo(LDKChannelInfo&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChannelInfo)); }
+ operator LDKChannelInfo() && { LDKChannelInfo res = self; memset(&self, 0, sizeof(LDKChannelInfo)); return res; }
+ ~ChannelInfo() { ChannelInfo_free(self); }
+ ChannelInfo& operator=(ChannelInfo&& o) { ChannelInfo_free(self); self = o.self; memset(&o, 0, sizeof(ChannelInfo)); return *this; }
+ LDKChannelInfo* operator &() { return &self; }
+ LDKChannelInfo* operator ->() { return &self; }
+ const LDKChannelInfo* operator &() const { return &self; }
+ const LDKChannelInfo* operator ->() const { return &self; }
+};
+class DirectedChannelInfo {
+private:
+ LDKDirectedChannelInfo self;
+public:
+ DirectedChannelInfo(const DirectedChannelInfo&) = delete;
+ DirectedChannelInfo(DirectedChannelInfo&& o) : self(o.self) { memset(&o, 0, sizeof(DirectedChannelInfo)); }
+ DirectedChannelInfo(LDKDirectedChannelInfo&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKDirectedChannelInfo)); }
+ operator LDKDirectedChannelInfo() && { LDKDirectedChannelInfo res = self; memset(&self, 0, sizeof(LDKDirectedChannelInfo)); return res; }
+ ~DirectedChannelInfo() { DirectedChannelInfo_free(self); }
+ DirectedChannelInfo& operator=(DirectedChannelInfo&& o) { DirectedChannelInfo_free(self); self = o.self; memset(&o, 0, sizeof(DirectedChannelInfo)); return *this; }
+ LDKDirectedChannelInfo* operator &() { return &self; }
+ LDKDirectedChannelInfo* operator ->() { return &self; }
+ const LDKDirectedChannelInfo* operator &() const { return &self; }
+ const LDKDirectedChannelInfo* operator ->() const { return &self; }
+};
+class EffectiveCapacity {
+private:
+ LDKEffectiveCapacity self;
+public:
+ EffectiveCapacity(const EffectiveCapacity&) = delete;
+ EffectiveCapacity(EffectiveCapacity&& o) : self(o.self) { memset(&o, 0, sizeof(EffectiveCapacity)); }
+ EffectiveCapacity(LDKEffectiveCapacity&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKEffectiveCapacity)); }
+ operator LDKEffectiveCapacity() && { LDKEffectiveCapacity res = self; memset(&self, 0, sizeof(LDKEffectiveCapacity)); return res; }
+ ~EffectiveCapacity() { EffectiveCapacity_free(self); }
+ EffectiveCapacity& operator=(EffectiveCapacity&& o) { EffectiveCapacity_free(self); self = o.self; memset(&o, 0, sizeof(EffectiveCapacity)); return *this; }
+ LDKEffectiveCapacity* operator &() { return &self; }
+ LDKEffectiveCapacity* operator ->() { return &self; }
+ const LDKEffectiveCapacity* operator &() const { return &self; }
+ const LDKEffectiveCapacity* operator ->() const { return &self; }
+};
+class RoutingFees {
private:
- LDKChannelFeatures self;
+ LDKRoutingFees self;
public:
- ChannelFeatures(const ChannelFeatures&) = delete;
- ChannelFeatures(ChannelFeatures&& o) : self(o.self) { memset(&o, 0, sizeof(ChannelFeatures)); }
- ChannelFeatures(LDKChannelFeatures&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChannelFeatures)); }
- operator LDKChannelFeatures() && { LDKChannelFeatures res = self; memset(&self, 0, sizeof(LDKChannelFeatures)); return res; }
- ~ChannelFeatures() { ChannelFeatures_free(self); }
- ChannelFeatures& operator=(ChannelFeatures&& o) { ChannelFeatures_free(self); self = o.self; memset(&o, 0, sizeof(ChannelFeatures)); return *this; }
- LDKChannelFeatures* operator &() { return &self; }
- LDKChannelFeatures* operator ->() { return &self; }
- const LDKChannelFeatures* operator &() const { return &self; }
- const LDKChannelFeatures* operator ->() const { return &self; }
+ RoutingFees(const RoutingFees&) = delete;
+ RoutingFees(RoutingFees&& o) : self(o.self) { memset(&o, 0, sizeof(RoutingFees)); }
+ RoutingFees(LDKRoutingFees&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKRoutingFees)); }
+ operator LDKRoutingFees() && { LDKRoutingFees res = self; memset(&self, 0, sizeof(LDKRoutingFees)); return res; }
+ ~RoutingFees() { RoutingFees_free(self); }
+ RoutingFees& operator=(RoutingFees&& o) { RoutingFees_free(self); self = o.self; memset(&o, 0, sizeof(RoutingFees)); return *this; }
+ LDKRoutingFees* operator &() { return &self; }
+ LDKRoutingFees* operator ->() { return &self; }
+ const LDKRoutingFees* operator &() const { return &self; }
+ const LDKRoutingFees* operator ->() const { return &self; }
};
-class InvoiceFeatures {
+class NodeAnnouncementInfo {
private:
- LDKInvoiceFeatures self;
+ LDKNodeAnnouncementInfo self;
public:
- InvoiceFeatures(const InvoiceFeatures&) = delete;
- InvoiceFeatures(InvoiceFeatures&& o) : self(o.self) { memset(&o, 0, sizeof(InvoiceFeatures)); }
- InvoiceFeatures(LDKInvoiceFeatures&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKInvoiceFeatures)); }
- operator LDKInvoiceFeatures() && { LDKInvoiceFeatures res = self; memset(&self, 0, sizeof(LDKInvoiceFeatures)); return res; }
- ~InvoiceFeatures() { InvoiceFeatures_free(self); }
- InvoiceFeatures& operator=(InvoiceFeatures&& o) { InvoiceFeatures_free(self); self = o.self; memset(&o, 0, sizeof(InvoiceFeatures)); return *this; }
- LDKInvoiceFeatures* operator &() { return &self; }
- LDKInvoiceFeatures* operator ->() { return &self; }
- const LDKInvoiceFeatures* operator &() const { return &self; }
- const LDKInvoiceFeatures* operator ->() const { return &self; }
+ NodeAnnouncementInfo(const NodeAnnouncementInfo&) = delete;
+ NodeAnnouncementInfo(NodeAnnouncementInfo&& o) : self(o.self) { memset(&o, 0, sizeof(NodeAnnouncementInfo)); }
+ NodeAnnouncementInfo(LDKNodeAnnouncementInfo&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKNodeAnnouncementInfo)); }
+ operator LDKNodeAnnouncementInfo() && { LDKNodeAnnouncementInfo res = self; memset(&self, 0, sizeof(LDKNodeAnnouncementInfo)); return res; }
+ ~NodeAnnouncementInfo() { NodeAnnouncementInfo_free(self); }
+ NodeAnnouncementInfo& operator=(NodeAnnouncementInfo&& o) { NodeAnnouncementInfo_free(self); self = o.self; memset(&o, 0, sizeof(NodeAnnouncementInfo)); return *this; }
+ LDKNodeAnnouncementInfo* operator &() { return &self; }
+ LDKNodeAnnouncementInfo* operator ->() { return &self; }
+ const LDKNodeAnnouncementInfo* operator &() const { return &self; }
+ const LDKNodeAnnouncementInfo* operator ->() const { return &self; }
};
-class ChannelTypeFeatures {
+class NodeInfo {
private:
- LDKChannelTypeFeatures self;
+ LDKNodeInfo self;
public:
- ChannelTypeFeatures(const ChannelTypeFeatures&) = delete;
- ChannelTypeFeatures(ChannelTypeFeatures&& o) : self(o.self) { memset(&o, 0, sizeof(ChannelTypeFeatures)); }
- ChannelTypeFeatures(LDKChannelTypeFeatures&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChannelTypeFeatures)); }
- operator LDKChannelTypeFeatures() && { LDKChannelTypeFeatures res = self; memset(&self, 0, sizeof(LDKChannelTypeFeatures)); return res; }
- ~ChannelTypeFeatures() { ChannelTypeFeatures_free(self); }
- ChannelTypeFeatures& operator=(ChannelTypeFeatures&& o) { ChannelTypeFeatures_free(self); self = o.self; memset(&o, 0, sizeof(ChannelTypeFeatures)); return *this; }
- LDKChannelTypeFeatures* operator &() { return &self; }
- LDKChannelTypeFeatures* operator ->() { return &self; }
- const LDKChannelTypeFeatures* operator &() const { return &self; }
- const LDKChannelTypeFeatures* operator ->() const { return &self; }
+ NodeInfo(const NodeInfo&) = delete;
+ NodeInfo(NodeInfo&& o) : self(o.self) { memset(&o, 0, sizeof(NodeInfo)); }
+ NodeInfo(LDKNodeInfo&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKNodeInfo)); }
+ operator LDKNodeInfo() && { LDKNodeInfo res = self; memset(&self, 0, sizeof(LDKNodeInfo)); return res; }
+ ~NodeInfo() { NodeInfo_free(self); }
+ NodeInfo& operator=(NodeInfo&& o) { NodeInfo_free(self); self = o.self; memset(&o, 0, sizeof(NodeInfo)); return *this; }
+ LDKNodeInfo* operator &() { return &self; }
+ LDKNodeInfo* operator ->() { return &self; }
+ const LDKNodeInfo* operator &() const { return &self; }
+ const LDKNodeInfo* operator ->() const { return &self; }
};
class DelayedPaymentOutputDescriptor {
private:
const LDKAPIError* operator &() const { return &self; }
const LDKAPIError* operator ->() const { return &self; }
};
+class BigSize {
+private:
+ LDKBigSize self;
+public:
+ BigSize(const BigSize&) = delete;
+ BigSize(BigSize&& o) : self(o.self) { memset(&o, 0, sizeof(BigSize)); }
+ BigSize(LDKBigSize&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKBigSize)); }
+ operator LDKBigSize() && { LDKBigSize res = self; memset(&self, 0, sizeof(LDKBigSize)); return res; }
+ ~BigSize() { BigSize_free(self); }
+ BigSize& operator=(BigSize&& o) { BigSize_free(self); self = o.self; memset(&o, 0, sizeof(BigSize)); return *this; }
+ LDKBigSize* operator &() { return &self; }
+ LDKBigSize* operator ->() { return &self; }
+ const LDKBigSize* operator &() const { return &self; }
+ const LDKBigSize* operator ->() const { return &self; }
+};
class OutPoint {
private:
LDKOutPoint self;
*/
inline LDK::CResult_RouteLightningErrorZ find_route(struct LDKPublicKey payer, const struct LDKRouteParameters *NONNULL_PTR route_params, const uint8_t (*payment_hash)[32], struct LDKCVec_ChannelDetailsZ *first_hops, const struct LDKScore *NONNULL_PTR scorer);
};
-class RetryAttempts {
+class Retry {
private:
- LDKRetryAttempts self;
+ LDKRetry self;
public:
- RetryAttempts(const RetryAttempts&) = delete;
- RetryAttempts(RetryAttempts&& o) : self(o.self) { memset(&o, 0, sizeof(RetryAttempts)); }
- RetryAttempts(LDKRetryAttempts&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKRetryAttempts)); }
- operator LDKRetryAttempts() && { LDKRetryAttempts res = self; memset(&self, 0, sizeof(LDKRetryAttempts)); return res; }
- ~RetryAttempts() { RetryAttempts_free(self); }
- RetryAttempts& operator=(RetryAttempts&& o) { RetryAttempts_free(self); self = o.self; memset(&o, 0, sizeof(RetryAttempts)); return *this; }
- LDKRetryAttempts* operator &() { return &self; }
- LDKRetryAttempts* operator ->() { return &self; }
- const LDKRetryAttempts* operator &() const { return &self; }
- const LDKRetryAttempts* operator ->() const { return &self; }
+ Retry(const Retry&) = delete;
+ Retry(Retry&& o) : self(o.self) { memset(&o, 0, sizeof(Retry)); }
+ Retry(LDKRetry&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKRetry)); }
+ operator LDKRetry() && { LDKRetry res = self; memset(&self, 0, sizeof(LDKRetry)); return res; }
+ ~Retry() { Retry_free(self); }
+ Retry& operator=(Retry&& o) { Retry_free(self); self = o.self; memset(&o, 0, sizeof(Retry)); return *this; }
+ LDKRetry* operator &() { return &self; }
+ LDKRetry* operator ->() { return &self; }
+ const LDKRetry* operator &() const { return &self; }
+ const LDKRetry* operator ->() const { return &self; }
};
class PaymentError {
private:
const LDKChannelMonitor* operator &() const { return &self; }
const LDKChannelMonitor* operator ->() const { return &self; }
};
+class ExpandedKey {
+private:
+ LDKExpandedKey self;
+public:
+ ExpandedKey(const ExpandedKey&) = delete;
+ ExpandedKey(ExpandedKey&& o) : self(o.self) { memset(&o, 0, sizeof(ExpandedKey)); }
+ ExpandedKey(LDKExpandedKey&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKExpandedKey)); }
+ operator LDKExpandedKey() && { LDKExpandedKey res = self; memset(&self, 0, sizeof(LDKExpandedKey)); return res; }
+ ~ExpandedKey() { ExpandedKey_free(self); }
+ ExpandedKey& operator=(ExpandedKey&& o) { ExpandedKey_free(self); self = o.self; memset(&o, 0, sizeof(ExpandedKey)); return *this; }
+ LDKExpandedKey* operator &() { return &self; }
+ LDKExpandedKey* operator ->() { return &self; }
+ const LDKExpandedKey* operator &() const { return &self; }
+ const LDKExpandedKey* operator ->() const { return &self; }
+};
class CustomMessageHandler {
private:
LDKCustomMessageHandler self;
const LDKPeerManager* operator &() const { return &self; }
const LDKPeerManager* operator ->() const { return &self; }
};
-class NodeId {
-private:
- LDKNodeId self;
-public:
- NodeId(const NodeId&) = delete;
- NodeId(NodeId&& o) : self(o.self) { memset(&o, 0, sizeof(NodeId)); }
- NodeId(LDKNodeId&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKNodeId)); }
- operator LDKNodeId() && { LDKNodeId res = self; memset(&self, 0, sizeof(LDKNodeId)); return res; }
- ~NodeId() { NodeId_free(self); }
- NodeId& operator=(NodeId&& o) { NodeId_free(self); self = o.self; memset(&o, 0, sizeof(NodeId)); return *this; }
- LDKNodeId* operator &() { return &self; }
- LDKNodeId* operator ->() { return &self; }
- const LDKNodeId* operator &() const { return &self; }
- const LDKNodeId* operator ->() const { return &self; }
-};
-class NetworkGraph {
-private:
- LDKNetworkGraph self;
-public:
- NetworkGraph(const NetworkGraph&) = delete;
- NetworkGraph(NetworkGraph&& o) : self(o.self) { memset(&o, 0, sizeof(NetworkGraph)); }
- NetworkGraph(LDKNetworkGraph&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKNetworkGraph)); }
- operator LDKNetworkGraph() && { LDKNetworkGraph res = self; memset(&self, 0, sizeof(LDKNetworkGraph)); return res; }
- ~NetworkGraph() { NetworkGraph_free(self); }
- NetworkGraph& operator=(NetworkGraph&& o) { NetworkGraph_free(self); self = o.self; memset(&o, 0, sizeof(NetworkGraph)); return *this; }
- LDKNetworkGraph* operator &() { return &self; }
- LDKNetworkGraph* operator ->() { return &self; }
- const LDKNetworkGraph* operator &() const { return &self; }
- const LDKNetworkGraph* operator ->() const { return &self; }
-};
-class ReadOnlyNetworkGraph {
-private:
- LDKReadOnlyNetworkGraph self;
-public:
- ReadOnlyNetworkGraph(const ReadOnlyNetworkGraph&) = delete;
- ReadOnlyNetworkGraph(ReadOnlyNetworkGraph&& o) : self(o.self) { memset(&o, 0, sizeof(ReadOnlyNetworkGraph)); }
- ReadOnlyNetworkGraph(LDKReadOnlyNetworkGraph&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKReadOnlyNetworkGraph)); }
- operator LDKReadOnlyNetworkGraph() && { LDKReadOnlyNetworkGraph res = self; memset(&self, 0, sizeof(LDKReadOnlyNetworkGraph)); return res; }
- ~ReadOnlyNetworkGraph() { ReadOnlyNetworkGraph_free(self); }
- ReadOnlyNetworkGraph& operator=(ReadOnlyNetworkGraph&& o) { ReadOnlyNetworkGraph_free(self); self = o.self; memset(&o, 0, sizeof(ReadOnlyNetworkGraph)); return *this; }
- LDKReadOnlyNetworkGraph* operator &() { return &self; }
- LDKReadOnlyNetworkGraph* operator ->() { return &self; }
- const LDKReadOnlyNetworkGraph* operator &() const { return &self; }
- const LDKReadOnlyNetworkGraph* operator ->() const { return &self; }
-};
-class NetworkUpdate {
-private:
- LDKNetworkUpdate self;
-public:
- NetworkUpdate(const NetworkUpdate&) = delete;
- NetworkUpdate(NetworkUpdate&& o) : self(o.self) { memset(&o, 0, sizeof(NetworkUpdate)); }
- NetworkUpdate(LDKNetworkUpdate&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKNetworkUpdate)); }
- operator LDKNetworkUpdate() && { LDKNetworkUpdate res = self; memset(&self, 0, sizeof(LDKNetworkUpdate)); return res; }
- ~NetworkUpdate() { NetworkUpdate_free(self); }
- NetworkUpdate& operator=(NetworkUpdate&& o) { NetworkUpdate_free(self); self = o.self; memset(&o, 0, sizeof(NetworkUpdate)); return *this; }
- LDKNetworkUpdate* operator &() { return &self; }
- LDKNetworkUpdate* operator ->() { return &self; }
- const LDKNetworkUpdate* operator &() const { return &self; }
- const LDKNetworkUpdate* operator ->() const { return &self; }
-};
-class NetGraphMsgHandler {
-private:
- LDKNetGraphMsgHandler self;
-public:
- NetGraphMsgHandler(const NetGraphMsgHandler&) = delete;
- NetGraphMsgHandler(NetGraphMsgHandler&& o) : self(o.self) { memset(&o, 0, sizeof(NetGraphMsgHandler)); }
- NetGraphMsgHandler(LDKNetGraphMsgHandler&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKNetGraphMsgHandler)); }
- operator LDKNetGraphMsgHandler() && { LDKNetGraphMsgHandler res = self; memset(&self, 0, sizeof(LDKNetGraphMsgHandler)); return res; }
- ~NetGraphMsgHandler() { NetGraphMsgHandler_free(self); }
- NetGraphMsgHandler& operator=(NetGraphMsgHandler&& o) { NetGraphMsgHandler_free(self); self = o.self; memset(&o, 0, sizeof(NetGraphMsgHandler)); return *this; }
- LDKNetGraphMsgHandler* operator &() { return &self; }
- LDKNetGraphMsgHandler* operator ->() { return &self; }
- const LDKNetGraphMsgHandler* operator &() const { return &self; }
- const LDKNetGraphMsgHandler* operator ->() const { return &self; }
-};
-class ChannelUpdateInfo {
-private:
- LDKChannelUpdateInfo self;
-public:
- ChannelUpdateInfo(const ChannelUpdateInfo&) = delete;
- ChannelUpdateInfo(ChannelUpdateInfo&& o) : self(o.self) { memset(&o, 0, sizeof(ChannelUpdateInfo)); }
- ChannelUpdateInfo(LDKChannelUpdateInfo&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChannelUpdateInfo)); }
- operator LDKChannelUpdateInfo() && { LDKChannelUpdateInfo res = self; memset(&self, 0, sizeof(LDKChannelUpdateInfo)); return res; }
- ~ChannelUpdateInfo() { ChannelUpdateInfo_free(self); }
- ChannelUpdateInfo& operator=(ChannelUpdateInfo&& o) { ChannelUpdateInfo_free(self); self = o.self; memset(&o, 0, sizeof(ChannelUpdateInfo)); return *this; }
- LDKChannelUpdateInfo* operator &() { return &self; }
- LDKChannelUpdateInfo* operator ->() { return &self; }
- const LDKChannelUpdateInfo* operator &() const { return &self; }
- const LDKChannelUpdateInfo* operator ->() const { return &self; }
-};
-class ChannelInfo {
-private:
- LDKChannelInfo self;
-public:
- ChannelInfo(const ChannelInfo&) = delete;
- ChannelInfo(ChannelInfo&& o) : self(o.self) { memset(&o, 0, sizeof(ChannelInfo)); }
- ChannelInfo(LDKChannelInfo&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChannelInfo)); }
- operator LDKChannelInfo() && { LDKChannelInfo res = self; memset(&self, 0, sizeof(LDKChannelInfo)); return res; }
- ~ChannelInfo() { ChannelInfo_free(self); }
- ChannelInfo& operator=(ChannelInfo&& o) { ChannelInfo_free(self); self = o.self; memset(&o, 0, sizeof(ChannelInfo)); return *this; }
- LDKChannelInfo* operator &() { return &self; }
- LDKChannelInfo* operator ->() { return &self; }
- const LDKChannelInfo* operator &() const { return &self; }
- const LDKChannelInfo* operator ->() const { return &self; }
-};
-class DirectedChannelInfo {
-private:
- LDKDirectedChannelInfo self;
-public:
- DirectedChannelInfo(const DirectedChannelInfo&) = delete;
- DirectedChannelInfo(DirectedChannelInfo&& o) : self(o.self) { memset(&o, 0, sizeof(DirectedChannelInfo)); }
- DirectedChannelInfo(LDKDirectedChannelInfo&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKDirectedChannelInfo)); }
- operator LDKDirectedChannelInfo() && { LDKDirectedChannelInfo res = self; memset(&self, 0, sizeof(LDKDirectedChannelInfo)); return res; }
- ~DirectedChannelInfo() { DirectedChannelInfo_free(self); }
- DirectedChannelInfo& operator=(DirectedChannelInfo&& o) { DirectedChannelInfo_free(self); self = o.self; memset(&o, 0, sizeof(DirectedChannelInfo)); return *this; }
- LDKDirectedChannelInfo* operator &() { return &self; }
- LDKDirectedChannelInfo* operator ->() { return &self; }
- const LDKDirectedChannelInfo* operator &() const { return &self; }
- const LDKDirectedChannelInfo* operator ->() const { return &self; }
-};
-class EffectiveCapacity {
-private:
- LDKEffectiveCapacity self;
-public:
- EffectiveCapacity(const EffectiveCapacity&) = delete;
- EffectiveCapacity(EffectiveCapacity&& o) : self(o.self) { memset(&o, 0, sizeof(EffectiveCapacity)); }
- EffectiveCapacity(LDKEffectiveCapacity&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKEffectiveCapacity)); }
- operator LDKEffectiveCapacity() && { LDKEffectiveCapacity res = self; memset(&self, 0, sizeof(LDKEffectiveCapacity)); return res; }
- ~EffectiveCapacity() { EffectiveCapacity_free(self); }
- EffectiveCapacity& operator=(EffectiveCapacity&& o) { EffectiveCapacity_free(self); self = o.self; memset(&o, 0, sizeof(EffectiveCapacity)); return *this; }
- LDKEffectiveCapacity* operator &() { return &self; }
- LDKEffectiveCapacity* operator ->() { return &self; }
- const LDKEffectiveCapacity* operator &() const { return &self; }
- const LDKEffectiveCapacity* operator ->() const { return &self; }
-};
-class RoutingFees {
-private:
- LDKRoutingFees self;
-public:
- RoutingFees(const RoutingFees&) = delete;
- RoutingFees(RoutingFees&& o) : self(o.self) { memset(&o, 0, sizeof(RoutingFees)); }
- RoutingFees(LDKRoutingFees&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKRoutingFees)); }
- operator LDKRoutingFees() && { LDKRoutingFees res = self; memset(&self, 0, sizeof(LDKRoutingFees)); return res; }
- ~RoutingFees() { RoutingFees_free(self); }
- RoutingFees& operator=(RoutingFees&& o) { RoutingFees_free(self); self = o.self; memset(&o, 0, sizeof(RoutingFees)); return *this; }
- LDKRoutingFees* operator &() { return &self; }
- LDKRoutingFees* operator ->() { return &self; }
- const LDKRoutingFees* operator &() const { return &self; }
- const LDKRoutingFees* operator ->() const { return &self; }
-};
-class NodeAnnouncementInfo {
+class RapidGossipSync {
private:
- LDKNodeAnnouncementInfo self;
+ LDKRapidGossipSync self;
public:
- NodeAnnouncementInfo(const NodeAnnouncementInfo&) = delete;
- NodeAnnouncementInfo(NodeAnnouncementInfo&& o) : self(o.self) { memset(&o, 0, sizeof(NodeAnnouncementInfo)); }
- NodeAnnouncementInfo(LDKNodeAnnouncementInfo&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKNodeAnnouncementInfo)); }
- operator LDKNodeAnnouncementInfo() && { LDKNodeAnnouncementInfo res = self; memset(&self, 0, sizeof(LDKNodeAnnouncementInfo)); return res; }
- ~NodeAnnouncementInfo() { NodeAnnouncementInfo_free(self); }
- NodeAnnouncementInfo& operator=(NodeAnnouncementInfo&& o) { NodeAnnouncementInfo_free(self); self = o.self; memset(&o, 0, sizeof(NodeAnnouncementInfo)); return *this; }
- LDKNodeAnnouncementInfo* operator &() { return &self; }
- LDKNodeAnnouncementInfo* operator ->() { return &self; }
- const LDKNodeAnnouncementInfo* operator &() const { return &self; }
- const LDKNodeAnnouncementInfo* operator ->() const { return &self; }
+ RapidGossipSync(const RapidGossipSync&) = delete;
+ RapidGossipSync(RapidGossipSync&& o) : self(o.self) { memset(&o, 0, sizeof(RapidGossipSync)); }
+ RapidGossipSync(LDKRapidGossipSync&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKRapidGossipSync)); }
+ operator LDKRapidGossipSync() && { LDKRapidGossipSync res = self; memset(&self, 0, sizeof(LDKRapidGossipSync)); return res; }
+ ~RapidGossipSync() { RapidGossipSync_free(self); }
+ RapidGossipSync& operator=(RapidGossipSync&& o) { RapidGossipSync_free(self); self = o.self; memset(&o, 0, sizeof(RapidGossipSync)); return *this; }
+ LDKRapidGossipSync* operator &() { return &self; }
+ LDKRapidGossipSync* operator ->() { return &self; }
+ const LDKRapidGossipSync* operator &() const { return &self; }
+ const LDKRapidGossipSync* operator ->() const { return &self; }
};
-class NodeInfo {
+class Persister {
private:
- LDKNodeInfo self;
+ LDKPersister self;
public:
- NodeInfo(const NodeInfo&) = delete;
- NodeInfo(NodeInfo&& o) : self(o.self) { memset(&o, 0, sizeof(NodeInfo)); }
- NodeInfo(LDKNodeInfo&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKNodeInfo)); }
- operator LDKNodeInfo() && { LDKNodeInfo res = self; memset(&self, 0, sizeof(LDKNodeInfo)); return res; }
- ~NodeInfo() { NodeInfo_free(self); }
- NodeInfo& operator=(NodeInfo&& o) { NodeInfo_free(self); self = o.self; memset(&o, 0, sizeof(NodeInfo)); return *this; }
- LDKNodeInfo* operator &() { return &self; }
- LDKNodeInfo* operator ->() { return &self; }
- const LDKNodeInfo* operator &() const { return &self; }
- const LDKNodeInfo* operator ->() const { return &self; }
+ Persister(const Persister&) = delete;
+ Persister(Persister&& o) : self(o.self) { memset(&o, 0, sizeof(Persister)); }
+ Persister(LDKPersister&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKPersister)); }
+ operator LDKPersister() && { LDKPersister res = self; memset(&self, 0, sizeof(LDKPersister)); return res; }
+ ~Persister() { Persister_free(self); }
+ Persister& operator=(Persister&& o) { Persister_free(self); self = o.self; memset(&o, 0, sizeof(Persister)); return *this; }
+ LDKPersister* operator &() { return &self; }
+ LDKPersister* operator ->() { return &self; }
+ const LDKPersister* operator &() const { return &self; }
+ const LDKPersister* operator ->() const { return &self; }
+ /**
+ * Persist the given ['ChannelManager'] to disk, returning an error if persistence failed.
+ */
+ inline LDK::CResult_NoneErrorZ persist_manager(const struct LDKChannelManager *NONNULL_PTR channel_manager);
+ /**
+ * Persist the given [`NetworkGraph`] to disk, returning an error if persistence failed.
+ */
+ inline LDK::CResult_NoneErrorZ persist_graph(const struct LDKNetworkGraph *NONNULL_PTR network_graph);
+ /**
+ * Persist the given [`MultiThreadedLockableScore`] to disk, returning an error if persistence failed.
+ */
+ inline LDK::CResult_NoneErrorZ persist_scorer(const struct LDKMultiThreadedLockableScore *NONNULL_PTR scorer);
};
class DecodeError {
private:
const LDKFundingSigned* operator &() const { return &self; }
const LDKFundingSigned* operator ->() const { return &self; }
};
-class FundingLocked {
+class ChannelReady {
private:
- LDKFundingLocked self;
+ LDKChannelReady self;
public:
- FundingLocked(const FundingLocked&) = delete;
- FundingLocked(FundingLocked&& o) : self(o.self) { memset(&o, 0, sizeof(FundingLocked)); }
- FundingLocked(LDKFundingLocked&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKFundingLocked)); }
- operator LDKFundingLocked() && { LDKFundingLocked res = self; memset(&self, 0, sizeof(LDKFundingLocked)); return res; }
- ~FundingLocked() { FundingLocked_free(self); }
- FundingLocked& operator=(FundingLocked&& o) { FundingLocked_free(self); self = o.self; memset(&o, 0, sizeof(FundingLocked)); return *this; }
- LDKFundingLocked* operator &() { return &self; }
- LDKFundingLocked* operator ->() { return &self; }
- const LDKFundingLocked* operator &() const { return &self; }
- const LDKFundingLocked* operator ->() const { return &self; }
+ ChannelReady(const ChannelReady&) = delete;
+ ChannelReady(ChannelReady&& o) : self(o.self) { memset(&o, 0, sizeof(ChannelReady)); }
+ ChannelReady(LDKChannelReady&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChannelReady)); }
+ operator LDKChannelReady() && { LDKChannelReady res = self; memset(&self, 0, sizeof(LDKChannelReady)); return res; }
+ ~ChannelReady() { ChannelReady_free(self); }
+ ChannelReady& operator=(ChannelReady&& o) { ChannelReady_free(self); self = o.self; memset(&o, 0, sizeof(ChannelReady)); return *this; }
+ LDKChannelReady* operator &() { return &self; }
+ LDKChannelReady* operator ->() { return &self; }
+ const LDKChannelReady* operator &() const { return &self; }
+ const LDKChannelReady* operator ->() const { return &self; }
};
class Shutdown {
private:
*/
inline void handle_funding_signed(struct LDKPublicKey their_node_id, const struct LDKFundingSigned *NONNULL_PTR msg);
/**
- * Handle an incoming funding_locked message from the given peer.
+ * Handle an incoming channel_ready message from the given peer.
*/
- inline void handle_funding_locked(struct LDKPublicKey their_node_id, const struct LDKFundingLocked *NONNULL_PTR msg);
+ inline void handle_channel_ready(struct LDKPublicKey their_node_id, const struct LDKChannelReady *NONNULL_PTR msg);
/**
* Handle an incoming shutdown message from the given peer.
*/
*/
inline LDK::CResult_NoneLightningErrorZ handle_query_short_channel_ids(struct LDKPublicKey their_node_id, struct LDKQueryShortChannelIds msg);
};
+class GraphSyncError {
+private:
+ LDKGraphSyncError self;
+public:
+ GraphSyncError(const GraphSyncError&) = delete;
+ GraphSyncError(GraphSyncError&& o) : self(o.self) { memset(&o, 0, sizeof(GraphSyncError)); }
+ GraphSyncError(LDKGraphSyncError&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKGraphSyncError)); }
+ operator LDKGraphSyncError() && { LDKGraphSyncError res = self; memset(&self, 0, sizeof(LDKGraphSyncError)); return res; }
+ ~GraphSyncError() { GraphSyncError_free(self); }
+ GraphSyncError& operator=(GraphSyncError&& o) { GraphSyncError_free(self); self = o.self; memset(&o, 0, sizeof(GraphSyncError)); return *this; }
+ LDKGraphSyncError* operator &() { return &self; }
+ LDKGraphSyncError* operator ->() { return &self; }
+ const LDKGraphSyncError* operator &() const { return &self; }
+ const LDKGraphSyncError* operator ->() const { return &self; }
+};
class DefaultRouter {
private:
LDKDefaultRouter self;
const LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* operator &() const { return &self; }
const LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* operator ->() const { return &self; }
};
-class CResult_ScoringParametersDecodeErrorZ {
+class CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
private:
- LDKCResult_ScoringParametersDecodeErrorZ self;
+ LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ self;
public:
- CResult_ScoringParametersDecodeErrorZ(const CResult_ScoringParametersDecodeErrorZ&) = delete;
- CResult_ScoringParametersDecodeErrorZ(CResult_ScoringParametersDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ScoringParametersDecodeErrorZ)); }
- CResult_ScoringParametersDecodeErrorZ(LDKCResult_ScoringParametersDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ScoringParametersDecodeErrorZ)); }
- operator LDKCResult_ScoringParametersDecodeErrorZ() && { LDKCResult_ScoringParametersDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ScoringParametersDecodeErrorZ)); return res; }
- ~CResult_ScoringParametersDecodeErrorZ() { CResult_ScoringParametersDecodeErrorZ_free(self); }
- CResult_ScoringParametersDecodeErrorZ& operator=(CResult_ScoringParametersDecodeErrorZ&& o) { CResult_ScoringParametersDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ScoringParametersDecodeErrorZ)); return *this; }
- LDKCResult_ScoringParametersDecodeErrorZ* operator &() { return &self; }
- LDKCResult_ScoringParametersDecodeErrorZ* operator ->() { return &self; }
- const LDKCResult_ScoringParametersDecodeErrorZ* operator &() const { return &self; }
- const LDKCResult_ScoringParametersDecodeErrorZ* operator ->() const { return &self; }
+ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ(const CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ&) = delete;
+ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ(CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ)); }
+ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ)); }
+ operator LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ() && { LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ res = self; memset(&self, 0, sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ)); return res; }
+ ~CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ() { CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(self); }
+ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ& operator=(CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ&& o) { CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ)); return *this; }
+ LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ* operator &() { return &self; }
+ LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ* operator ->() { return &self; }
+ const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ* operator &() const { return &self; }
+ const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ* operator ->() const { return &self; }
};
class CResult_HTLCUpdateDecodeErrorZ {
private:
const LDKC2Tuple_SignatureCVec_SignatureZZ* operator &() const { return &self; }
const LDKC2Tuple_SignatureCVec_SignatureZZ* operator ->() const { return &self; }
};
-class CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
-private:
- LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ self;
-public:
- CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ(const CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ&) = delete;
- CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ(CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ)); }
- CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ)); }
- operator LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ() && { LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ res = self; memset(&self, 0, sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ)); return res; }
- ~CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ() { CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(self); }
- CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ& operator=(CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ&& o) { CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ)); return *this; }
- LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ* operator &() { return &self; }
- LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ* operator ->() { return &self; }
- const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ* operator &() const { return &self; }
- const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ* operator ->() const { return &self; }
-};
class CVec_C2Tuple_u32TxOutZZ {
private:
LDKCVec_C2Tuple_u32TxOutZZ self;
const LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* operator &() const { return &self; }
const LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* operator ->() const { return &self; }
};
-class COption_u32Z {
-private:
- LDKCOption_u32Z self;
-public:
- COption_u32Z(const COption_u32Z&) = delete;
- COption_u32Z(COption_u32Z&& o) : self(o.self) { memset(&o, 0, sizeof(COption_u32Z)); }
- COption_u32Z(LDKCOption_u32Z&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_u32Z)); }
- operator LDKCOption_u32Z() && { LDKCOption_u32Z res = self; memset(&self, 0, sizeof(LDKCOption_u32Z)); return res; }
- ~COption_u32Z() { COption_u32Z_free(self); }
- COption_u32Z& operator=(COption_u32Z&& o) { COption_u32Z_free(self); self = o.self; memset(&o, 0, sizeof(COption_u32Z)); return *this; }
- LDKCOption_u32Z* operator &() { return &self; }
- LDKCOption_u32Z* operator ->() { return &self; }
- const LDKCOption_u32Z* operator &() const { return &self; }
- const LDKCOption_u32Z* operator ->() const { return &self; }
-};
class CResult_InitFeaturesDecodeErrorZ {
private:
LDKCResult_InitFeaturesDecodeErrorZ self;
const LDKCResult_InitFeaturesDecodeErrorZ* operator &() const { return &self; }
const LDKCResult_InitFeaturesDecodeErrorZ* operator ->() const { return &self; }
};
+class COption_u32Z {
+private:
+ LDKCOption_u32Z self;
+public:
+ COption_u32Z(const COption_u32Z&) = delete;
+ COption_u32Z(COption_u32Z&& o) : self(o.self) { memset(&o, 0, sizeof(COption_u32Z)); }
+ COption_u32Z(LDKCOption_u32Z&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_u32Z)); }
+ operator LDKCOption_u32Z() && { LDKCOption_u32Z res = self; memset(&self, 0, sizeof(LDKCOption_u32Z)); return res; }
+ ~COption_u32Z() { COption_u32Z_free(self); }
+ COption_u32Z& operator=(COption_u32Z&& o) { COption_u32Z_free(self); self = o.self; memset(&o, 0, sizeof(COption_u32Z)); return *this; }
+ LDKCOption_u32Z* operator &() { return &self; }
+ LDKCOption_u32Z* operator ->() { return &self; }
+ const LDKCOption_u32Z* operator &() const { return &self; }
+ const LDKCOption_u32Z* operator ->() const { return &self; }
+};
class CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
private:
LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ self;
const LDKCVec_TransactionZ* operator &() const { return &self; }
const LDKCVec_TransactionZ* operator ->() const { return &self; }
};
-class CResult_UpdateFeeDecodeErrorZ {
+class CResult_ChannelReadyDecodeErrorZ {
private:
- LDKCResult_UpdateFeeDecodeErrorZ self;
+ LDKCResult_ChannelReadyDecodeErrorZ self;
public:
- CResult_UpdateFeeDecodeErrorZ(const CResult_UpdateFeeDecodeErrorZ&) = delete;
- CResult_UpdateFeeDecodeErrorZ(CResult_UpdateFeeDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_UpdateFeeDecodeErrorZ)); }
- CResult_UpdateFeeDecodeErrorZ(LDKCResult_UpdateFeeDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_UpdateFeeDecodeErrorZ)); }
- operator LDKCResult_UpdateFeeDecodeErrorZ() && { LDKCResult_UpdateFeeDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_UpdateFeeDecodeErrorZ)); return res; }
- ~CResult_UpdateFeeDecodeErrorZ() { CResult_UpdateFeeDecodeErrorZ_free(self); }
- CResult_UpdateFeeDecodeErrorZ& operator=(CResult_UpdateFeeDecodeErrorZ&& o) { CResult_UpdateFeeDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_UpdateFeeDecodeErrorZ)); return *this; }
- LDKCResult_UpdateFeeDecodeErrorZ* operator &() { return &self; }
- LDKCResult_UpdateFeeDecodeErrorZ* operator ->() { return &self; }
- const LDKCResult_UpdateFeeDecodeErrorZ* operator &() const { return &self; }
- const LDKCResult_UpdateFeeDecodeErrorZ* operator ->() const { return &self; }
+ CResult_ChannelReadyDecodeErrorZ(const CResult_ChannelReadyDecodeErrorZ&) = delete;
+ CResult_ChannelReadyDecodeErrorZ(CResult_ChannelReadyDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ChannelReadyDecodeErrorZ)); }
+ CResult_ChannelReadyDecodeErrorZ(LDKCResult_ChannelReadyDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ChannelReadyDecodeErrorZ)); }
+ operator LDKCResult_ChannelReadyDecodeErrorZ() && { LDKCResult_ChannelReadyDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ChannelReadyDecodeErrorZ)); return res; }
+ ~CResult_ChannelReadyDecodeErrorZ() { CResult_ChannelReadyDecodeErrorZ_free(self); }
+ CResult_ChannelReadyDecodeErrorZ& operator=(CResult_ChannelReadyDecodeErrorZ&& o) { CResult_ChannelReadyDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ChannelReadyDecodeErrorZ)); return *this; }
+ LDKCResult_ChannelReadyDecodeErrorZ* operator &() { return &self; }
+ LDKCResult_ChannelReadyDecodeErrorZ* operator ->() { return &self; }
+ const LDKCResult_ChannelReadyDecodeErrorZ* operator &() const { return &self; }
+ const LDKCResult_ChannelReadyDecodeErrorZ* operator ->() const { return &self; }
};
class CResult_RouteHopDecodeErrorZ {
private:
const LDKCResult_RouteHopDecodeErrorZ* operator &() const { return &self; }
const LDKCResult_RouteHopDecodeErrorZ* operator ->() const { return &self; }
};
+class CResult_UpdateFeeDecodeErrorZ {
+private:
+ LDKCResult_UpdateFeeDecodeErrorZ self;
+public:
+ CResult_UpdateFeeDecodeErrorZ(const CResult_UpdateFeeDecodeErrorZ&) = delete;
+ CResult_UpdateFeeDecodeErrorZ(CResult_UpdateFeeDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_UpdateFeeDecodeErrorZ)); }
+ CResult_UpdateFeeDecodeErrorZ(LDKCResult_UpdateFeeDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_UpdateFeeDecodeErrorZ)); }
+ operator LDKCResult_UpdateFeeDecodeErrorZ() && { LDKCResult_UpdateFeeDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_UpdateFeeDecodeErrorZ)); return res; }
+ ~CResult_UpdateFeeDecodeErrorZ() { CResult_UpdateFeeDecodeErrorZ_free(self); }
+ CResult_UpdateFeeDecodeErrorZ& operator=(CResult_UpdateFeeDecodeErrorZ&& o) { CResult_UpdateFeeDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_UpdateFeeDecodeErrorZ)); return *this; }
+ LDKCResult_UpdateFeeDecodeErrorZ* operator &() { return &self; }
+ LDKCResult_UpdateFeeDecodeErrorZ* operator ->() { return &self; }
+ const LDKCResult_UpdateFeeDecodeErrorZ* operator &() const { return &self; }
+ const LDKCResult_UpdateFeeDecodeErrorZ* operator ->() const { return &self; }
+};
class CResult_NodeAnnouncementDecodeErrorZ {
private:
LDKCResult_NodeAnnouncementDecodeErrorZ self;
const LDKCResult_TxCreationKeysErrorZ* operator &() const { return &self; }
const LDKCResult_TxCreationKeysErrorZ* operator ->() const { return &self; }
};
-class C2Tuple_BlockHashChannelMonitorZ {
-private:
- LDKC2Tuple_BlockHashChannelMonitorZ self;
-public:
- C2Tuple_BlockHashChannelMonitorZ(const C2Tuple_BlockHashChannelMonitorZ&) = delete;
- C2Tuple_BlockHashChannelMonitorZ(C2Tuple_BlockHashChannelMonitorZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_BlockHashChannelMonitorZ)); }
- C2Tuple_BlockHashChannelMonitorZ(LDKC2Tuple_BlockHashChannelMonitorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_BlockHashChannelMonitorZ)); }
- operator LDKC2Tuple_BlockHashChannelMonitorZ() && { LDKC2Tuple_BlockHashChannelMonitorZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_BlockHashChannelMonitorZ)); return res; }
- ~C2Tuple_BlockHashChannelMonitorZ() { C2Tuple_BlockHashChannelMonitorZ_free(self); }
- C2Tuple_BlockHashChannelMonitorZ& operator=(C2Tuple_BlockHashChannelMonitorZ&& o) { C2Tuple_BlockHashChannelMonitorZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_BlockHashChannelMonitorZ)); return *this; }
- LDKC2Tuple_BlockHashChannelMonitorZ* operator &() { return &self; }
- LDKC2Tuple_BlockHashChannelMonitorZ* operator ->() { return &self; }
- const LDKC2Tuple_BlockHashChannelMonitorZ* operator &() const { return &self; }
- const LDKC2Tuple_BlockHashChannelMonitorZ* operator ->() const { return &self; }
-};
class CResult_NodeIdDecodeErrorZ {
private:
LDKCResult_NodeIdDecodeErrorZ self;
const LDKCResult_NodeIdDecodeErrorZ* operator &() const { return &self; }
const LDKCResult_NodeIdDecodeErrorZ* operator ->() const { return &self; }
};
+class C2Tuple_BlockHashChannelMonitorZ {
+private:
+ LDKC2Tuple_BlockHashChannelMonitorZ self;
+public:
+ C2Tuple_BlockHashChannelMonitorZ(const C2Tuple_BlockHashChannelMonitorZ&) = delete;
+ C2Tuple_BlockHashChannelMonitorZ(C2Tuple_BlockHashChannelMonitorZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_BlockHashChannelMonitorZ)); }
+ C2Tuple_BlockHashChannelMonitorZ(LDKC2Tuple_BlockHashChannelMonitorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_BlockHashChannelMonitorZ)); }
+ operator LDKC2Tuple_BlockHashChannelMonitorZ() && { LDKC2Tuple_BlockHashChannelMonitorZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_BlockHashChannelMonitorZ)); return res; }
+ ~C2Tuple_BlockHashChannelMonitorZ() { C2Tuple_BlockHashChannelMonitorZ_free(self); }
+ C2Tuple_BlockHashChannelMonitorZ& operator=(C2Tuple_BlockHashChannelMonitorZ&& o) { C2Tuple_BlockHashChannelMonitorZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_BlockHashChannelMonitorZ)); return *this; }
+ LDKC2Tuple_BlockHashChannelMonitorZ* operator &() { return &self; }
+ LDKC2Tuple_BlockHashChannelMonitorZ* operator ->() { return &self; }
+ const LDKC2Tuple_BlockHashChannelMonitorZ* operator &() const { return &self; }
+ const LDKC2Tuple_BlockHashChannelMonitorZ* operator ->() const { return &self; }
+};
class CResult_ShutdownScriptInvalidShutdownScriptZ {
private:
LDKCResult_ShutdownScriptInvalidShutdownScriptZ self;
const LDKCResult_ShutdownScriptInvalidShutdownScriptZ* operator &() const { return &self; }
const LDKCResult_ShutdownScriptInvalidShutdownScriptZ* operator ->() const { return &self; }
};
-class CResult_RecoverableSignatureNoneZ {
+class CResult_NodeAnnouncementInfoDecodeErrorZ {
private:
- LDKCResult_RecoverableSignatureNoneZ self;
+ LDKCResult_NodeAnnouncementInfoDecodeErrorZ self;
public:
- CResult_RecoverableSignatureNoneZ(const CResult_RecoverableSignatureNoneZ&) = delete;
- CResult_RecoverableSignatureNoneZ(CResult_RecoverableSignatureNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_RecoverableSignatureNoneZ)); }
- CResult_RecoverableSignatureNoneZ(LDKCResult_RecoverableSignatureNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_RecoverableSignatureNoneZ)); }
- operator LDKCResult_RecoverableSignatureNoneZ() && { LDKCResult_RecoverableSignatureNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_RecoverableSignatureNoneZ)); return res; }
- ~CResult_RecoverableSignatureNoneZ() { CResult_RecoverableSignatureNoneZ_free(self); }
- CResult_RecoverableSignatureNoneZ& operator=(CResult_RecoverableSignatureNoneZ&& o) { CResult_RecoverableSignatureNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_RecoverableSignatureNoneZ)); return *this; }
- LDKCResult_RecoverableSignatureNoneZ* operator &() { return &self; }
- LDKCResult_RecoverableSignatureNoneZ* operator ->() { return &self; }
- const LDKCResult_RecoverableSignatureNoneZ* operator &() const { return &self; }
- const LDKCResult_RecoverableSignatureNoneZ* operator ->() const { return &self; }
+ CResult_NodeAnnouncementInfoDecodeErrorZ(const CResult_NodeAnnouncementInfoDecodeErrorZ&) = delete;
+ CResult_NodeAnnouncementInfoDecodeErrorZ(CResult_NodeAnnouncementInfoDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NodeAnnouncementInfoDecodeErrorZ)); }
+ CResult_NodeAnnouncementInfoDecodeErrorZ(LDKCResult_NodeAnnouncementInfoDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ)); }
+ operator LDKCResult_NodeAnnouncementInfoDecodeErrorZ() && { LDKCResult_NodeAnnouncementInfoDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ)); return res; }
+ ~CResult_NodeAnnouncementInfoDecodeErrorZ() { CResult_NodeAnnouncementInfoDecodeErrorZ_free(self); }
+ CResult_NodeAnnouncementInfoDecodeErrorZ& operator=(CResult_NodeAnnouncementInfoDecodeErrorZ&& o) { CResult_NodeAnnouncementInfoDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NodeAnnouncementInfoDecodeErrorZ)); return *this; }
+ LDKCResult_NodeAnnouncementInfoDecodeErrorZ* operator &() { return &self; }
+ LDKCResult_NodeAnnouncementInfoDecodeErrorZ* operator ->() { return &self; }
+ const LDKCResult_NodeAnnouncementInfoDecodeErrorZ* operator &() const { return &self; }
+ const LDKCResult_NodeAnnouncementInfoDecodeErrorZ* operator ->() const { return &self; }
};
class CResult_COption_NetworkUpdateZDecodeErrorZ {
private:
const LDKCResult_COption_NetworkUpdateZDecodeErrorZ* operator &() const { return &self; }
const LDKCResult_COption_NetworkUpdateZDecodeErrorZ* operator ->() const { return &self; }
};
-class CResult_NodeAnnouncementInfoDecodeErrorZ {
+class CResult_RecoverableSignatureNoneZ {
private:
- LDKCResult_NodeAnnouncementInfoDecodeErrorZ self;
+ LDKCResult_RecoverableSignatureNoneZ self;
public:
- CResult_NodeAnnouncementInfoDecodeErrorZ(const CResult_NodeAnnouncementInfoDecodeErrorZ&) = delete;
- CResult_NodeAnnouncementInfoDecodeErrorZ(CResult_NodeAnnouncementInfoDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NodeAnnouncementInfoDecodeErrorZ)); }
- CResult_NodeAnnouncementInfoDecodeErrorZ(LDKCResult_NodeAnnouncementInfoDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ)); }
- operator LDKCResult_NodeAnnouncementInfoDecodeErrorZ() && { LDKCResult_NodeAnnouncementInfoDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ)); return res; }
- ~CResult_NodeAnnouncementInfoDecodeErrorZ() { CResult_NodeAnnouncementInfoDecodeErrorZ_free(self); }
- CResult_NodeAnnouncementInfoDecodeErrorZ& operator=(CResult_NodeAnnouncementInfoDecodeErrorZ&& o) { CResult_NodeAnnouncementInfoDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NodeAnnouncementInfoDecodeErrorZ)); return *this; }
- LDKCResult_NodeAnnouncementInfoDecodeErrorZ* operator &() { return &self; }
- LDKCResult_NodeAnnouncementInfoDecodeErrorZ* operator ->() { return &self; }
- const LDKCResult_NodeAnnouncementInfoDecodeErrorZ* operator &() const { return &self; }
- const LDKCResult_NodeAnnouncementInfoDecodeErrorZ* operator ->() const { return &self; }
+ CResult_RecoverableSignatureNoneZ(const CResult_RecoverableSignatureNoneZ&) = delete;
+ CResult_RecoverableSignatureNoneZ(CResult_RecoverableSignatureNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_RecoverableSignatureNoneZ)); }
+ CResult_RecoverableSignatureNoneZ(LDKCResult_RecoverableSignatureNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_RecoverableSignatureNoneZ)); }
+ operator LDKCResult_RecoverableSignatureNoneZ() && { LDKCResult_RecoverableSignatureNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_RecoverableSignatureNoneZ)); return res; }
+ ~CResult_RecoverableSignatureNoneZ() { CResult_RecoverableSignatureNoneZ_free(self); }
+ CResult_RecoverableSignatureNoneZ& operator=(CResult_RecoverableSignatureNoneZ&& o) { CResult_RecoverableSignatureNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_RecoverableSignatureNoneZ)); return *this; }
+ LDKCResult_RecoverableSignatureNoneZ* operator &() { return &self; }
+ LDKCResult_RecoverableSignatureNoneZ* operator ->() { return &self; }
+ const LDKCResult_RecoverableSignatureNoneZ* operator &() const { return &self; }
+ const LDKCResult_RecoverableSignatureNoneZ* operator ->() const { return &self; }
};
class C3Tuple_RawInvoice_u832InvoiceSignatureZ {
private:
const LDKCVec_RouteHopZ* operator &() const { return &self; }
const LDKCVec_RouteHopZ* operator ->() const { return &self; }
};
+class CResult_NodeInfoDecodeErrorZ {
+private:
+ LDKCResult_NodeInfoDecodeErrorZ self;
+public:
+ CResult_NodeInfoDecodeErrorZ(const CResult_NodeInfoDecodeErrorZ&) = delete;
+ CResult_NodeInfoDecodeErrorZ(CResult_NodeInfoDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NodeInfoDecodeErrorZ)); }
+ CResult_NodeInfoDecodeErrorZ(LDKCResult_NodeInfoDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NodeInfoDecodeErrorZ)); }
+ operator LDKCResult_NodeInfoDecodeErrorZ() && { LDKCResult_NodeInfoDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NodeInfoDecodeErrorZ)); return res; }
+ ~CResult_NodeInfoDecodeErrorZ() { CResult_NodeInfoDecodeErrorZ_free(self); }
+ CResult_NodeInfoDecodeErrorZ& operator=(CResult_NodeInfoDecodeErrorZ&& o) { CResult_NodeInfoDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NodeInfoDecodeErrorZ)); return *this; }
+ LDKCResult_NodeInfoDecodeErrorZ* operator &() { return &self; }
+ LDKCResult_NodeInfoDecodeErrorZ* operator ->() { return &self; }
+ const LDKCResult_NodeInfoDecodeErrorZ* operator &() const { return &self; }
+ const LDKCResult_NodeInfoDecodeErrorZ* operator ->() const { return &self; }
+};
class CVec_C2Tuple_BlockHashChannelMonitorZZ {
private:
LDKCVec_C2Tuple_BlockHashChannelMonitorZZ self;
const LDKCVec_C2Tuple_BlockHashChannelMonitorZZ* operator &() const { return &self; }
const LDKCVec_C2Tuple_BlockHashChannelMonitorZZ* operator ->() const { return &self; }
};
-class CResult_NonePaymentSendFailureZ {
-private:
- LDKCResult_NonePaymentSendFailureZ self;
-public:
- CResult_NonePaymentSendFailureZ(const CResult_NonePaymentSendFailureZ&) = delete;
- CResult_NonePaymentSendFailureZ(CResult_NonePaymentSendFailureZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NonePaymentSendFailureZ)); }
- CResult_NonePaymentSendFailureZ(LDKCResult_NonePaymentSendFailureZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NonePaymentSendFailureZ)); }
- operator LDKCResult_NonePaymentSendFailureZ() && { LDKCResult_NonePaymentSendFailureZ res = self; memset(&self, 0, sizeof(LDKCResult_NonePaymentSendFailureZ)); return res; }
- ~CResult_NonePaymentSendFailureZ() { CResult_NonePaymentSendFailureZ_free(self); }
- CResult_NonePaymentSendFailureZ& operator=(CResult_NonePaymentSendFailureZ&& o) { CResult_NonePaymentSendFailureZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NonePaymentSendFailureZ)); return *this; }
- LDKCResult_NonePaymentSendFailureZ* operator &() { return &self; }
- LDKCResult_NonePaymentSendFailureZ* operator ->() { return &self; }
- const LDKCResult_NonePaymentSendFailureZ* operator &() const { return &self; }
- const LDKCResult_NonePaymentSendFailureZ* operator ->() const { return &self; }
-};
class CResult_RouteLightningErrorZ {
private:
LDKCResult_RouteLightningErrorZ self;
const LDKCVec_u8Z* operator &() const { return &self; }
const LDKCVec_u8Z* operator ->() const { return &self; }
};
-class CResult_NodeInfoDecodeErrorZ {
+class CResult_NonePaymentSendFailureZ {
private:
- LDKCResult_NodeInfoDecodeErrorZ self;
+ LDKCResult_NonePaymentSendFailureZ self;
public:
- CResult_NodeInfoDecodeErrorZ(const CResult_NodeInfoDecodeErrorZ&) = delete;
- CResult_NodeInfoDecodeErrorZ(CResult_NodeInfoDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NodeInfoDecodeErrorZ)); }
- CResult_NodeInfoDecodeErrorZ(LDKCResult_NodeInfoDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NodeInfoDecodeErrorZ)); }
- operator LDKCResult_NodeInfoDecodeErrorZ() && { LDKCResult_NodeInfoDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NodeInfoDecodeErrorZ)); return res; }
- ~CResult_NodeInfoDecodeErrorZ() { CResult_NodeInfoDecodeErrorZ_free(self); }
- CResult_NodeInfoDecodeErrorZ& operator=(CResult_NodeInfoDecodeErrorZ&& o) { CResult_NodeInfoDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NodeInfoDecodeErrorZ)); return *this; }
- LDKCResult_NodeInfoDecodeErrorZ* operator &() { return &self; }
- LDKCResult_NodeInfoDecodeErrorZ* operator ->() { return &self; }
- const LDKCResult_NodeInfoDecodeErrorZ* operator &() const { return &self; }
- const LDKCResult_NodeInfoDecodeErrorZ* operator ->() const { return &self; }
+ CResult_NonePaymentSendFailureZ(const CResult_NonePaymentSendFailureZ&) = delete;
+ CResult_NonePaymentSendFailureZ(CResult_NonePaymentSendFailureZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NonePaymentSendFailureZ)); }
+ CResult_NonePaymentSendFailureZ(LDKCResult_NonePaymentSendFailureZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NonePaymentSendFailureZ)); }
+ operator LDKCResult_NonePaymentSendFailureZ() && { LDKCResult_NonePaymentSendFailureZ res = self; memset(&self, 0, sizeof(LDKCResult_NonePaymentSendFailureZ)); return res; }
+ ~CResult_NonePaymentSendFailureZ() { CResult_NonePaymentSendFailureZ_free(self); }
+ CResult_NonePaymentSendFailureZ& operator=(CResult_NonePaymentSendFailureZ&& o) { CResult_NonePaymentSendFailureZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NonePaymentSendFailureZ)); return *this; }
+ LDKCResult_NonePaymentSendFailureZ* operator &() { return &self; }
+ LDKCResult_NonePaymentSendFailureZ* operator ->() { return &self; }
+ const LDKCResult_NonePaymentSendFailureZ* operator &() const { return &self; }
+ const LDKCResult_NonePaymentSendFailureZ* operator ->() const { return &self; }
};
class CResult_ClosingSignedDecodeErrorZ {
private:
const LDKCResult_PaymentParametersDecodeErrorZ* operator &() const { return &self; }
const LDKCResult_PaymentParametersDecodeErrorZ* operator ->() const { return &self; }
};
+class CResult_PaymentPurposeDecodeErrorZ {
+private:
+ LDKCResult_PaymentPurposeDecodeErrorZ self;
+public:
+ CResult_PaymentPurposeDecodeErrorZ(const CResult_PaymentPurposeDecodeErrorZ&) = delete;
+ CResult_PaymentPurposeDecodeErrorZ(CResult_PaymentPurposeDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PaymentPurposeDecodeErrorZ)); }
+ CResult_PaymentPurposeDecodeErrorZ(LDKCResult_PaymentPurposeDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PaymentPurposeDecodeErrorZ)); }
+ operator LDKCResult_PaymentPurposeDecodeErrorZ() && { LDKCResult_PaymentPurposeDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PaymentPurposeDecodeErrorZ)); return res; }
+ ~CResult_PaymentPurposeDecodeErrorZ() { CResult_PaymentPurposeDecodeErrorZ_free(self); }
+ CResult_PaymentPurposeDecodeErrorZ& operator=(CResult_PaymentPurposeDecodeErrorZ&& o) { CResult_PaymentPurposeDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PaymentPurposeDecodeErrorZ)); return *this; }
+ LDKCResult_PaymentPurposeDecodeErrorZ* operator &() { return &self; }
+ LDKCResult_PaymentPurposeDecodeErrorZ* operator ->() { return &self; }
+ const LDKCResult_PaymentPurposeDecodeErrorZ* operator &() const { return &self; }
+ const LDKCResult_PaymentPurposeDecodeErrorZ* operator ->() const { return &self; }
+};
class CResult_InitDecodeErrorZ {
private:
LDKCResult_InitDecodeErrorZ self;
const LDKCResult_SignDecodeErrorZ* operator &() const { return &self; }
const LDKCResult_SignDecodeErrorZ* operator ->() const { return &self; }
};
+class C2Tuple_OutPointCVec_MonitorEventZZ {
+private:
+ LDKC2Tuple_OutPointCVec_MonitorEventZZ self;
+public:
+ C2Tuple_OutPointCVec_MonitorEventZZ(const C2Tuple_OutPointCVec_MonitorEventZZ&) = delete;
+ C2Tuple_OutPointCVec_MonitorEventZZ(C2Tuple_OutPointCVec_MonitorEventZZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_OutPointCVec_MonitorEventZZ)); }
+ C2Tuple_OutPointCVec_MonitorEventZZ(LDKC2Tuple_OutPointCVec_MonitorEventZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_OutPointCVec_MonitorEventZZ)); }
+ operator LDKC2Tuple_OutPointCVec_MonitorEventZZ() && { LDKC2Tuple_OutPointCVec_MonitorEventZZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_OutPointCVec_MonitorEventZZ)); return res; }
+ ~C2Tuple_OutPointCVec_MonitorEventZZ() { C2Tuple_OutPointCVec_MonitorEventZZ_free(self); }
+ C2Tuple_OutPointCVec_MonitorEventZZ& operator=(C2Tuple_OutPointCVec_MonitorEventZZ&& o) { C2Tuple_OutPointCVec_MonitorEventZZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_OutPointCVec_MonitorEventZZ)); return *this; }
+ LDKC2Tuple_OutPointCVec_MonitorEventZZ* operator &() { return &self; }
+ LDKC2Tuple_OutPointCVec_MonitorEventZZ* operator ->() { return &self; }
+ const LDKC2Tuple_OutPointCVec_MonitorEventZZ* operator &() const { return &self; }
+ const LDKC2Tuple_OutPointCVec_MonitorEventZZ* operator ->() const { return &self; }
+};
class CVec_MessageSendEventZ {
private:
LDKCVec_MessageSendEventZ self;
private:
LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ self;
public:
- CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ(const CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ&) = delete;
- CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ(CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ)); }
- CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ)); }
- operator LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ() && { LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ)); return res; }
- ~CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ() { CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(self); }
- CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ& operator=(CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ&& o) { CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ)); return *this; }
- LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* operator &() { return &self; }
- LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* operator ->() { return &self; }
- const LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* operator &() const { return &self; }
- const LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* operator ->() const { return &self; }
-};
-class CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
-private:
- LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ self;
-public:
- CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ(const CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ&) = delete;
- CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ(CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ)); }
- CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ)); }
- operator LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ() && { LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ)); return res; }
- ~CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ() { CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(self); }
- CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ& operator=(CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ&& o) { CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ)); return *this; }
- LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* operator &() { return &self; }
- LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* operator ->() { return &self; }
- const LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* operator &() const { return &self; }
- const LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* operator ->() const { return &self; }
+ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ(const CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ&) = delete;
+ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ(CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ)); }
+ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ)); }
+ operator LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ() && { LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ)); return res; }
+ ~CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ() { CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(self); }
+ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ& operator=(CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ&& o) { CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ)); return *this; }
+ LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* operator &() { return &self; }
+ LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* operator ->() { return &self; }
+ const LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* operator &() const { return &self; }
+ const LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* operator ->() const { return &self; }
};
class CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
private:
const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* operator &() const { return &self; }
const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* operator ->() const { return &self; }
};
+class CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
+private:
+ LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ self;
+public:
+ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ(const CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ&) = delete;
+ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ(CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ)); }
+ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ)); }
+ operator LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ() && { LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ)); return res; }
+ ~CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ() { CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(self); }
+ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ& operator=(CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ&& o) { CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ)); return *this; }
+ LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* operator &() { return &self; }
+ LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* operator ->() { return &self; }
+ const LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* operator &() const { return &self; }
+ const LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* operator ->() const { return &self; }
+};
class CResult_CVec_CVec_u8ZZNoneZ {
private:
LDKCResult_CVec_CVec_u8ZZNoneZ self;
const LDKCVec_u64Z* operator &() const { return &self; }
const LDKCVec_u64Z* operator ->() const { return &self; }
};
-class CResult_ScorerDecodeErrorZ {
+class CResult_PongDecodeErrorZ {
private:
- LDKCResult_ScorerDecodeErrorZ self;
+ LDKCResult_PongDecodeErrorZ self;
public:
- CResult_ScorerDecodeErrorZ(const CResult_ScorerDecodeErrorZ&) = delete;
- CResult_ScorerDecodeErrorZ(CResult_ScorerDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ScorerDecodeErrorZ)); }
- CResult_ScorerDecodeErrorZ(LDKCResult_ScorerDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ScorerDecodeErrorZ)); }
- operator LDKCResult_ScorerDecodeErrorZ() && { LDKCResult_ScorerDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ScorerDecodeErrorZ)); return res; }
- ~CResult_ScorerDecodeErrorZ() { CResult_ScorerDecodeErrorZ_free(self); }
- CResult_ScorerDecodeErrorZ& operator=(CResult_ScorerDecodeErrorZ&& o) { CResult_ScorerDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ScorerDecodeErrorZ)); return *this; }
- LDKCResult_ScorerDecodeErrorZ* operator &() { return &self; }
- LDKCResult_ScorerDecodeErrorZ* operator ->() { return &self; }
- const LDKCResult_ScorerDecodeErrorZ* operator &() const { return &self; }
- const LDKCResult_ScorerDecodeErrorZ* operator ->() const { return &self; }
+ CResult_PongDecodeErrorZ(const CResult_PongDecodeErrorZ&) = delete;
+ CResult_PongDecodeErrorZ(CResult_PongDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PongDecodeErrorZ)); }
+ CResult_PongDecodeErrorZ(LDKCResult_PongDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PongDecodeErrorZ)); }
+ operator LDKCResult_PongDecodeErrorZ() && { LDKCResult_PongDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PongDecodeErrorZ)); return res; }
+ ~CResult_PongDecodeErrorZ() { CResult_PongDecodeErrorZ_free(self); }
+ CResult_PongDecodeErrorZ& operator=(CResult_PongDecodeErrorZ&& o) { CResult_PongDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PongDecodeErrorZ)); return *this; }
+ LDKCResult_PongDecodeErrorZ* operator &() { return &self; }
+ LDKCResult_PongDecodeErrorZ* operator ->() { return &self; }
+ const LDKCResult_PongDecodeErrorZ* operator &() const { return &self; }
+ const LDKCResult_PongDecodeErrorZ* operator ->() const { return &self; }
};
class CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
private:
const LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* operator &() const { return &self; }
const LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* operator ->() const { return &self; }
};
-class CResult_PongDecodeErrorZ {
-private:
- LDKCResult_PongDecodeErrorZ self;
-public:
- CResult_PongDecodeErrorZ(const CResult_PongDecodeErrorZ&) = delete;
- CResult_PongDecodeErrorZ(CResult_PongDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PongDecodeErrorZ)); }
- CResult_PongDecodeErrorZ(LDKCResult_PongDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PongDecodeErrorZ)); }
- operator LDKCResult_PongDecodeErrorZ() && { LDKCResult_PongDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PongDecodeErrorZ)); return res; }
- ~CResult_PongDecodeErrorZ() { CResult_PongDecodeErrorZ_free(self); }
- CResult_PongDecodeErrorZ& operator=(CResult_PongDecodeErrorZ&& o) { CResult_PongDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PongDecodeErrorZ)); return *this; }
- LDKCResult_PongDecodeErrorZ* operator &() { return &self; }
- LDKCResult_PongDecodeErrorZ* operator ->() { return &self; }
- const LDKCResult_PongDecodeErrorZ* operator &() const { return &self; }
- const LDKCResult_PongDecodeErrorZ* operator ->() const { return &self; }
-};
class CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
private:
LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ self;
const LDKCResult_DescriptionCreationErrorZ* operator &() const { return &self; }
const LDKCResult_DescriptionCreationErrorZ* operator ->() const { return &self; }
};
-class CResult_COption_MonitorEventZDecodeErrorZ {
+class CResult_RoutingFeesDecodeErrorZ {
private:
- LDKCResult_COption_MonitorEventZDecodeErrorZ self;
+ LDKCResult_RoutingFeesDecodeErrorZ self;
public:
- CResult_COption_MonitorEventZDecodeErrorZ(const CResult_COption_MonitorEventZDecodeErrorZ&) = delete;
- CResult_COption_MonitorEventZDecodeErrorZ(CResult_COption_MonitorEventZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_COption_MonitorEventZDecodeErrorZ)); }
- CResult_COption_MonitorEventZDecodeErrorZ(LDKCResult_COption_MonitorEventZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ)); }
- operator LDKCResult_COption_MonitorEventZDecodeErrorZ() && { LDKCResult_COption_MonitorEventZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ)); return res; }
- ~CResult_COption_MonitorEventZDecodeErrorZ() { CResult_COption_MonitorEventZDecodeErrorZ_free(self); }
- CResult_COption_MonitorEventZDecodeErrorZ& operator=(CResult_COption_MonitorEventZDecodeErrorZ&& o) { CResult_COption_MonitorEventZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_COption_MonitorEventZDecodeErrorZ)); return *this; }
- LDKCResult_COption_MonitorEventZDecodeErrorZ* operator &() { return &self; }
- LDKCResult_COption_MonitorEventZDecodeErrorZ* operator ->() { return &self; }
- const LDKCResult_COption_MonitorEventZDecodeErrorZ* operator &() const { return &self; }
- const LDKCResult_COption_MonitorEventZDecodeErrorZ* operator ->() const { return &self; }
+ CResult_RoutingFeesDecodeErrorZ(const CResult_RoutingFeesDecodeErrorZ&) = delete;
+ CResult_RoutingFeesDecodeErrorZ(CResult_RoutingFeesDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_RoutingFeesDecodeErrorZ)); }
+ CResult_RoutingFeesDecodeErrorZ(LDKCResult_RoutingFeesDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_RoutingFeesDecodeErrorZ)); }
+ operator LDKCResult_RoutingFeesDecodeErrorZ() && { LDKCResult_RoutingFeesDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_RoutingFeesDecodeErrorZ)); return res; }
+ ~CResult_RoutingFeesDecodeErrorZ() { CResult_RoutingFeesDecodeErrorZ_free(self); }
+ CResult_RoutingFeesDecodeErrorZ& operator=(CResult_RoutingFeesDecodeErrorZ&& o) { CResult_RoutingFeesDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_RoutingFeesDecodeErrorZ)); return *this; }
+ LDKCResult_RoutingFeesDecodeErrorZ* operator &() { return &self; }
+ LDKCResult_RoutingFeesDecodeErrorZ* operator ->() { return &self; }
+ const LDKCResult_RoutingFeesDecodeErrorZ* operator &() const { return &self; }
+ const LDKCResult_RoutingFeesDecodeErrorZ* operator ->() const { return &self; }
};
class CResult_PayeePubKeyErrorZ {
private:
const LDKCResult_PayeePubKeyErrorZ* operator &() const { return &self; }
const LDKCResult_PayeePubKeyErrorZ* operator ->() const { return &self; }
};
+class CResult_COption_MonitorEventZDecodeErrorZ {
+private:
+ LDKCResult_COption_MonitorEventZDecodeErrorZ self;
+public:
+ CResult_COption_MonitorEventZDecodeErrorZ(const CResult_COption_MonitorEventZDecodeErrorZ&) = delete;
+ CResult_COption_MonitorEventZDecodeErrorZ(CResult_COption_MonitorEventZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_COption_MonitorEventZDecodeErrorZ)); }
+ CResult_COption_MonitorEventZDecodeErrorZ(LDKCResult_COption_MonitorEventZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ)); }
+ operator LDKCResult_COption_MonitorEventZDecodeErrorZ() && { LDKCResult_COption_MonitorEventZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ)); return res; }
+ ~CResult_COption_MonitorEventZDecodeErrorZ() { CResult_COption_MonitorEventZDecodeErrorZ_free(self); }
+ CResult_COption_MonitorEventZDecodeErrorZ& operator=(CResult_COption_MonitorEventZDecodeErrorZ&& o) { CResult_COption_MonitorEventZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_COption_MonitorEventZDecodeErrorZ)); return *this; }
+ LDKCResult_COption_MonitorEventZDecodeErrorZ* operator &() { return &self; }
+ LDKCResult_COption_MonitorEventZDecodeErrorZ* operator ->() { return &self; }
+ const LDKCResult_COption_MonitorEventZDecodeErrorZ* operator &() const { return &self; }
+ const LDKCResult_COption_MonitorEventZDecodeErrorZ* operator ->() const { return &self; }
+};
class CVec_C2Tuple_PublicKeyTypeZZ {
private:
LDKCVec_C2Tuple_PublicKeyTypeZZ self;
const LDKCVec_C2Tuple_PublicKeyTypeZZ* operator &() const { return &self; }
const LDKCVec_C2Tuple_PublicKeyTypeZZ* operator ->() const { return &self; }
};
-class CResult_RoutingFeesDecodeErrorZ {
-private:
- LDKCResult_RoutingFeesDecodeErrorZ self;
-public:
- CResult_RoutingFeesDecodeErrorZ(const CResult_RoutingFeesDecodeErrorZ&) = delete;
- CResult_RoutingFeesDecodeErrorZ(CResult_RoutingFeesDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_RoutingFeesDecodeErrorZ)); }
- CResult_RoutingFeesDecodeErrorZ(LDKCResult_RoutingFeesDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_RoutingFeesDecodeErrorZ)); }
- operator LDKCResult_RoutingFeesDecodeErrorZ() && { LDKCResult_RoutingFeesDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_RoutingFeesDecodeErrorZ)); return res; }
- ~CResult_RoutingFeesDecodeErrorZ() { CResult_RoutingFeesDecodeErrorZ_free(self); }
- CResult_RoutingFeesDecodeErrorZ& operator=(CResult_RoutingFeesDecodeErrorZ&& o) { CResult_RoutingFeesDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_RoutingFeesDecodeErrorZ)); return *this; }
- LDKCResult_RoutingFeesDecodeErrorZ* operator &() { return &self; }
- LDKCResult_RoutingFeesDecodeErrorZ* operator ->() { return &self; }
- const LDKCResult_RoutingFeesDecodeErrorZ* operator &() const { return &self; }
- const LDKCResult_RoutingFeesDecodeErrorZ* operator ->() const { return &self; }
-};
-class CResult_QueryShortChannelIdsDecodeErrorZ {
+class CResult_u32GraphSyncErrorZ {
private:
- LDKCResult_QueryShortChannelIdsDecodeErrorZ self;
+ LDKCResult_u32GraphSyncErrorZ self;
public:
- CResult_QueryShortChannelIdsDecodeErrorZ(const CResult_QueryShortChannelIdsDecodeErrorZ&) = delete;
- CResult_QueryShortChannelIdsDecodeErrorZ(CResult_QueryShortChannelIdsDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_QueryShortChannelIdsDecodeErrorZ)); }
- CResult_QueryShortChannelIdsDecodeErrorZ(LDKCResult_QueryShortChannelIdsDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ)); }
- operator LDKCResult_QueryShortChannelIdsDecodeErrorZ() && { LDKCResult_QueryShortChannelIdsDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ)); return res; }
- ~CResult_QueryShortChannelIdsDecodeErrorZ() { CResult_QueryShortChannelIdsDecodeErrorZ_free(self); }
- CResult_QueryShortChannelIdsDecodeErrorZ& operator=(CResult_QueryShortChannelIdsDecodeErrorZ&& o) { CResult_QueryShortChannelIdsDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_QueryShortChannelIdsDecodeErrorZ)); return *this; }
- LDKCResult_QueryShortChannelIdsDecodeErrorZ* operator &() { return &self; }
- LDKCResult_QueryShortChannelIdsDecodeErrorZ* operator ->() { return &self; }
- const LDKCResult_QueryShortChannelIdsDecodeErrorZ* operator &() const { return &self; }
- const LDKCResult_QueryShortChannelIdsDecodeErrorZ* operator ->() const { return &self; }
+ CResult_u32GraphSyncErrorZ(const CResult_u32GraphSyncErrorZ&) = delete;
+ CResult_u32GraphSyncErrorZ(CResult_u32GraphSyncErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_u32GraphSyncErrorZ)); }
+ CResult_u32GraphSyncErrorZ(LDKCResult_u32GraphSyncErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_u32GraphSyncErrorZ)); }
+ operator LDKCResult_u32GraphSyncErrorZ() && { LDKCResult_u32GraphSyncErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_u32GraphSyncErrorZ)); return res; }
+ ~CResult_u32GraphSyncErrorZ() { CResult_u32GraphSyncErrorZ_free(self); }
+ CResult_u32GraphSyncErrorZ& operator=(CResult_u32GraphSyncErrorZ&& o) { CResult_u32GraphSyncErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_u32GraphSyncErrorZ)); return *this; }
+ LDKCResult_u32GraphSyncErrorZ* operator &() { return &self; }
+ LDKCResult_u32GraphSyncErrorZ* operator ->() { return &self; }
+ const LDKCResult_u32GraphSyncErrorZ* operator &() const { return &self; }
+ const LDKCResult_u32GraphSyncErrorZ* operator ->() const { return &self; }
};
class CResult_InvoiceSemanticErrorZ {
private:
const LDKCResult_UpdateAddHTLCDecodeErrorZ* operator &() const { return &self; }
const LDKCResult_UpdateAddHTLCDecodeErrorZ* operator ->() const { return &self; }
};
-class CVec_PhantomRouteHintsZ {
+class CResult_QueryShortChannelIdsDecodeErrorZ {
private:
- LDKCVec_PhantomRouteHintsZ self;
+ LDKCResult_QueryShortChannelIdsDecodeErrorZ self;
public:
- CVec_PhantomRouteHintsZ(const CVec_PhantomRouteHintsZ&) = delete;
- CVec_PhantomRouteHintsZ(CVec_PhantomRouteHintsZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_PhantomRouteHintsZ)); }
- CVec_PhantomRouteHintsZ(LDKCVec_PhantomRouteHintsZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_PhantomRouteHintsZ)); }
- operator LDKCVec_PhantomRouteHintsZ() && { LDKCVec_PhantomRouteHintsZ res = self; memset(&self, 0, sizeof(LDKCVec_PhantomRouteHintsZ)); return res; }
- ~CVec_PhantomRouteHintsZ() { CVec_PhantomRouteHintsZ_free(self); }
- CVec_PhantomRouteHintsZ& operator=(CVec_PhantomRouteHintsZ&& o) { CVec_PhantomRouteHintsZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_PhantomRouteHintsZ)); return *this; }
- LDKCVec_PhantomRouteHintsZ* operator &() { return &self; }
- LDKCVec_PhantomRouteHintsZ* operator ->() { return &self; }
- const LDKCVec_PhantomRouteHintsZ* operator &() const { return &self; }
- const LDKCVec_PhantomRouteHintsZ* operator ->() const { return &self; }
+ CResult_QueryShortChannelIdsDecodeErrorZ(const CResult_QueryShortChannelIdsDecodeErrorZ&) = delete;
+ CResult_QueryShortChannelIdsDecodeErrorZ(CResult_QueryShortChannelIdsDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_QueryShortChannelIdsDecodeErrorZ)); }
+ CResult_QueryShortChannelIdsDecodeErrorZ(LDKCResult_QueryShortChannelIdsDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ)); }
+ operator LDKCResult_QueryShortChannelIdsDecodeErrorZ() && { LDKCResult_QueryShortChannelIdsDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ)); return res; }
+ ~CResult_QueryShortChannelIdsDecodeErrorZ() { CResult_QueryShortChannelIdsDecodeErrorZ_free(self); }
+ CResult_QueryShortChannelIdsDecodeErrorZ& operator=(CResult_QueryShortChannelIdsDecodeErrorZ&& o) { CResult_QueryShortChannelIdsDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_QueryShortChannelIdsDecodeErrorZ)); return *this; }
+ LDKCResult_QueryShortChannelIdsDecodeErrorZ* operator &() { return &self; }
+ LDKCResult_QueryShortChannelIdsDecodeErrorZ* operator ->() { return &self; }
+ const LDKCResult_QueryShortChannelIdsDecodeErrorZ* operator &() const { return &self; }
+ const LDKCResult_QueryShortChannelIdsDecodeErrorZ* operator ->() const { return &self; }
};
class CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
private:
const LDKCResult_ChannelDetailsDecodeErrorZ* operator &() const { return &self; }
const LDKCResult_ChannelDetailsDecodeErrorZ* operator ->() const { return &self; }
};
+class CVec_PublicKeyZ {
+private:
+ LDKCVec_PublicKeyZ self;
+public:
+ CVec_PublicKeyZ(const CVec_PublicKeyZ&) = delete;
+ CVec_PublicKeyZ(CVec_PublicKeyZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_PublicKeyZ)); }
+ CVec_PublicKeyZ(LDKCVec_PublicKeyZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_PublicKeyZ)); }
+ operator LDKCVec_PublicKeyZ() && { LDKCVec_PublicKeyZ res = self; memset(&self, 0, sizeof(LDKCVec_PublicKeyZ)); return res; }
+ ~CVec_PublicKeyZ() { CVec_PublicKeyZ_free(self); }
+ CVec_PublicKeyZ& operator=(CVec_PublicKeyZ&& o) { CVec_PublicKeyZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_PublicKeyZ)); return *this; }
+ LDKCVec_PublicKeyZ* operator &() { return &self; }
+ LDKCVec_PublicKeyZ* operator ->() { return &self; }
+ const LDKCVec_PublicKeyZ* operator &() const { return &self; }
+ const LDKCVec_PublicKeyZ* operator ->() const { return &self; }
+};
class CVec_C2Tuple_usizeTransactionZZ {
private:
LDKCVec_C2Tuple_usizeTransactionZZ self;
const LDKCVec_C2Tuple_usizeTransactionZZ* operator &() const { return &self; }
const LDKCVec_C2Tuple_usizeTransactionZZ* operator ->() const { return &self; }
};
-class CVec_PublicKeyZ {
+class CVec_PhantomRouteHintsZ {
private:
- LDKCVec_PublicKeyZ self;
+ LDKCVec_PhantomRouteHintsZ self;
public:
- CVec_PublicKeyZ(const CVec_PublicKeyZ&) = delete;
- CVec_PublicKeyZ(CVec_PublicKeyZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_PublicKeyZ)); }
- CVec_PublicKeyZ(LDKCVec_PublicKeyZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_PublicKeyZ)); }
- operator LDKCVec_PublicKeyZ() && { LDKCVec_PublicKeyZ res = self; memset(&self, 0, sizeof(LDKCVec_PublicKeyZ)); return res; }
- ~CVec_PublicKeyZ() { CVec_PublicKeyZ_free(self); }
- CVec_PublicKeyZ& operator=(CVec_PublicKeyZ&& o) { CVec_PublicKeyZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_PublicKeyZ)); return *this; }
- LDKCVec_PublicKeyZ* operator &() { return &self; }
- LDKCVec_PublicKeyZ* operator ->() { return &self; }
- const LDKCVec_PublicKeyZ* operator &() const { return &self; }
- const LDKCVec_PublicKeyZ* operator ->() const { return &self; }
+ CVec_PhantomRouteHintsZ(const CVec_PhantomRouteHintsZ&) = delete;
+ CVec_PhantomRouteHintsZ(CVec_PhantomRouteHintsZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_PhantomRouteHintsZ)); }
+ CVec_PhantomRouteHintsZ(LDKCVec_PhantomRouteHintsZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_PhantomRouteHintsZ)); }
+ operator LDKCVec_PhantomRouteHintsZ() && { LDKCVec_PhantomRouteHintsZ res = self; memset(&self, 0, sizeof(LDKCVec_PhantomRouteHintsZ)); return res; }
+ ~CVec_PhantomRouteHintsZ() { CVec_PhantomRouteHintsZ_free(self); }
+ CVec_PhantomRouteHintsZ& operator=(CVec_PhantomRouteHintsZ&& o) { CVec_PhantomRouteHintsZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_PhantomRouteHintsZ)); return *this; }
+ LDKCVec_PhantomRouteHintsZ* operator &() { return &self; }
+ LDKCVec_PhantomRouteHintsZ* operator ->() { return &self; }
+ const LDKCVec_PhantomRouteHintsZ* operator &() const { return &self; }
+ const LDKCVec_PhantomRouteHintsZ* operator ->() const { return &self; }
};
class COption_MonitorEventZ {
private:
const LDKCVec_TxOutZ* operator &() const { return &self; }
const LDKCVec_TxOutZ* operator ->() const { return &self; }
};
-class CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
-private:
- LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ self;
-public:
- CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ(const CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ&) = delete;
- CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ(CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ)); }
- CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ)); }
- operator LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ() && { LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ)); return res; }
- ~CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ() { CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(self); }
- CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ& operator=(CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ&& o) { CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ)); return *this; }
- LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* operator &() { return &self; }
- LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* operator ->() { return &self; }
- const LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* operator &() const { return &self; }
- const LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* operator ->() const { return &self; }
-};
class CResult_ChannelUpdateInfoDecodeErrorZ {
private:
LDKCResult_ChannelUpdateInfoDecodeErrorZ self;
const LDKCResult_ChannelUpdateInfoDecodeErrorZ* operator &() const { return &self; }
const LDKCResult_ChannelUpdateInfoDecodeErrorZ* operator ->() const { return &self; }
};
+class CVec_C2Tuple_OutPointCVec_MonitorEventZZZ {
+private:
+ LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ self;
+public:
+ CVec_C2Tuple_OutPointCVec_MonitorEventZZZ(const CVec_C2Tuple_OutPointCVec_MonitorEventZZZ&) = delete;
+ CVec_C2Tuple_OutPointCVec_MonitorEventZZZ(CVec_C2Tuple_OutPointCVec_MonitorEventZZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C2Tuple_OutPointCVec_MonitorEventZZZ)); }
+ CVec_C2Tuple_OutPointCVec_MonitorEventZZZ(LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ)); }
+ operator LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ() && { LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ res = self; memset(&self, 0, sizeof(LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ)); return res; }
+ ~CVec_C2Tuple_OutPointCVec_MonitorEventZZZ() { CVec_C2Tuple_OutPointCVec_MonitorEventZZZ_free(self); }
+ CVec_C2Tuple_OutPointCVec_MonitorEventZZZ& operator=(CVec_C2Tuple_OutPointCVec_MonitorEventZZZ&& o) { CVec_C2Tuple_OutPointCVec_MonitorEventZZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_C2Tuple_OutPointCVec_MonitorEventZZZ)); return *this; }
+ LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ* operator &() { return &self; }
+ LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ* operator ->() { return &self; }
+ const LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ* operator &() const { return &self; }
+ const LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ* operator ->() const { return &self; }
+};
+class CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
+private:
+ LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ self;
+public:
+ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ(const CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ&) = delete;
+ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ(CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ)); }
+ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ)); }
+ operator LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ() && { LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ)); return res; }
+ ~CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ() { CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(self); }
+ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ& operator=(CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ&& o) { CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ)); return *this; }
+ LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* operator &() { return &self; }
+ LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* operator ->() { return &self; }
+ const LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* operator &() const { return &self; }
+ const LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* operator ->() const { return &self; }
+};
class CVec_UpdateFailHTLCZ {
private:
LDKCVec_UpdateFailHTLCZ self;
const LDKCVec_UpdateFailHTLCZ* operator &() const { return &self; }
const LDKCVec_UpdateFailHTLCZ* operator ->() const { return &self; }
};
-class CResult_FundingLockedDecodeErrorZ {
-private:
- LDKCResult_FundingLockedDecodeErrorZ self;
-public:
- CResult_FundingLockedDecodeErrorZ(const CResult_FundingLockedDecodeErrorZ&) = delete;
- CResult_FundingLockedDecodeErrorZ(CResult_FundingLockedDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_FundingLockedDecodeErrorZ)); }
- CResult_FundingLockedDecodeErrorZ(LDKCResult_FundingLockedDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_FundingLockedDecodeErrorZ)); }
- operator LDKCResult_FundingLockedDecodeErrorZ() && { LDKCResult_FundingLockedDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_FundingLockedDecodeErrorZ)); return res; }
- ~CResult_FundingLockedDecodeErrorZ() { CResult_FundingLockedDecodeErrorZ_free(self); }
- CResult_FundingLockedDecodeErrorZ& operator=(CResult_FundingLockedDecodeErrorZ&& o) { CResult_FundingLockedDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_FundingLockedDecodeErrorZ)); return *this; }
- LDKCResult_FundingLockedDecodeErrorZ* operator &() { return &self; }
- LDKCResult_FundingLockedDecodeErrorZ* operator ->() { return &self; }
- const LDKCResult_FundingLockedDecodeErrorZ* operator &() const { return &self; }
- const LDKCResult_FundingLockedDecodeErrorZ* operator ->() const { return &self; }
-};
class CResult_ReplyShortChannelIdsEndDecodeErrorZ {
private:
LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ self;
const LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* operator ->() const { return &self; }
};
-inline LDK::CResult_NoneErrorZ Persister::persist_manager(const struct LDKChannelManager *NONNULL_PTR channel_manager) {
- LDK::CResult_NoneErrorZ ret = (self.persist_manager)(self.this_arg, channel_manager);
- return ret;
-}
-inline LDK::CResult_NoneErrorZ Persister::persist_graph(const struct LDKNetworkGraph *NONNULL_PTR network_graph) {
- LDK::CResult_NoneErrorZ ret = (self.persist_graph)(self.this_arg, network_graph);
- return ret;
-}
inline void BroadcasterInterface::broadcast_transaction(struct LDKTransaction tx) {
(self.broadcast_transaction)(self.this_arg, tx);
}
uint32_t ret = (self.get_est_sat_per_1000_weight)(self.this_arg, confirmation_target);
return ret;
}
+inline LDK::CVec_MessageSendEventZ MessageSendEventsProvider::get_and_clear_pending_msg_events() {
+ LDK::CVec_MessageSendEventZ ret = (self.get_and_clear_pending_msg_events)(self.this_arg);
+ return ret;
+}
+inline void EventsProvider::process_pending_events(struct LDKEventHandler handler) {
+ (self.process_pending_events)(self.this_arg, handler);
+}
+inline void EventHandler::handle_event(const struct LDKEvent *NONNULL_PTR event) {
+ (self.handle_event)(self.this_arg, event);
+}
inline LDK::CResult_TxOutAccessErrorZ Access::get_utxo(const uint8_t (*genesis_hash)[32], uint64_t short_channel_id) {
LDK::CResult_TxOutAccessErrorZ ret = (self.get_utxo)(self.this_arg, genesis_hash, short_channel_id);
return ret;
}
+inline void Listen::filtered_block_connected(const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
+ (self.filtered_block_connected)(self.this_arg, header, txdata, height);
+}
inline void Listen::block_connected(struct LDKu8slice block, uint32_t height) {
(self.block_connected)(self.this_arg, block, height);
}
LDK::CResult_NoneChannelMonitorUpdateErrZ ret = (self.update_channel)(self.this_arg, funding_txo, update);
return ret;
}
-inline LDK::CVec_MonitorEventZ Watch::release_pending_monitor_events() {
- LDK::CVec_MonitorEventZ ret = (self.release_pending_monitor_events)(self.this_arg);
+inline LDK::CVec_C2Tuple_OutPointCVec_MonitorEventZZZ Watch::release_pending_monitor_events() {
+ LDK::CVec_C2Tuple_OutPointCVec_MonitorEventZZZ ret = (self.release_pending_monitor_events)(self.this_arg);
return ret;
}
inline void Filter::register_tx(const uint8_t (*txid)[32], struct LDKu8slice script_pubkey) {
LDK::COption_C2Tuple_usizeTransactionZZ ret = (self.register_output)(self.this_arg, output);
return ret;
}
-inline LDK::CVec_MessageSendEventZ MessageSendEventsProvider::get_and_clear_pending_msg_events() {
- LDK::CVec_MessageSendEventZ ret = (self.get_and_clear_pending_msg_events)(self.this_arg);
- return ret;
-}
-inline void EventsProvider::process_pending_events(struct LDKEventHandler handler) {
- (self.process_pending_events)(self.this_arg, handler);
-}
-inline void EventHandler::handle_event(const struct LDKEvent *NONNULL_PTR event) {
- (self.handle_event)(self.this_arg, event);
-}
-inline uint64_t Score::channel_penalty_msat(uint64_t short_channel_id, uint64_t send_amt_msat, uint64_t capacity_msat, const struct LDKNodeId *NONNULL_PTR source, const struct LDKNodeId *NONNULL_PTR target) {
- uint64_t ret = (self.channel_penalty_msat)(self.this_arg, short_channel_id, send_amt_msat, capacity_msat, source, target);
+inline uint64_t Score::channel_penalty_msat(uint64_t short_channel_id, const struct LDKNodeId *NONNULL_PTR source, const struct LDKNodeId *NONNULL_PTR target, struct LDKChannelUsage usage) {
+ uint64_t ret = (self.channel_penalty_msat)(self.this_arg, short_channel_id, source, target, usage);
return ret;
}
inline void Score::payment_path_failed(struct LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
uint64_t ret = (self.hash)(self.this_arg);
return ret;
}
+inline LDK::CResult_NoneErrorZ Persister::persist_manager(const struct LDKChannelManager *NONNULL_PTR channel_manager) {
+ LDK::CResult_NoneErrorZ ret = (self.persist_manager)(self.this_arg, channel_manager);
+ return ret;
+}
+inline LDK::CResult_NoneErrorZ Persister::persist_graph(const struct LDKNetworkGraph *NONNULL_PTR network_graph) {
+ LDK::CResult_NoneErrorZ ret = (self.persist_graph)(self.this_arg, network_graph);
+ return ret;
+}
+inline LDK::CResult_NoneErrorZ Persister::persist_scorer(const struct LDKMultiThreadedLockableScore *NONNULL_PTR scorer) {
+ LDK::CResult_NoneErrorZ ret = (self.persist_scorer)(self.this_arg, scorer);
+ return ret;
+}
inline void ChannelMessageHandler::handle_open_channel(struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKOpenChannel *NONNULL_PTR msg) {
(self.handle_open_channel)(self.this_arg, their_node_id, their_features, msg);
}
inline void ChannelMessageHandler::handle_funding_signed(struct LDKPublicKey their_node_id, const struct LDKFundingSigned *NONNULL_PTR msg) {
(self.handle_funding_signed)(self.this_arg, their_node_id, msg);
}
-inline void ChannelMessageHandler::handle_funding_locked(struct LDKPublicKey their_node_id, const struct LDKFundingLocked *NONNULL_PTR msg) {
- (self.handle_funding_locked)(self.this_arg, their_node_id, msg);
+inline void ChannelMessageHandler::handle_channel_ready(struct LDKPublicKey their_node_id, const struct LDKChannelReady *NONNULL_PTR msg) {
+ (self.handle_channel_ready)(self.this_arg, their_node_id, msg);
}
inline void ChannelMessageHandler::handle_shutdown(struct LDKPublicKey their_node_id, const struct LDKInitFeatures *NONNULL_PTR their_features, const struct LDKShutdown *NONNULL_PTR msg) {
(self.handle_shutdown)(self.this_arg, their_node_id, their_features, msg);
/// but with all dynamically-allocated buffers duplicated in new buffers.
pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { Clone::clone(&orig) }
#[repr(C)]
-/// The contents of CResult_TxOutAccessErrorZ
-pub union CResult_TxOutAccessErrorZPtr {
- /// 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::TxOut,
- /// A pointer to the contents in the error state.
- /// Reading from this pointer when `result_ok` is set is undefined.
- pub err: *mut crate::lightning::chain::AccessError,
-}
-#[repr(C)]
-/// A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
-/// containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
-/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult_TxOutAccessErrorZ {
- /// The contents of this CResult_TxOutAccessErrorZ, accessible via either
- /// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_TxOutAccessErrorZPtr,
- /// Whether this CResult_TxOutAccessErrorZ represents a success state.
- pub result_ok: bool,
-}
-#[no_mangle]
-/// Creates a new CResult_TxOutAccessErrorZ in the success state.
-pub extern "C" fn CResult_TxOutAccessErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutAccessErrorZ {
- CResult_TxOutAccessErrorZ {
- contents: CResult_TxOutAccessErrorZPtr {
- result: Box::into_raw(Box::new(o)),
- },
- result_ok: true,
- }
-}
-#[no_mangle]
-/// Creates a new CResult_TxOutAccessErrorZ in the error state.
-pub extern "C" fn CResult_TxOutAccessErrorZ_err(e: crate::lightning::chain::AccessError) -> CResult_TxOutAccessErrorZ {
- CResult_TxOutAccessErrorZ {
- contents: CResult_TxOutAccessErrorZPtr {
- 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_TxOutAccessErrorZ_is_ok(o: &CResult_TxOutAccessErrorZ) -> bool {
- o.result_ok
-}
-#[no_mangle]
-/// Frees any resources used by the CResult_TxOutAccessErrorZ.
-pub extern "C" fn CResult_TxOutAccessErrorZ_free(_res: CResult_TxOutAccessErrorZ) { }
-impl Drop for CResult_TxOutAccessErrorZ {
- fn drop(&mut self) {
- if self.result_ok {
- if unsafe { !(self.contents.result as *mut ()).is_null() } {
- let _ = unsafe { Box::from_raw(self.contents.result) };
- }
- } else {
- if unsafe { !(self.contents.err as *mut ()).is_null() } {
- let _ = unsafe { Box::from_raw(self.contents.err) };
- }
- }
- }
-}
-impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>> for CResult_TxOutAccessErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>) -> Self {
- let contents = if o.result_ok {
- let result = unsafe { o.contents.result };
- unsafe { o.contents.result = core::ptr::null_mut() };
- CResult_TxOutAccessErrorZPtr { result }
- } else {
- let err = unsafe { o.contents.err };
- unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_TxOutAccessErrorZPtr { err }
- };
- Self {
- contents,
- result_ok: o.result_ok,
- }
- }
-}
-impl Clone for CResult_TxOutAccessErrorZ {
- fn clone(&self) -> Self {
- if self.result_ok {
- Self { result_ok: true, contents: CResult_TxOutAccessErrorZPtr {
- result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
- } }
- } else {
- Self { result_ok: false, contents: CResult_TxOutAccessErrorZPtr {
- err: Box::into_raw(Box::new(<crate::lightning::chain::AccessError>::clone(unsafe { &*self.contents.err })))
- } }
- }
- }
-}
-#[no_mangle]
-/// Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
-/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_TxOutAccessErrorZ_clone(orig: &CResult_TxOutAccessErrorZ) -> CResult_TxOutAccessErrorZ { Clone::clone(&orig) }
-#[repr(C)]
-/// A tuple of 2 elements. See the individual fields for the types contained.
-pub struct C2Tuple_usizeTransactionZ {
- /// The element at position 0
- pub a: usize,
- /// The element at position 1
- pub b: crate::c_types::Transaction,
-}
-impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
- fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
- Self {
- a: tup.0,
- b: tup.1,
- }
- }
-}
-impl C2Tuple_usizeTransactionZ {
- #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
- (self.a, self.b)
- }
-}
-impl Clone for C2Tuple_usizeTransactionZ {
- fn clone(&self) -> Self {
- Self {
- a: Clone::clone(&self.a),
- b: Clone::clone(&self.b),
- }
- }
-}
-#[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 C2Tuple_usizeTransactionZ_clone(orig: &C2Tuple_usizeTransactionZ) -> C2Tuple_usizeTransactionZ { Clone::clone(&orig) }
-/// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
-#[no_mangle]
-pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
- C2Tuple_usizeTransactionZ { a, b, }
-}
-
-#[no_mangle]
-/// Frees any resources used by the C2Tuple_usizeTransactionZ.
-pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
-#[repr(C)]
-/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
-/// This corresponds to std::vector in C++
-pub struct CVec_C2Tuple_usizeTransactionZZ {
- /// 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::C2Tuple_usizeTransactionZ,
- /// The number of elements pointed to by `data`.
- pub datalen: usize
-}
-impl CVec_C2Tuple_usizeTransactionZZ {
- #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
- 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::C2Tuple_usizeTransactionZ] {
- unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
- }
-}
-impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
- fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> 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_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
-impl Drop for CVec_C2Tuple_usizeTransactionZZ {
- fn drop(&mut self) {
- if self.datalen == 0 { return; }
- unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
- }
-}
-impl Clone for CVec_C2Tuple_usizeTransactionZZ {
- 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)]
-/// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
+/// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
/// This corresponds to std::vector in C++
-pub struct CVec_TxidZ {
+pub struct CVec_PublicKeyZ {
/// 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::ThirtyTwoBytes,
+ pub data: *mut crate::c_types::PublicKey,
/// The number of elements pointed to by `data`.
pub datalen: usize
}
-impl CVec_TxidZ {
- #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
+impl CVec_PublicKeyZ {
+ #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
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::ThirtyTwoBytes] {
+ #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
}
}
-impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_TxidZ {
- fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
+impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
+ fn from(v: Vec<crate::c_types::PublicKey>) -> 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_TxidZ_free(_res: CVec_TxidZ) { }
-impl Drop for CVec_TxidZ {
+pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
+impl Drop for CVec_PublicKeyZ {
fn drop(&mut self) {
if self.datalen == 0 { return; }
unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
}
}
-impl Clone for CVec_TxidZ {
+impl Clone for CVec_PublicKeyZ {
fn clone(&self) -> Self {
let mut res = Vec::new();
if self.datalen == 0 { return Self::from(res); }
}
}
#[repr(C)]
-/// The contents of CResult_NoneChannelMonitorUpdateErrZ
-pub union CResult_NoneChannelMonitorUpdateErrZPtr {
- /// Note that this value is always NULL, as there are no contents in the OK variant
- pub result: *mut core::ffi::c_void,
+/// The contents of CResult_PaymentPurposeDecodeErrorZ
+pub union CResult_PaymentPurposeDecodeErrorZPtr {
+ /// 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::util::events::PaymentPurpose,
/// A pointer to the contents in the error state.
/// Reading from this pointer when `result_ok` is set is undefined.
- pub err: *mut crate::lightning::chain::ChannelMonitorUpdateErr,
+ pub err: *mut crate::lightning::ln::msgs::DecodeError,
}
#[repr(C)]
-/// A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
-/// containing a () on success and a crate::lightning::chain::ChannelMonitorUpdateErr on failure.
+/// A CResult_PaymentPurposeDecodeErrorZ represents the result of a fallible operation,
+/// containing a crate::lightning::util::events::PaymentPurpose 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_NoneChannelMonitorUpdateErrZ {
- /// The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
+pub struct CResult_PaymentPurposeDecodeErrorZ {
+ /// The contents of this CResult_PaymentPurposeDecodeErrorZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_NoneChannelMonitorUpdateErrZPtr,
- /// Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
+ pub contents: CResult_PaymentPurposeDecodeErrorZPtr,
+ /// Whether this CResult_PaymentPurposeDecodeErrorZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
-pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_ok() -> CResult_NoneChannelMonitorUpdateErrZ {
- CResult_NoneChannelMonitorUpdateErrZ {
- contents: CResult_NoneChannelMonitorUpdateErrZPtr {
- result: core::ptr::null_mut(),
+/// Creates a new CResult_PaymentPurposeDecodeErrorZ in the success state.
+pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_ok(o: crate::lightning::util::events::PaymentPurpose) -> CResult_PaymentPurposeDecodeErrorZ {
+ CResult_PaymentPurposeDecodeErrorZ {
+ contents: CResult_PaymentPurposeDecodeErrorZPtr {
+ result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
-pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_err(e: crate::lightning::chain::ChannelMonitorUpdateErr) -> CResult_NoneChannelMonitorUpdateErrZ {
- CResult_NoneChannelMonitorUpdateErrZ {
- contents: CResult_NoneChannelMonitorUpdateErrZPtr {
+/// Creates a new CResult_PaymentPurposeDecodeErrorZ in the error state.
+pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentPurposeDecodeErrorZ {
+ CResult_PaymentPurposeDecodeErrorZ {
+ contents: CResult_PaymentPurposeDecodeErrorZPtr {
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_NoneChannelMonitorUpdateErrZ_is_ok(o: &CResult_NoneChannelMonitorUpdateErrZ) -> bool {
+pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_is_ok(o: &CResult_PaymentPurposeDecodeErrorZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
-pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_free(_res: CResult_NoneChannelMonitorUpdateErrZ) { }
-impl Drop for CResult_NoneChannelMonitorUpdateErrZ {
+/// Frees any resources used by the CResult_PaymentPurposeDecodeErrorZ.
+pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_free(_res: CResult_PaymentPurposeDecodeErrorZ) { }
+impl Drop for CResult_PaymentPurposeDecodeErrorZ {
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::chain::ChannelMonitorUpdateErr>> for CResult_NoneChannelMonitorUpdateErrZ {
- fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::lightning::util::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentPurposeDecodeErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>) -> Self {
let contents = if o.result_ok {
- let _ = unsafe { Box::from_raw(o.contents.result) };
- o.contents.result = core::ptr::null_mut();
- CResult_NoneChannelMonitorUpdateErrZPtr { result: core::ptr::null_mut() }
+ let result = unsafe { o.contents.result };
+ unsafe { o.contents.result = core::ptr::null_mut() };
+ CResult_PaymentPurposeDecodeErrorZPtr { result }
} else {
let err = unsafe { o.contents.err };
unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_NoneChannelMonitorUpdateErrZPtr { err }
+ CResult_PaymentPurposeDecodeErrorZPtr { err }
};
Self {
contents,
}
}
}
-impl Clone for CResult_NoneChannelMonitorUpdateErrZ {
+impl Clone for CResult_PaymentPurposeDecodeErrorZ {
fn clone(&self) -> Self {
if self.result_ok {
- Self { result_ok: true, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
- result: core::ptr::null_mut()
+ Self { result_ok: true, contents: CResult_PaymentPurposeDecodeErrorZPtr {
+ result: Box::into_raw(Box::new(<crate::lightning::util::events::PaymentPurpose>::clone(unsafe { &*self.contents.result })))
} }
} else {
- Self { result_ok: false, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
- err: Box::into_raw(Box::new(<crate::lightning::chain::ChannelMonitorUpdateErr>::clone(unsafe { &*self.contents.err })))
+ Self { result_ok: false, contents: CResult_PaymentPurposeDecodeErrorZPtr {
+ err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
} }
}
}
}
#[no_mangle]
-/// Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
+/// Creates a new CResult_PaymentPurposeDecodeErrorZ which has the same data as `orig`
/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_clone(orig: &CResult_NoneChannelMonitorUpdateErrZ) -> CResult_NoneChannelMonitorUpdateErrZ { Clone::clone(&orig) }
-#[repr(C)]
-/// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
-/// This corresponds to std::vector in C++
-pub struct CVec_MonitorEventZ {
- /// 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::chain::channelmonitor::MonitorEvent,
- /// The number of elements pointed to by `data`.
- pub datalen: usize
-}
-impl CVec_MonitorEventZ {
- #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
- 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::chain::channelmonitor::MonitorEvent] {
- unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
- }
-}
-impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
- fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> 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_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
-impl Drop for CVec_MonitorEventZ {
- fn drop(&mut self) {
- if self.datalen == 0 { return; }
- unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
- }
-}
-impl Clone for CVec_MonitorEventZ {
- 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::c_types::derived::C2Tuple_usizeTransactionZ or not
-pub enum COption_C2Tuple_usizeTransactionZZ {
- /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
- Some(crate::c_types::derived::C2Tuple_usizeTransactionZ),
- /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
- None
-}
-impl COption_C2Tuple_usizeTransactionZZ {
- #[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::derived::C2Tuple_usizeTransactionZ {
- if let Self::Some(v) = self { v } else { unreachable!() }
- }
-}
-#[no_mangle]
-/// Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
-pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_some(o: crate::c_types::derived::C2Tuple_usizeTransactionZ) -> COption_C2Tuple_usizeTransactionZZ {
- COption_C2Tuple_usizeTransactionZZ::Some(o)
-}
-#[no_mangle]
-/// Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
-pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_none() -> COption_C2Tuple_usizeTransactionZZ {
- COption_C2Tuple_usizeTransactionZZ::None
-}
-#[no_mangle]
-/// Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
-pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_free(_res: COption_C2Tuple_usizeTransactionZZ) { }
-#[no_mangle]
-/// Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
-/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_clone(orig: &COption_C2Tuple_usizeTransactionZZ) -> COption_C2Tuple_usizeTransactionZZ { Clone::clone(&orig) }
+pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_clone(orig: &CResult_PaymentPurposeDecodeErrorZ) -> CResult_PaymentPurposeDecodeErrorZ { Clone::clone(&orig) }
#[repr(C)]
#[derive(Clone)]
/// An enum which can either contain a crate::lightning::util::events::ClosureReason or not
pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig: &CResult_COption_ClosureReasonZDecodeErrorZ) -> CResult_COption_ClosureReasonZDecodeErrorZ { Clone::clone(&orig) }
#[repr(C)]
#[derive(Clone)]
-/// An enum which can either contain a crate::lightning::routing::network_graph::NetworkUpdate or not
+/// An enum which can either contain a crate::lightning::routing::gossip::NetworkUpdate or not
pub enum COption_NetworkUpdateZ {
- /// When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::network_graph::NetworkUpdate
- Some(crate::lightning::routing::network_graph::NetworkUpdate),
+ /// When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::gossip::NetworkUpdate
+ Some(crate::lightning::routing::gossip::NetworkUpdate),
/// When we're in this state, this COption_NetworkUpdateZ contains nothing
None
}
#[allow(unused)] pub(crate) fn is_none(&self) -> bool {
!self.is_some()
}
- #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::network_graph::NetworkUpdate {
+ #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::gossip::NetworkUpdate {
if let Self::Some(v) = self { v } else { unreachable!() }
}
}
#[no_mangle]
-/// Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::network_graph::NetworkUpdate
-pub extern "C" fn COption_NetworkUpdateZ_some(o: crate::lightning::routing::network_graph::NetworkUpdate) -> COption_NetworkUpdateZ {
+/// Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::gossip::NetworkUpdate
+pub extern "C" fn COption_NetworkUpdateZ_some(o: crate::lightning::routing::gossip::NetworkUpdate) -> COption_NetworkUpdateZ {
COption_NetworkUpdateZ::Some(o)
}
#[no_mangle]
COption_NetworkUpdateZ::None
}
#[no_mangle]
-/// Frees any resources associated with the crate::lightning::routing::network_graph::NetworkUpdate, if we are in the Some state
+/// Frees any resources associated with the crate::lightning::routing::gossip::NetworkUpdate, if we are in the Some state
pub extern "C" fn COption_NetworkUpdateZ_free(_res: COption_NetworkUpdateZ) { }
#[no_mangle]
/// Creates a new COption_NetworkUpdateZ which has the same data as `orig`
}
}
#[repr(C)]
-/// The contents of CResult_FixedPenaltyScorerDecodeErrorZ
-pub union CResult_FixedPenaltyScorerDecodeErrorZPtr {
+/// The contents of CResult_TxOutAccessErrorZ
+pub union CResult_TxOutAccessErrorZPtr {
/// A pointer to the contents in the success state.
/// Reading from this pointer when `result_ok` is not set is undefined.
- pub result: *mut crate::lightning::routing::scoring::FixedPenaltyScorer,
+ pub result: *mut crate::c_types::TxOut,
/// 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,
+ pub err: *mut crate::lightning::chain::AccessError,
}
#[repr(C)]
-/// A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
-/// containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
+/// A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
+/// containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult_FixedPenaltyScorerDecodeErrorZ {
- /// The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
+pub struct CResult_TxOutAccessErrorZ {
+ /// The contents of this CResult_TxOutAccessErrorZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_FixedPenaltyScorerDecodeErrorZPtr,
- /// Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
+ pub contents: CResult_TxOutAccessErrorZPtr,
+ /// Whether this CResult_TxOutAccessErrorZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
-pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::FixedPenaltyScorer) -> CResult_FixedPenaltyScorerDecodeErrorZ {
- CResult_FixedPenaltyScorerDecodeErrorZ {
- contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
+/// Creates a new CResult_TxOutAccessErrorZ in the success state.
+pub extern "C" fn CResult_TxOutAccessErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutAccessErrorZ {
+ CResult_TxOutAccessErrorZ {
+ contents: CResult_TxOutAccessErrorZPtr {
result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
-pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FixedPenaltyScorerDecodeErrorZ {
- CResult_FixedPenaltyScorerDecodeErrorZ {
- contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
+/// Creates a new CResult_TxOutAccessErrorZ in the error state.
+pub extern "C" fn CResult_TxOutAccessErrorZ_err(e: crate::lightning::chain::AccessError) -> CResult_TxOutAccessErrorZ {
+ CResult_TxOutAccessErrorZ {
+ contents: CResult_TxOutAccessErrorZPtr {
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_FixedPenaltyScorerDecodeErrorZ_is_ok(o: &CResult_FixedPenaltyScorerDecodeErrorZ) -> bool {
+pub extern "C" fn CResult_TxOutAccessErrorZ_is_ok(o: &CResult_TxOutAccessErrorZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
-pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_free(_res: CResult_FixedPenaltyScorerDecodeErrorZ) { }
-impl Drop for CResult_FixedPenaltyScorerDecodeErrorZ {
+/// Frees any resources used by the CResult_TxOutAccessErrorZ.
+pub extern "C" fn CResult_TxOutAccessErrorZ_free(_res: CResult_TxOutAccessErrorZ) { }
+impl Drop for CResult_TxOutAccessErrorZ {
fn drop(&mut self) {
if self.result_ok {
if unsafe { !(self.contents.result as *mut ()).is_null() } {
}
}
}
-impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_FixedPenaltyScorerDecodeErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>> for CResult_TxOutAccessErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>) -> Self {
let contents = if o.result_ok {
let result = unsafe { o.contents.result };
unsafe { o.contents.result = core::ptr::null_mut() };
- CResult_FixedPenaltyScorerDecodeErrorZPtr { result }
+ CResult_TxOutAccessErrorZPtr { result }
} else {
let err = unsafe { o.contents.err };
unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_FixedPenaltyScorerDecodeErrorZPtr { err }
+ CResult_TxOutAccessErrorZPtr { err }
};
Self {
contents,
}
}
}
-impl Clone for CResult_FixedPenaltyScorerDecodeErrorZ {
+impl Clone for CResult_TxOutAccessErrorZ {
fn clone(&self) -> Self {
if self.result_ok {
- Self { result_ok: true, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
- result: Box::into_raw(Box::new(<crate::lightning::routing::scoring::FixedPenaltyScorer>::clone(unsafe { &*self.contents.result })))
+ Self { result_ok: true, contents: CResult_TxOutAccessErrorZPtr {
+ result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
} }
} else {
- Self { result_ok: false, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
- err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
+ Self { result_ok: false, contents: CResult_TxOutAccessErrorZPtr {
+ err: Box::into_raw(Box::new(<crate::lightning::chain::AccessError>::clone(unsafe { &*self.contents.err })))
} }
}
}
}
#[no_mangle]
-/// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig`
+/// Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig: &CResult_FixedPenaltyScorerDecodeErrorZ) -> CResult_FixedPenaltyScorerDecodeErrorZ { Clone::clone(&orig) }
-#[repr(C)]
-/// The contents of CResult_ScoringParametersDecodeErrorZ
-pub union CResult_ScoringParametersDecodeErrorZPtr {
- /// A pointer to the contents in the success state.
- /// Reading from this pointer when `result_ok` is not set is undefined.
- pub result: *mut crate::lightning::routing::scoring::ScoringParameters,
- /// A pointer to the contents in the error state.
- /// Reading from this pointer when `result_ok` is set is undefined.
- pub err: *mut crate::lightning::ln::msgs::DecodeError,
-}
+pub extern "C" fn CResult_TxOutAccessErrorZ_clone(orig: &CResult_TxOutAccessErrorZ) -> CResult_TxOutAccessErrorZ { Clone::clone(&orig) }
#[repr(C)]
-/// A CResult_ScoringParametersDecodeErrorZ represents the result of a fallible operation,
-/// containing a crate::lightning::routing::scoring::ScoringParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
-/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult_ScoringParametersDecodeErrorZ {
- /// The contents of this CResult_ScoringParametersDecodeErrorZ, accessible via either
- /// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_ScoringParametersDecodeErrorZPtr,
- /// Whether this CResult_ScoringParametersDecodeErrorZ represents a success state.
- pub result_ok: bool,
-}
-#[no_mangle]
-/// Creates a new CResult_ScoringParametersDecodeErrorZ in the success state.
-pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ScoringParameters) -> CResult_ScoringParametersDecodeErrorZ {
- CResult_ScoringParametersDecodeErrorZ {
- contents: CResult_ScoringParametersDecodeErrorZPtr {
- result: Box::into_raw(Box::new(o)),
- },
- result_ok: true,
- }
-}
-#[no_mangle]
-/// Creates a new CResult_ScoringParametersDecodeErrorZ in the error state.
-pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ScoringParametersDecodeErrorZ {
- CResult_ScoringParametersDecodeErrorZ {
- contents: CResult_ScoringParametersDecodeErrorZPtr {
- err: Box::into_raw(Box::new(e)),
- },
- result_ok: false,
- }
-}
-/// Checks if the given object is currently in the success state
-#[no_mangle]
-pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_is_ok(o: &CResult_ScoringParametersDecodeErrorZ) -> bool {
- o.result_ok
+/// A tuple of 2 elements. See the individual fields for the types contained.
+pub struct C2Tuple_usizeTransactionZ {
+ /// The element at position 0
+ pub a: usize,
+ /// The element at position 1
+ pub b: crate::c_types::Transaction,
}
-#[no_mangle]
-/// Frees any resources used by the CResult_ScoringParametersDecodeErrorZ.
-pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_free(_res: CResult_ScoringParametersDecodeErrorZ) { }
-impl Drop for CResult_ScoringParametersDecodeErrorZ {
- 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<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
+ fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
+ Self {
+ a: tup.0,
+ b: tup.1,
}
}
}
-impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ScoringParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ScoringParametersDecodeErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ScoringParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
- let contents = if o.result_ok {
- let result = unsafe { o.contents.result };
- unsafe { o.contents.result = core::ptr::null_mut() };
- CResult_ScoringParametersDecodeErrorZPtr { result }
- } else {
- let err = unsafe { o.contents.err };
- unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_ScoringParametersDecodeErrorZPtr { err }
- };
- Self {
- contents,
- result_ok: o.result_ok,
- }
+impl C2Tuple_usizeTransactionZ {
+ #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
+ (self.a, self.b)
}
}
-impl Clone for CResult_ScoringParametersDecodeErrorZ {
+impl Clone for C2Tuple_usizeTransactionZ {
fn clone(&self) -> Self {
- if self.result_ok {
- Self { result_ok: true, contents: CResult_ScoringParametersDecodeErrorZPtr {
- result: Box::into_raw(Box::new(<crate::lightning::routing::scoring::ScoringParameters>::clone(unsafe { &*self.contents.result })))
- } }
- } else {
- Self { result_ok: false, contents: CResult_ScoringParametersDecodeErrorZPtr {
- err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
- } }
+ Self {
+ a: Clone::clone(&self.a),
+ b: Clone::clone(&self.b),
}
}
}
#[no_mangle]
-/// Creates a new CResult_ScoringParametersDecodeErrorZ which has the same data as `orig`
+/// 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_ScoringParametersDecodeErrorZ_clone(orig: &CResult_ScoringParametersDecodeErrorZ) -> CResult_ScoringParametersDecodeErrorZ { Clone::clone(&orig) }
-#[repr(C)]
-/// The contents of CResult_ScorerDecodeErrorZ
-pub union CResult_ScorerDecodeErrorZPtr {
- /// A pointer to the contents in the success state.
- /// Reading from this pointer when `result_ok` is not set is undefined.
- pub result: *mut crate::lightning::routing::scoring::Scorer,
- /// A pointer to the contents in the error state.
- /// Reading from this pointer when `result_ok` is set is undefined.
- pub err: *mut crate::lightning::ln::msgs::DecodeError,
-}
-#[repr(C)]
-/// A CResult_ScorerDecodeErrorZ represents the result of a fallible operation,
-/// containing a crate::lightning::routing::scoring::Scorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
-/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult_ScorerDecodeErrorZ {
- /// The contents of this CResult_ScorerDecodeErrorZ, accessible via either
- /// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_ScorerDecodeErrorZPtr,
- /// Whether this CResult_ScorerDecodeErrorZ represents a success state.
- pub result_ok: bool,
-}
+pub extern "C" fn C2Tuple_usizeTransactionZ_clone(orig: &C2Tuple_usizeTransactionZ) -> C2Tuple_usizeTransactionZ { Clone::clone(&orig) }
+/// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
#[no_mangle]
-/// Creates a new CResult_ScorerDecodeErrorZ in the success state.
-pub extern "C" fn CResult_ScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::Scorer) -> CResult_ScorerDecodeErrorZ {
- CResult_ScorerDecodeErrorZ {
- contents: CResult_ScorerDecodeErrorZPtr {
- result: Box::into_raw(Box::new(o)),
- },
- result_ok: true,
- }
+pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
+ C2Tuple_usizeTransactionZ { a, b, }
}
+
#[no_mangle]
-/// Creates a new CResult_ScorerDecodeErrorZ in the error state.
-pub extern "C" fn CResult_ScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ScorerDecodeErrorZ {
- CResult_ScorerDecodeErrorZ {
- contents: CResult_ScorerDecodeErrorZPtr {
- err: Box::into_raw(Box::new(e)),
- },
- result_ok: false,
- }
+/// Frees any resources used by the C2Tuple_usizeTransactionZ.
+pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
+#[repr(C)]
+/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
+/// This corresponds to std::vector in C++
+pub struct CVec_C2Tuple_usizeTransactionZZ {
+ /// 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::C2Tuple_usizeTransactionZ,
+ /// The number of elements pointed to by `data`.
+ pub datalen: usize
}
-/// Checks if the given object is currently in the success state
-#[no_mangle]
-pub extern "C" fn CResult_ScorerDecodeErrorZ_is_ok(o: &CResult_ScorerDecodeErrorZ) -> bool {
- o.result_ok
+impl CVec_C2Tuple_usizeTransactionZZ {
+ #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
+ 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::C2Tuple_usizeTransactionZ] {
+ unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
+ }
+}
+impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
+ fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> 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 any resources used by the CResult_ScorerDecodeErrorZ.
-pub extern "C" fn CResult_ScorerDecodeErrorZ_free(_res: CResult_ScorerDecodeErrorZ) { }
-impl Drop for CResult_ScorerDecodeErrorZ {
+/// Frees the buffer pointed to by `data` if `datalen` is non-0.
+pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
+impl Drop for CVec_C2Tuple_usizeTransactionZZ {
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) };
- }
- }
+ if self.datalen == 0 { return; }
+ unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
}
}
-impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::Scorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ScorerDecodeErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::Scorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
- let contents = if o.result_ok {
- let result = unsafe { o.contents.result };
- unsafe { o.contents.result = core::ptr::null_mut() };
- CResult_ScorerDecodeErrorZPtr { result }
- } else {
- let err = unsafe { o.contents.err };
- unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_ScorerDecodeErrorZPtr { err }
- };
- Self {
- contents,
- result_ok: o.result_ok,
- }
+impl Clone for CVec_C2Tuple_usizeTransactionZZ {
+ 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_ProbabilisticScorerDecodeErrorZ
-pub union CResult_ProbabilisticScorerDecodeErrorZPtr {
- /// A pointer to the contents in the success state.
- /// Reading from this pointer when `result_ok` is not set is undefined.
- pub result: *mut crate::lightning::routing::scoring::ProbabilisticScorer,
- /// 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_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation,
-/// containing a crate::lightning::routing::scoring::ProbabilisticScorer 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_ProbabilisticScorerDecodeErrorZ {
- /// The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either
- /// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_ProbabilisticScorerDecodeErrorZPtr,
- /// Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state.
- pub result_ok: bool,
+/// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
+/// This corresponds to std::vector in C++
+pub struct CVec_TxidZ {
+ /// 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::ThirtyTwoBytes,
+ /// The number of elements pointed to by `data`.
+ pub datalen: usize
}
-#[no_mangle]
-/// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state.
-pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ProbabilisticScorer) -> CResult_ProbabilisticScorerDecodeErrorZ {
- CResult_ProbabilisticScorerDecodeErrorZ {
- contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
- result: Box::into_raw(Box::new(o)),
- },
- result_ok: true,
+impl CVec_TxidZ {
+ #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
+ 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
}
-}
-#[no_mangle]
-/// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state.
-pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ProbabilisticScorerDecodeErrorZ {
- CResult_ProbabilisticScorerDecodeErrorZ {
- contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
- err: Box::into_raw(Box::new(e)),
- },
- result_ok: false,
+ #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
+ unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
}
}
-/// Checks if the given object is currently in the success state
-#[no_mangle]
-pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o: &CResult_ProbabilisticScorerDecodeErrorZ) -> bool {
- o.result_ok
+impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_TxidZ {
+ fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> 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 any resources used by the CResult_ProbabilisticScorerDecodeErrorZ.
-pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_free(_res: CResult_ProbabilisticScorerDecodeErrorZ) { }
-impl Drop for CResult_ProbabilisticScorerDecodeErrorZ {
+/// Frees the buffer pointed to by `data` if `datalen` is non-0.
+pub extern "C" fn CVec_TxidZ_free(_res: CVec_TxidZ) { }
+impl Drop for CVec_TxidZ {
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) };
- }
- }
+ if self.datalen == 0 { return; }
+ unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
}
}
-impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ProbabilisticScorerDecodeErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, 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_ProbabilisticScorerDecodeErrorZPtr { result }
- } else {
- let err = unsafe { o.contents.err };
- unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_ProbabilisticScorerDecodeErrorZPtr { err }
- };
- Self {
- contents,
- result_ok: o.result_ok,
- }
+impl Clone for CVec_TxidZ {
+ 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_InitFeaturesDecodeErrorZ
-pub union CResult_InitFeaturesDecodeErrorZPtr {
- /// A pointer to the contents in the success state.
- /// Reading from this pointer when `result_ok` is not set is undefined.
- pub result: *mut crate::lightning::ln::features::InitFeatures,
+/// The contents of CResult_NoneChannelMonitorUpdateErrZ
+pub union CResult_NoneChannelMonitorUpdateErrZPtr {
+ /// 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::ln::msgs::DecodeError,
+ pub err: *mut crate::lightning::chain::ChannelMonitorUpdateErr,
}
#[repr(C)]
-/// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
-/// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
+/// A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
+/// containing a () on success and a crate::lightning::chain::ChannelMonitorUpdateErr on failure.
/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult_InitFeaturesDecodeErrorZ {
- /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
+pub struct CResult_NoneChannelMonitorUpdateErrZ {
+ /// The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_InitFeaturesDecodeErrorZPtr,
- /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
+ pub contents: CResult_NoneChannelMonitorUpdateErrZPtr,
+ /// Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
-pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
- CResult_InitFeaturesDecodeErrorZ {
- contents: CResult_InitFeaturesDecodeErrorZPtr {
- result: Box::into_raw(Box::new(o)),
+/// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
+pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_ok() -> CResult_NoneChannelMonitorUpdateErrZ {
+ CResult_NoneChannelMonitorUpdateErrZ {
+ contents: CResult_NoneChannelMonitorUpdateErrZPtr {
+ result: core::ptr::null_mut(),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
-pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
- CResult_InitFeaturesDecodeErrorZ {
- contents: CResult_InitFeaturesDecodeErrorZPtr {
+/// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
+pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_err(e: crate::lightning::chain::ChannelMonitorUpdateErr) -> CResult_NoneChannelMonitorUpdateErrZ {
+ CResult_NoneChannelMonitorUpdateErrZ {
+ contents: CResult_NoneChannelMonitorUpdateErrZPtr {
err: Box::into_raw(Box::new(e)),
},
result_ok: false,
}
/// Checks if the given object is currently in the success state
#[no_mangle]
-pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_is_ok(o: &CResult_InitFeaturesDecodeErrorZ) -> bool {
+pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_is_ok(o: &CResult_NoneChannelMonitorUpdateErrZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
-pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
-impl Drop for CResult_InitFeaturesDecodeErrorZ {
+/// Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
+pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_free(_res: CResult_NoneChannelMonitorUpdateErrZ) { }
+impl Drop for CResult_NoneChannelMonitorUpdateErrZ {
fn drop(&mut self) {
if self.result_ok {
- if unsafe { !(self.contents.result as *mut ()).is_null() } {
- let _ = unsafe { Box::from_raw(self.contents.result) };
- }
} else {
if unsafe { !(self.contents.err as *mut ()).is_null() } {
let _ = unsafe { Box::from_raw(self.contents.err) };
}
}
}
-impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
+impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>> for CResult_NoneChannelMonitorUpdateErrZ {
+ fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>) -> Self {
let contents = if o.result_ok {
- let result = unsafe { o.contents.result };
- unsafe { o.contents.result = core::ptr::null_mut() };
- CResult_InitFeaturesDecodeErrorZPtr { result }
+ let _ = unsafe { Box::from_raw(o.contents.result) };
+ o.contents.result = core::ptr::null_mut();
+ CResult_NoneChannelMonitorUpdateErrZPtr { result: core::ptr::null_mut() }
} else {
let err = unsafe { o.contents.err };
unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_InitFeaturesDecodeErrorZPtr { err }
+ CResult_NoneChannelMonitorUpdateErrZPtr { err }
};
Self {
contents,
}
}
}
-#[repr(C)]
-/// The contents of CResult_ChannelFeaturesDecodeErrorZ
-pub union CResult_ChannelFeaturesDecodeErrorZPtr {
- /// A pointer to the contents in the success state.
- /// Reading from this pointer when `result_ok` is not set is undefined.
- pub result: *mut crate::lightning::ln::features::ChannelFeatures,
- /// A pointer to the contents in the error state.
- /// Reading from this pointer when `result_ok` is set is undefined.
- pub err: *mut crate::lightning::ln::msgs::DecodeError,
-}
-#[repr(C)]
-/// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
-/// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
-/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult_ChannelFeaturesDecodeErrorZ {
- /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
- /// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
- /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
- pub result_ok: bool,
-}
-#[no_mangle]
-/// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
-pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
- CResult_ChannelFeaturesDecodeErrorZ {
- contents: CResult_ChannelFeaturesDecodeErrorZPtr {
- result: Box::into_raw(Box::new(o)),
- },
- result_ok: true,
+impl Clone for CResult_NoneChannelMonitorUpdateErrZ {
+ fn clone(&self) -> Self {
+ if self.result_ok {
+ Self { result_ok: true, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
+ result: core::ptr::null_mut()
+ } }
+ } else {
+ Self { result_ok: false, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
+ err: Box::into_raw(Box::new(<crate::lightning::chain::ChannelMonitorUpdateErr>::clone(unsafe { &*self.contents.err })))
+ } }
+ }
}
}
#[no_mangle]
-/// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
-pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
- CResult_ChannelFeaturesDecodeErrorZ {
- contents: CResult_ChannelFeaturesDecodeErrorZPtr {
- err: Box::into_raw(Box::new(e)),
- },
- result_ok: false,
+/// Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
+/// but with all dynamically-allocated buffers duplicated in new buffers.
+pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_clone(orig: &CResult_NoneChannelMonitorUpdateErrZ) -> CResult_NoneChannelMonitorUpdateErrZ { Clone::clone(&orig) }
+#[repr(C)]
+/// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
+/// This corresponds to std::vector in C++
+pub struct CVec_MonitorEventZ {
+ /// 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::chain::channelmonitor::MonitorEvent,
+ /// The number of elements pointed to by `data`.
+ pub datalen: usize
+}
+impl CVec_MonitorEventZ {
+ #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
+ 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::chain::channelmonitor::MonitorEvent] {
+ unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
}
}
-/// Checks if the given object is currently in the success state
-#[no_mangle]
-pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelFeaturesDecodeErrorZ) -> bool {
- o.result_ok
+impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
+ fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> 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 any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
-pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
-impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
+/// Frees the buffer pointed to by `data` if `datalen` is non-0.
+pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
+impl Drop for CVec_MonitorEventZ {
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) };
- }
+ if self.datalen == 0 { return; }
+ unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
+ }
+}
+impl Clone for CVec_MonitorEventZ {
+ 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)]
+/// A tuple of 2 elements. See the individual fields for the types contained.
+pub struct C2Tuple_OutPointCVec_MonitorEventZZ {
+ /// The element at position 0
+ pub a: crate::lightning::chain::transaction::OutPoint,
+ /// The element at position 1
+ pub b: crate::c_types::derived::CVec_MonitorEventZ,
+}
+impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ)> for C2Tuple_OutPointCVec_MonitorEventZZ {
+ fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ)) -> Self {
+ Self {
+ a: tup.0,
+ b: tup.1,
}
}
}
-impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
- let contents = if o.result_ok {
- let result = unsafe { o.contents.result };
- unsafe { o.contents.result = core::ptr::null_mut() };
- CResult_ChannelFeaturesDecodeErrorZPtr { result }
- } else {
- let err = unsafe { o.contents.err };
- unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_ChannelFeaturesDecodeErrorZPtr { err }
- };
+impl C2Tuple_OutPointCVec_MonitorEventZZ {
+ #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ) {
+ (self.a, self.b)
+ }
+}
+impl Clone for C2Tuple_OutPointCVec_MonitorEventZZ {
+ fn clone(&self) -> Self {
Self {
- contents,
- result_ok: o.result_ok,
+ a: Clone::clone(&self.a),
+ b: Clone::clone(&self.b),
}
}
}
+#[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 C2Tuple_OutPointCVec_MonitorEventZZ_clone(orig: &C2Tuple_OutPointCVec_MonitorEventZZ) -> C2Tuple_OutPointCVec_MonitorEventZZ { Clone::clone(&orig) }
+/// Creates a new C2Tuple_OutPointCVec_MonitorEventZZ from the contained elements.
+#[no_mangle]
+pub extern "C" fn C2Tuple_OutPointCVec_MonitorEventZZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_MonitorEventZ) -> C2Tuple_OutPointCVec_MonitorEventZZ {
+ C2Tuple_OutPointCVec_MonitorEventZZ { a, b, }
+}
+
+#[no_mangle]
+/// Frees any resources used by the C2Tuple_OutPointCVec_MonitorEventZZ.
+pub extern "C" fn C2Tuple_OutPointCVec_MonitorEventZZ_free(_res: C2Tuple_OutPointCVec_MonitorEventZZ) { }
#[repr(C)]
-/// The contents of CResult_NodeFeaturesDecodeErrorZ
-pub union CResult_NodeFeaturesDecodeErrorZPtr {
+/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_OutPointCVec_MonitorEventZZs of arbitrary size.
+/// This corresponds to std::vector in C++
+pub struct CVec_C2Tuple_OutPointCVec_MonitorEventZZZ {
+ /// 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::C2Tuple_OutPointCVec_MonitorEventZZ,
+ /// The number of elements pointed to by `data`.
+ pub datalen: usize
+}
+impl CVec_C2Tuple_OutPointCVec_MonitorEventZZZ {
+ #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorEventZZ> {
+ 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::C2Tuple_OutPointCVec_MonitorEventZZ] {
+ unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
+ }
+}
+impl From<Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorEventZZ>> for CVec_C2Tuple_OutPointCVec_MonitorEventZZZ {
+ fn from(v: Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorEventZZ>) -> 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_C2Tuple_OutPointCVec_MonitorEventZZZ_free(_res: CVec_C2Tuple_OutPointCVec_MonitorEventZZZ) { }
+impl Drop for CVec_C2Tuple_OutPointCVec_MonitorEventZZZ {
+ fn drop(&mut self) {
+ if self.datalen == 0 { return; }
+ unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
+ }
+}
+impl Clone for CVec_C2Tuple_OutPointCVec_MonitorEventZZZ {
+ 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::c_types::derived::C2Tuple_usizeTransactionZ or not
+pub enum COption_C2Tuple_usizeTransactionZZ {
+ /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
+ Some(crate::c_types::derived::C2Tuple_usizeTransactionZ),
+ /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
+ None
+}
+impl COption_C2Tuple_usizeTransactionZZ {
+ #[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::derived::C2Tuple_usizeTransactionZ {
+ if let Self::Some(v) = self { v } else { unreachable!() }
+ }
+}
+#[no_mangle]
+/// Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
+pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_some(o: crate::c_types::derived::C2Tuple_usizeTransactionZ) -> COption_C2Tuple_usizeTransactionZZ {
+ COption_C2Tuple_usizeTransactionZZ::Some(o)
+}
+#[no_mangle]
+/// Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
+pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_none() -> COption_C2Tuple_usizeTransactionZZ {
+ COption_C2Tuple_usizeTransactionZZ::None
+}
+#[no_mangle]
+/// Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
+pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_free(_res: COption_C2Tuple_usizeTransactionZZ) { }
+#[no_mangle]
+/// Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
+/// but with all dynamically-allocated buffers duplicated in new buffers.
+pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_clone(orig: &COption_C2Tuple_usizeTransactionZZ) -> COption_C2Tuple_usizeTransactionZZ { Clone::clone(&orig) }
+#[repr(C)]
+/// The contents of CResult_FixedPenaltyScorerDecodeErrorZ
+pub union CResult_FixedPenaltyScorerDecodeErrorZPtr {
/// A pointer to the contents in the success state.
/// Reading from this pointer when `result_ok` is not set is undefined.
- pub result: *mut crate::lightning::ln::features::NodeFeatures,
+ pub result: *mut crate::lightning::routing::scoring::FixedPenaltyScorer,
/// A pointer to the contents in the error state.
/// Reading from this pointer when `result_ok` is set is undefined.
pub err: *mut crate::lightning::ln::msgs::DecodeError,
}
#[repr(C)]
-/// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
-/// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
+/// A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
+/// containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult_NodeFeaturesDecodeErrorZ {
- /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
+pub struct CResult_FixedPenaltyScorerDecodeErrorZ {
+ /// The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
- /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
+ pub contents: CResult_FixedPenaltyScorerDecodeErrorZPtr,
+ /// Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
-pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
- CResult_NodeFeaturesDecodeErrorZ {
- contents: CResult_NodeFeaturesDecodeErrorZPtr {
+/// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
+pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::FixedPenaltyScorer) -> CResult_FixedPenaltyScorerDecodeErrorZ {
+ CResult_FixedPenaltyScorerDecodeErrorZ {
+ contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
-pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
- CResult_NodeFeaturesDecodeErrorZ {
- contents: CResult_NodeFeaturesDecodeErrorZPtr {
+/// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
+pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FixedPenaltyScorerDecodeErrorZ {
+ CResult_FixedPenaltyScorerDecodeErrorZ {
+ contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
err: Box::into_raw(Box::new(e)),
},
result_ok: false,
}
/// Checks if the given object is currently in the success state
#[no_mangle]
-pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_is_ok(o: &CResult_NodeFeaturesDecodeErrorZ) -> bool {
+pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o: &CResult_FixedPenaltyScorerDecodeErrorZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
-pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
-impl Drop for CResult_NodeFeaturesDecodeErrorZ {
+/// Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
+pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_free(_res: CResult_FixedPenaltyScorerDecodeErrorZ) { }
+impl Drop for CResult_FixedPenaltyScorerDecodeErrorZ {
fn drop(&mut self) {
if self.result_ok {
if unsafe { !(self.contents.result as *mut ()).is_null() } {
}
}
}
-impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_FixedPenaltyScorerDecodeErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, 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_NodeFeaturesDecodeErrorZPtr { result }
+ CResult_FixedPenaltyScorerDecodeErrorZPtr { result }
} else {
let err = unsafe { o.contents.err };
unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_NodeFeaturesDecodeErrorZPtr { err }
+ CResult_FixedPenaltyScorerDecodeErrorZPtr { err }
};
Self {
contents,
}
}
}
+impl Clone for CResult_FixedPenaltyScorerDecodeErrorZ {
+ fn clone(&self) -> Self {
+ if self.result_ok {
+ Self { result_ok: true, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
+ result: Box::into_raw(Box::new(<crate::lightning::routing::scoring::FixedPenaltyScorer>::clone(unsafe { &*self.contents.result })))
+ } }
+ } else {
+ Self { result_ok: false, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
+ err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
+ } }
+ }
+ }
+}
+#[no_mangle]
+/// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig`
+/// but with all dynamically-allocated buffers duplicated in new buffers.
+pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig: &CResult_FixedPenaltyScorerDecodeErrorZ) -> CResult_FixedPenaltyScorerDecodeErrorZ { Clone::clone(&orig) }
#[repr(C)]
-/// The contents of CResult_InvoiceFeaturesDecodeErrorZ
-pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
+/// The contents of CResult_ProbabilisticScorerDecodeErrorZ
+pub union CResult_ProbabilisticScorerDecodeErrorZPtr {
/// A pointer to the contents in the success state.
/// Reading from this pointer when `result_ok` is not set is undefined.
- pub result: *mut crate::lightning::ln::features::InvoiceFeatures,
+ pub result: *mut crate::lightning::routing::scoring::ProbabilisticScorer,
/// A pointer to the contents in the error state.
/// Reading from this pointer when `result_ok` is set is undefined.
pub err: *mut crate::lightning::ln::msgs::DecodeError,
}
#[repr(C)]
-/// A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
-/// containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
+/// A CResult_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation,
+/// containing a crate::lightning::routing::scoring::ProbabilisticScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult_InvoiceFeaturesDecodeErrorZ {
- /// The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
+pub struct CResult_ProbabilisticScorerDecodeErrorZ {
+ /// The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
- /// Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
+ pub contents: CResult_ProbabilisticScorerDecodeErrorZPtr,
+ /// Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
-pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
- CResult_InvoiceFeaturesDecodeErrorZ {
- contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
+/// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state.
+pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ProbabilisticScorer) -> CResult_ProbabilisticScorerDecodeErrorZ {
+ CResult_ProbabilisticScorerDecodeErrorZ {
+ contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
-pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
- CResult_InvoiceFeaturesDecodeErrorZ {
- contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
+/// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state.
+pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ProbabilisticScorerDecodeErrorZ {
+ CResult_ProbabilisticScorerDecodeErrorZ {
+ contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
err: Box::into_raw(Box::new(e)),
},
result_ok: false,
}
/// Checks if the given object is currently in the success state
#[no_mangle]
-pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_InvoiceFeaturesDecodeErrorZ) -> bool {
+pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o: &CResult_ProbabilisticScorerDecodeErrorZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
-pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
-impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
+/// Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ.
+pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_free(_res: CResult_ProbabilisticScorerDecodeErrorZ) { }
+impl Drop for CResult_ProbabilisticScorerDecodeErrorZ {
fn drop(&mut self) {
if self.result_ok {
if unsafe { !(self.contents.result as *mut ()).is_null() } {
}
}
}
-impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ProbabilisticScorerDecodeErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, 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_InvoiceFeaturesDecodeErrorZPtr { result }
+ CResult_ProbabilisticScorerDecodeErrorZPtr { result }
} else {
let err = unsafe { o.contents.err };
unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_InvoiceFeaturesDecodeErrorZPtr { err }
+ CResult_ProbabilisticScorerDecodeErrorZPtr { err }
};
Self {
contents,
}
}
#[repr(C)]
-/// The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
-pub union CResult_ChannelTypeFeaturesDecodeErrorZPtr {
+/// The contents of CResult_InitFeaturesDecodeErrorZ
+pub union CResult_InitFeaturesDecodeErrorZPtr {
/// A pointer to the contents in the success state.
/// Reading from this pointer when `result_ok` is not set is undefined.
- pub result: *mut crate::lightning::ln::features::ChannelTypeFeatures,
+ pub result: *mut crate::lightning::ln::features::InitFeatures,
/// A pointer to the contents in the error state.
/// Reading from this pointer when `result_ok` is set is undefined.
pub err: *mut crate::lightning::ln::msgs::DecodeError,
}
#[repr(C)]
-/// A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
-/// containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
+/// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
+/// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult_ChannelTypeFeaturesDecodeErrorZ {
- /// The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
+pub struct CResult_InitFeaturesDecodeErrorZ {
+ /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr,
- /// Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
+ pub contents: CResult_InitFeaturesDecodeErrorZPtr,
+ /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
-pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelTypeFeatures) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
- CResult_ChannelTypeFeaturesDecodeErrorZ {
- contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
+/// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
+pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
+ CResult_InitFeaturesDecodeErrorZ {
+ contents: CResult_InitFeaturesDecodeErrorZPtr {
result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
-pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
- CResult_ChannelTypeFeaturesDecodeErrorZ {
- contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
+/// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
+pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
+ CResult_InitFeaturesDecodeErrorZ {
+ contents: CResult_InitFeaturesDecodeErrorZPtr {
err: Box::into_raw(Box::new(e)),
},
result_ok: false,
}
/// Checks if the given object is currently in the success state
#[no_mangle]
-pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> bool {
+pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_is_ok(o: &CResult_InitFeaturesDecodeErrorZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
-pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res: CResult_ChannelTypeFeaturesDecodeErrorZ) { }
-impl Drop for CResult_ChannelTypeFeaturesDecodeErrorZ {
+/// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
+pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
+impl Drop for CResult_InitFeaturesDecodeErrorZ {
fn drop(&mut self) {
if self.result_ok {
if unsafe { !(self.contents.result as *mut ()).is_null() } {
}
}
}
-impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTypeFeaturesDecodeErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
let contents = if o.result_ok {
let result = unsafe { o.contents.result };
unsafe { o.contents.result = core::ptr::null_mut() };
- CResult_ChannelTypeFeaturesDecodeErrorZPtr { result }
+ CResult_InitFeaturesDecodeErrorZPtr { result }
} else {
let err = unsafe { o.contents.err };
unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_ChannelTypeFeaturesDecodeErrorZPtr { err }
+ CResult_InitFeaturesDecodeErrorZPtr { err }
};
Self {
contents,
}
}
}
+impl Clone for CResult_InitFeaturesDecodeErrorZ {
+ fn clone(&self) -> Self {
+ if self.result_ok {
+ Self { result_ok: true, contents: CResult_InitFeaturesDecodeErrorZPtr {
+ result: Box::into_raw(Box::new(<crate::lightning::ln::features::InitFeatures>::clone(unsafe { &*self.contents.result })))
+ } }
+ } else {
+ Self { result_ok: false, contents: CResult_InitFeaturesDecodeErrorZPtr {
+ err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
+ } }
+ }
+ }
+}
+#[no_mangle]
+/// Creates a new CResult_InitFeaturesDecodeErrorZ which has the same data as `orig`
+/// but with all dynamically-allocated buffers duplicated in new buffers.
+pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_clone(orig: &CResult_InitFeaturesDecodeErrorZ) -> CResult_InitFeaturesDecodeErrorZ { Clone::clone(&orig) }
#[repr(C)]
-/// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
-pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
+/// The contents of CResult_ChannelFeaturesDecodeErrorZ
+pub union CResult_ChannelFeaturesDecodeErrorZPtr {
/// A pointer to the contents in the success state.
/// Reading from this pointer when `result_ok` is not set is undefined.
- pub result: *mut crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor,
+ pub result: *mut crate::lightning::ln::features::ChannelFeatures,
/// A pointer to the contents in the error state.
/// Reading from this pointer when `result_ok` is set is undefined.
pub err: *mut crate::lightning::ln::msgs::DecodeError,
}
#[repr(C)]
-/// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
-/// containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
+/// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
+/// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
- /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
+pub struct CResult_ChannelFeaturesDecodeErrorZ {
+ /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr,
- /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
+ pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
+ /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
-pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
- CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
- contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
+/// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
+pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
+ CResult_ChannelFeaturesDecodeErrorZ {
+ contents: CResult_ChannelFeaturesDecodeErrorZPtr {
result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
-pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
- CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
- contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
+/// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
+pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
+ CResult_ChannelFeaturesDecodeErrorZ {
+ contents: CResult_ChannelFeaturesDecodeErrorZPtr {
err: Box::into_raw(Box::new(e)),
},
result_ok: false,
}
/// Checks if the given object is currently in the success state
#[no_mangle]
-pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> bool {
+pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelFeaturesDecodeErrorZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
-pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { }
-impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
+/// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
+pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
+impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
fn drop(&mut self) {
if self.result_ok {
if unsafe { !(self.contents.result as *mut ()).is_null() } {
}
}
}
-impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
let contents = if o.result_ok {
let result = unsafe { o.contents.result };
unsafe { o.contents.result = core::ptr::null_mut() };
- CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result }
+ CResult_ChannelFeaturesDecodeErrorZPtr { result }
} else {
let err = unsafe { o.contents.err };
unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err }
+ CResult_ChannelFeaturesDecodeErrorZPtr { err }
};
Self {
contents,
}
}
}
-impl Clone for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
+impl Clone for CResult_ChannelFeaturesDecodeErrorZ {
fn clone(&self) -> Self {
if self.result_ok {
- Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
- result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
+ Self { result_ok: true, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
+ result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelFeatures>::clone(unsafe { &*self.contents.result })))
} }
} else {
- Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
+ Self { result_ok: false, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
} }
}
}
}
#[no_mangle]
-/// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
+/// Creates a new CResult_ChannelFeaturesDecodeErrorZ which has the same data as `orig`
/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
+pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelFeaturesDecodeErrorZ) -> CResult_ChannelFeaturesDecodeErrorZ { Clone::clone(&orig) }
#[repr(C)]
-/// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
-pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
+/// The contents of CResult_NodeFeaturesDecodeErrorZ
+pub union CResult_NodeFeaturesDecodeErrorZPtr {
/// A pointer to the contents in the success state.
/// Reading from this pointer when `result_ok` is not set is undefined.
- pub result: *mut crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor,
+ pub result: *mut crate::lightning::ln::features::NodeFeatures,
/// A pointer to the contents in the error state.
/// Reading from this pointer when `result_ok` is set is undefined.
pub err: *mut crate::lightning::ln::msgs::DecodeError,
}
#[repr(C)]
-/// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
-/// containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
+/// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
+/// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
- /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
+pub struct CResult_NodeFeaturesDecodeErrorZ {
+ /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr,
- /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
+ pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
+ /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
-pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
- CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
- contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
+/// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
+pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
+ CResult_NodeFeaturesDecodeErrorZ {
+ contents: CResult_NodeFeaturesDecodeErrorZPtr {
result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
-pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
- CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
- contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
+/// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
+pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
+ CResult_NodeFeaturesDecodeErrorZ {
+ contents: CResult_NodeFeaturesDecodeErrorZPtr {
err: Box::into_raw(Box::new(e)),
},
result_ok: false,
}
/// Checks if the given object is currently in the success state
#[no_mangle]
-pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> bool {
+pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_is_ok(o: &CResult_NodeFeaturesDecodeErrorZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
-pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { }
-impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
+/// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
+pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
+impl Drop for CResult_NodeFeaturesDecodeErrorZ {
fn drop(&mut self) {
if self.result_ok {
if unsafe { !(self.contents.result as *mut ()).is_null() } {
}
}
}
-impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
let contents = if o.result_ok {
let result = unsafe { o.contents.result };
unsafe { o.contents.result = core::ptr::null_mut() };
- CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result }
+ CResult_NodeFeaturesDecodeErrorZPtr { result }
} else {
let err = unsafe { o.contents.err };
unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err }
+ CResult_NodeFeaturesDecodeErrorZPtr { err }
};
Self {
contents,
}
}
}
-impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
+impl Clone for CResult_NodeFeaturesDecodeErrorZ {
fn clone(&self) -> Self {
if self.result_ok {
- Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
- result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
+ Self { result_ok: true, contents: CResult_NodeFeaturesDecodeErrorZPtr {
+ result: Box::into_raw(Box::new(<crate::lightning::ln::features::NodeFeatures>::clone(unsafe { &*self.contents.result })))
} }
} else {
- Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
+ Self { result_ok: false, contents: CResult_NodeFeaturesDecodeErrorZPtr {
err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
} }
}
}
}
#[no_mangle]
-/// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
+/// Creates a new CResult_NodeFeaturesDecodeErrorZ which has the same data as `orig`
/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
+pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_clone(orig: &CResult_NodeFeaturesDecodeErrorZ) -> CResult_NodeFeaturesDecodeErrorZ { Clone::clone(&orig) }
#[repr(C)]
-/// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
-pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
+/// The contents of CResult_InvoiceFeaturesDecodeErrorZ
+pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
/// A pointer to the contents in the success state.
/// Reading from this pointer when `result_ok` is not set is undefined.
- pub result: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
+ pub result: *mut crate::lightning::ln::features::InvoiceFeatures,
/// A pointer to the contents in the error state.
/// Reading from this pointer when `result_ok` is set is undefined.
pub err: *mut crate::lightning::ln::msgs::DecodeError,
}
#[repr(C)]
-/// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
-/// containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
+/// A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
+/// containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
- /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
+pub struct CResult_InvoiceFeaturesDecodeErrorZ {
+ /// The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
- /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
+ pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
+ /// Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
-pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
- CResult_SpendableOutputDescriptorDecodeErrorZ {
- contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
+/// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
+pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
+ CResult_InvoiceFeaturesDecodeErrorZ {
+ contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
-pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
- CResult_SpendableOutputDescriptorDecodeErrorZ {
- contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
+/// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
+pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
+ CResult_InvoiceFeaturesDecodeErrorZ {
+ contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
err: Box::into_raw(Box::new(e)),
},
result_ok: false,
}
/// Checks if the given object is currently in the success state
#[no_mangle]
-pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> bool {
+pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_InvoiceFeaturesDecodeErrorZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
-pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
-impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
+/// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
+pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
+impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
fn drop(&mut self) {
if self.result_ok {
if unsafe { !(self.contents.result as *mut ()).is_null() } {
}
}
}
-impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
let contents = if o.result_ok {
let result = unsafe { o.contents.result };
unsafe { o.contents.result = core::ptr::null_mut() };
- CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
+ CResult_InvoiceFeaturesDecodeErrorZPtr { result }
} else {
let err = unsafe { o.contents.err };
unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
+ CResult_InvoiceFeaturesDecodeErrorZPtr { err }
};
Self {
contents,
}
}
}
-impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
+impl Clone for CResult_InvoiceFeaturesDecodeErrorZ {
fn clone(&self) -> Self {
if self.result_ok {
- Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
- result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
+ Self { result_ok: true, contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
+ result: Box::into_raw(Box::new(<crate::lightning::ln::features::InvoiceFeatures>::clone(unsafe { &*self.contents.result })))
} }
} else {
- Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
+ Self { result_ok: false, contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
} }
}
}
}
#[no_mangle]
-/// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
-/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
-#[repr(C)]
-/// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
-/// This corresponds to std::vector in C++
-pub struct CVec_PaymentPreimageZ {
- /// 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::ThirtyTwoBytes,
- /// The number of elements pointed to by `data`.
- pub datalen: usize
-}
-impl CVec_PaymentPreimageZ {
- #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
- 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::ThirtyTwoBytes] {
- unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
- }
-}
-impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_PaymentPreimageZ {
- fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> 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_PaymentPreimageZ_free(_res: CVec_PaymentPreimageZ) { }
-impl Drop for CVec_PaymentPreimageZ {
- fn drop(&mut self) {
- if self.datalen == 0 { return; }
- unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
- }
-}
-impl Clone for CVec_PaymentPreimageZ {
- 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)]
-/// A tuple of 2 elements. See the individual fields for the types contained.
-pub struct C2Tuple_SignatureCVec_SignatureZZ {
- /// The element at position 0
- pub a: crate::c_types::Signature,
- /// The element at position 1
- pub b: crate::c_types::derived::CVec_SignatureZ,
-}
-impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
- fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
- Self {
- a: tup.0,
- b: tup.1,
- }
- }
-}
-impl C2Tuple_SignatureCVec_SignatureZZ {
- #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
- (self.a, self.b)
- }
-}
-impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
- fn clone(&self) -> Self {
- Self {
- a: Clone::clone(&self.a),
- b: Clone::clone(&self.b),
- }
- }
-}
-#[no_mangle]
-/// Creates a new tuple which has the same data as `orig`
+/// Creates a new CResult_InvoiceFeaturesDecodeErrorZ which has the same data as `orig`
/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { Clone::clone(&orig) }
-/// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
-#[no_mangle]
-pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
- C2Tuple_SignatureCVec_SignatureZZ { a, b, }
-}
-
-#[no_mangle]
-/// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
-pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
+pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_clone(orig: &CResult_InvoiceFeaturesDecodeErrorZ) -> CResult_InvoiceFeaturesDecodeErrorZ { Clone::clone(&orig) }
#[repr(C)]
-/// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
-pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
+/// The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
+pub union CResult_ChannelTypeFeaturesDecodeErrorZPtr {
/// A pointer to the contents in the success state.
/// Reading from this pointer when `result_ok` is not set is undefined.
- pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
- /// Note that this value is always NULL, as there are no contents in the Err variant
- pub err: *mut core::ffi::c_void,
+ pub result: *mut crate::lightning::ln::features::ChannelTypeFeatures,
+ /// A pointer to the contents in the error state.
+ /// Reading from this pointer when `result_ok` is set is undefined.
+ pub err: *mut crate::lightning::ln::msgs::DecodeError,
}
#[repr(C)]
-/// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
-/// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
+/// A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
+/// containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
- /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
+pub struct CResult_ChannelTypeFeaturesDecodeErrorZ {
+ /// The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
- /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
+ pub contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr,
+ /// Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
-pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
- CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
- contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
+/// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
+pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelTypeFeatures) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
+ CResult_ChannelTypeFeaturesDecodeErrorZ {
+ contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
-pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
- CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
- contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
- err: core::ptr::null_mut(),
+/// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
+pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
+ CResult_ChannelTypeFeaturesDecodeErrorZ {
+ contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
+ err: Box::into_raw(Box::new(e)),
},
result_ok: false,
}
}
/// Checks if the given object is currently in the success state
#[no_mangle]
-pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> bool {
+pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
-pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
-impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
+/// Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
+pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res: CResult_ChannelTypeFeaturesDecodeErrorZ) { }
+impl Drop for CResult_ChannelTypeFeaturesDecodeErrorZ {
fn drop(&mut self) {
if self.result_ok {
if unsafe { !(self.contents.result as *mut ()).is_null() } {
let _ = unsafe { Box::from_raw(self.contents.result) };
}
} else {
+ if unsafe { !(self.contents.err as *mut ()).is_null() } {
+ let _ = unsafe { Box::from_raw(self.contents.err) };
+ }
}
}
}
-impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTypeFeaturesDecodeErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
let contents = if o.result_ok {
let result = unsafe { o.contents.result };
unsafe { o.contents.result = core::ptr::null_mut() };
- CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
+ CResult_ChannelTypeFeaturesDecodeErrorZPtr { result }
} else {
- let _ = unsafe { Box::from_raw(o.contents.err) };
- o.contents.err = core::ptr::null_mut();
- CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: core::ptr::null_mut() }
+ let err = unsafe { o.contents.err };
+ unsafe { o.contents.err = core::ptr::null_mut(); }
+ CResult_ChannelTypeFeaturesDecodeErrorZPtr { err }
};
Self {
contents,
}
}
}
-impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
+impl Clone for CResult_ChannelTypeFeaturesDecodeErrorZ {
fn clone(&self) -> Self {
if self.result_ok {
- Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
- result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
+ Self { result_ok: true, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
+ result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelTypeFeatures>::clone(unsafe { &*self.contents.result })))
} }
} else {
- Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
- err: core::ptr::null_mut()
+ Self { result_ok: false, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
+ err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
} }
}
}
}
#[no_mangle]
-/// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
+/// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ which has the same data as `orig`
/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { Clone::clone(&orig) }
+pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> CResult_ChannelTypeFeaturesDecodeErrorZ { Clone::clone(&orig) }
#[repr(C)]
-/// The contents of CResult_SignatureNoneZ
-pub union CResult_SignatureNoneZPtr {
+/// The contents of CResult_NodeIdDecodeErrorZ
+pub union CResult_NodeIdDecodeErrorZPtr {
/// 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::Signature,
- /// Note that this value is always NULL, as there are no contents in the Err variant
- pub err: *mut core::ffi::c_void,
+ pub result: *mut crate::lightning::routing::gossip::NodeId,
+ /// 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_SignatureNoneZ represents the result of a fallible operation,
-/// containing a crate::c_types::Signature on success and a () on failure.
+/// A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
+/// containing a crate::lightning::routing::gossip::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult_SignatureNoneZ {
- /// The contents of this CResult_SignatureNoneZ, accessible via either
+pub struct CResult_NodeIdDecodeErrorZ {
+ /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_SignatureNoneZPtr,
- /// Whether this CResult_SignatureNoneZ represents a success state.
+ pub contents: CResult_NodeIdDecodeErrorZPtr,
+ /// Whether this CResult_NodeIdDecodeErrorZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_SignatureNoneZ in the success state.
-pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
- CResult_SignatureNoneZ {
- contents: CResult_SignatureNoneZPtr {
+/// Creates a new CResult_NodeIdDecodeErrorZ in the success state.
+pub extern "C" fn CResult_NodeIdDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeId) -> CResult_NodeIdDecodeErrorZ {
+ CResult_NodeIdDecodeErrorZ {
+ contents: CResult_NodeIdDecodeErrorZPtr {
result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_SignatureNoneZ in the error state.
-pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
- CResult_SignatureNoneZ {
- contents: CResult_SignatureNoneZPtr {
- err: core::ptr::null_mut(),
+/// Creates a new CResult_NodeIdDecodeErrorZ in the error state.
+pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeIdDecodeErrorZ {
+ CResult_NodeIdDecodeErrorZ {
+ contents: CResult_NodeIdDecodeErrorZPtr {
+ 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_SignatureNoneZ_is_ok(o: &CResult_SignatureNoneZ) -> bool {
+pub extern "C" fn CResult_NodeIdDecodeErrorZ_is_ok(o: &CResult_NodeIdDecodeErrorZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_SignatureNoneZ.
-pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
-impl Drop for CResult_SignatureNoneZ {
+/// Frees any resources used by the CResult_NodeIdDecodeErrorZ.
+pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { }
+impl Drop for CResult_NodeIdDecodeErrorZ {
fn drop(&mut self) {
if self.result_ok {
if unsafe { !(self.contents.result as *mut ()).is_null() } {
let _ = unsafe { Box::from_raw(self.contents.result) };
}
} else {
+ if unsafe { !(self.contents.err as *mut ()).is_null() } {
+ let _ = unsafe { Box::from_raw(self.contents.err) };
+ }
}
}
}
-impl From<crate::c_types::CResultTempl<crate::c_types::Signature, ()>> for CResult_SignatureNoneZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, ()>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeIdDecodeErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, 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_SignatureNoneZPtr { result }
+ CResult_NodeIdDecodeErrorZPtr { result }
} else {
- let _ = unsafe { Box::from_raw(o.contents.err) };
- o.contents.err = core::ptr::null_mut();
- CResult_SignatureNoneZPtr { err: core::ptr::null_mut() }
+ let err = unsafe { o.contents.err };
+ unsafe { o.contents.err = core::ptr::null_mut(); }
+ CResult_NodeIdDecodeErrorZPtr { err }
};
Self {
contents,
}
}
}
-impl Clone for CResult_SignatureNoneZ {
+impl Clone for CResult_NodeIdDecodeErrorZ {
fn clone(&self) -> Self {
if self.result_ok {
- Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
- result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
+ Self { result_ok: true, contents: CResult_NodeIdDecodeErrorZPtr {
+ result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeId>::clone(unsafe { &*self.contents.result })))
} }
} else {
- Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
- err: core::ptr::null_mut()
+ Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr {
+ err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
} }
}
}
}
#[no_mangle]
-/// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
+/// Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { Clone::clone(&orig) }
+pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) }
#[repr(C)]
-/// A tuple of 2 elements. See the individual fields for the types contained.
-pub struct C2Tuple_SignatureSignatureZ {
- /// The element at position 0
- pub a: crate::c_types::Signature,
- /// The element at position 1
- pub b: crate::c_types::Signature,
-}
-impl From<(crate::c_types::Signature, crate::c_types::Signature)> for C2Tuple_SignatureSignatureZ {
- fn from (tup: (crate::c_types::Signature, crate::c_types::Signature)) -> Self {
- Self {
- a: tup.0,
- b: tup.1,
- }
- }
-}
-impl C2Tuple_SignatureSignatureZ {
- #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::Signature) {
- (self.a, self.b)
- }
-}
-impl Clone for C2Tuple_SignatureSignatureZ {
- fn clone(&self) -> Self {
- Self {
- a: Clone::clone(&self.a),
- b: Clone::clone(&self.b),
- }
- }
-}
-#[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 C2Tuple_SignatureSignatureZ_clone(orig: &C2Tuple_SignatureSignatureZ) -> C2Tuple_SignatureSignatureZ { Clone::clone(&orig) }
-/// Creates a new C2Tuple_SignatureSignatureZ from the contained elements.
-#[no_mangle]
-pub extern "C" fn C2Tuple_SignatureSignatureZ_new(a: crate::c_types::Signature, b: crate::c_types::Signature) -> C2Tuple_SignatureSignatureZ {
- C2Tuple_SignatureSignatureZ { a, b, }
-}
-
-#[no_mangle]
-/// Frees any resources used by the C2Tuple_SignatureSignatureZ.
-pub extern "C" fn C2Tuple_SignatureSignatureZ_free(_res: C2Tuple_SignatureSignatureZ) { }
-#[repr(C)]
-/// The contents of CResult_C2Tuple_SignatureSignatureZNoneZ
-pub union CResult_C2Tuple_SignatureSignatureZNoneZPtr {
- /// A pointer to the contents in the success state.
- /// Reading from this pointer when `result_ok` is not set is undefined.
- pub result: *mut crate::c_types::derived::C2Tuple_SignatureSignatureZ,
- /// Note that this value is always NULL, as there are no contents in the Err variant
- pub err: *mut core::ffi::c_void,
+/// The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
+pub union CResult_COption_NetworkUpdateZDecodeErrorZPtr {
+ /// 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_NetworkUpdateZ,
+ /// 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_C2Tuple_SignatureSignatureZNoneZ represents the result of a fallible operation,
-/// containing a crate::c_types::derived::C2Tuple_SignatureSignatureZ on success and a () on failure.
+/// A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
+/// containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult_C2Tuple_SignatureSignatureZNoneZ {
- /// The contents of this CResult_C2Tuple_SignatureSignatureZNoneZ, accessible via either
+pub struct CResult_COption_NetworkUpdateZDecodeErrorZ {
+ /// The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr,
- /// Whether this CResult_C2Tuple_SignatureSignatureZNoneZ represents a success state.
+ pub contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr,
+ /// Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the success state.
-pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureSignatureZ) -> CResult_C2Tuple_SignatureSignatureZNoneZ {
- CResult_C2Tuple_SignatureSignatureZNoneZ {
- contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
+/// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
+pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o: crate::c_types::derived::COption_NetworkUpdateZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
+ CResult_COption_NetworkUpdateZDecodeErrorZ {
+ contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the error state.
-pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_err() -> CResult_C2Tuple_SignatureSignatureZNoneZ {
- CResult_C2Tuple_SignatureSignatureZNoneZ {
- contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
- err: core::ptr::null_mut(),
+/// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
+pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
+ CResult_COption_NetworkUpdateZDecodeErrorZ {
+ contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
+ err: Box::into_raw(Box::new(e)),
},
result_ok: false,
}
}
/// Checks if the given object is currently in the success state
#[no_mangle]
-pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureSignatureZNoneZ) -> bool {
+pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_C2Tuple_SignatureSignatureZNoneZ.
-pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_free(_res: CResult_C2Tuple_SignatureSignatureZNoneZ) { }
-impl Drop for CResult_C2Tuple_SignatureSignatureZNoneZ {
+/// Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
+pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res: CResult_COption_NetworkUpdateZDecodeErrorZ) { }
+impl Drop for CResult_COption_NetworkUpdateZDecodeErrorZ {
fn drop(&mut self) {
if self.result_ok {
if unsafe { !(self.contents.result as *mut ()).is_null() } {
let _ = unsafe { Box::from_raw(self.contents.result) };
}
} else {
+ if unsafe { !(self.contents.err as *mut ()).is_null() } {
+ let _ = unsafe { Box::from_raw(self.contents.err) };
+ }
}
}
}
-impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureSignatureZ, ()>> for CResult_C2Tuple_SignatureSignatureZNoneZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureSignatureZ, ()>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_NetworkUpdateZDecodeErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, 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_C2Tuple_SignatureSignatureZNoneZPtr { result }
+ CResult_COption_NetworkUpdateZDecodeErrorZPtr { result }
} else {
- let _ = unsafe { Box::from_raw(o.contents.err) };
- o.contents.err = core::ptr::null_mut();
- CResult_C2Tuple_SignatureSignatureZNoneZPtr { err: core::ptr::null_mut() }
+ let err = unsafe { o.contents.err };
+ unsafe { o.contents.err = core::ptr::null_mut(); }
+ CResult_COption_NetworkUpdateZDecodeErrorZPtr { err }
};
Self {
contents,
}
}
}
-impl Clone for CResult_C2Tuple_SignatureSignatureZNoneZ {
+impl Clone for CResult_COption_NetworkUpdateZDecodeErrorZ {
fn clone(&self) -> Self {
if self.result_ok {
- Self { result_ok: true, contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
- result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureSignatureZ>::clone(unsafe { &*self.contents.result })))
+ Self { result_ok: true, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
+ result: Box::into_raw(Box::new(<crate::c_types::derived::COption_NetworkUpdateZ>::clone(unsafe { &*self.contents.result })))
} }
} else {
- Self { result_ok: false, contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
- err: core::ptr::null_mut()
+ Self { result_ok: false, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
+ err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
} }
}
}
}
#[no_mangle]
-/// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ which has the same data as `orig`
+/// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_clone(orig: &CResult_C2Tuple_SignatureSignatureZNoneZ) -> CResult_C2Tuple_SignatureSignatureZNoneZ { Clone::clone(&orig) }
+pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ { Clone::clone(&orig) }
#[repr(C)]
-/// The contents of CResult_SecretKeyNoneZ
-pub union CResult_SecretKeyNoneZPtr {
+/// An enum which can either contain a crate::lightning::chain::Access or not
+pub enum COption_AccessZ {
+ /// When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
+ Some(crate::lightning::chain::Access),
+ /// When we're in this state, this COption_AccessZ contains nothing
+ None
+}
+impl COption_AccessZ {
+ #[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::chain::Access {
+ if let Self::Some(v) = self { v } else { unreachable!() }
+ }
+}
+#[no_mangle]
+/// Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
+pub extern "C" fn COption_AccessZ_some(o: crate::lightning::chain::Access) -> COption_AccessZ {
+ COption_AccessZ::Some(o)
+}
+#[no_mangle]
+/// Constructs a new COption_AccessZ containing nothing
+pub extern "C" fn COption_AccessZ_none() -> COption_AccessZ {
+ COption_AccessZ::None
+}
+#[no_mangle]
+/// Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
+pub extern "C" fn COption_AccessZ_free(_res: COption_AccessZ) { }
+#[repr(C)]
+/// The contents of CResult_boolLightningErrorZ
+pub union CResult_boolLightningErrorZPtr {
/// 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::SecretKey,
- /// Note that this value is always NULL, as there are no contents in the Err variant
- pub err: *mut core::ffi::c_void,
+ pub result: *mut bool,
+ /// 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::LightningError,
}
#[repr(C)]
-/// A CResult_SecretKeyNoneZ represents the result of a fallible operation,
-/// containing a crate::c_types::SecretKey on success and a () on failure.
+/// A CResult_boolLightningErrorZ represents the result of a fallible operation,
+/// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult_SecretKeyNoneZ {
- /// The contents of this CResult_SecretKeyNoneZ, accessible via either
+pub struct CResult_boolLightningErrorZ {
+ /// The contents of this CResult_boolLightningErrorZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_SecretKeyNoneZPtr,
- /// Whether this CResult_SecretKeyNoneZ represents a success state.
+ pub contents: CResult_boolLightningErrorZPtr,
+ /// Whether this CResult_boolLightningErrorZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_SecretKeyNoneZ in the success state.
-pub extern "C" fn CResult_SecretKeyNoneZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeyNoneZ {
- CResult_SecretKeyNoneZ {
- contents: CResult_SecretKeyNoneZPtr {
+/// Creates a new CResult_boolLightningErrorZ in the success state.
+pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
+ CResult_boolLightningErrorZ {
+ contents: CResult_boolLightningErrorZPtr {
result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_SecretKeyNoneZ in the error state.
-pub extern "C" fn CResult_SecretKeyNoneZ_err() -> CResult_SecretKeyNoneZ {
- CResult_SecretKeyNoneZ {
- contents: CResult_SecretKeyNoneZPtr {
- err: core::ptr::null_mut(),
+/// Creates a new CResult_boolLightningErrorZ in the error state.
+pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
+ CResult_boolLightningErrorZ {
+ contents: CResult_boolLightningErrorZPtr {
+ 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_SecretKeyNoneZ_is_ok(o: &CResult_SecretKeyNoneZ) -> bool {
+pub extern "C" fn CResult_boolLightningErrorZ_is_ok(o: &CResult_boolLightningErrorZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_SecretKeyNoneZ.
-pub extern "C" fn CResult_SecretKeyNoneZ_free(_res: CResult_SecretKeyNoneZ) { }
-impl Drop for CResult_SecretKeyNoneZ {
+/// Frees any resources used by the CResult_boolLightningErrorZ.
+pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
+impl Drop for CResult_boolLightningErrorZ {
fn drop(&mut self) {
if self.result_ok {
if unsafe { !(self.contents.result as *mut ()).is_null() } {
let _ = unsafe { Box::from_raw(self.contents.result) };
}
} else {
+ if unsafe { !(self.contents.err as *mut ()).is_null() } {
+ let _ = unsafe { Box::from_raw(self.contents.err) };
+ }
}
}
}
-impl From<crate::c_types::CResultTempl<crate::c_types::SecretKey, ()>> for CResult_SecretKeyNoneZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, ()>) -> Self {
+impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
let contents = if o.result_ok {
let result = unsafe { o.contents.result };
unsafe { o.contents.result = core::ptr::null_mut() };
- CResult_SecretKeyNoneZPtr { result }
+ CResult_boolLightningErrorZPtr { result }
} else {
- let _ = unsafe { Box::from_raw(o.contents.err) };
- o.contents.err = core::ptr::null_mut();
- CResult_SecretKeyNoneZPtr { err: core::ptr::null_mut() }
+ let err = unsafe { o.contents.err };
+ unsafe { o.contents.err = core::ptr::null_mut(); }
+ CResult_boolLightningErrorZPtr { err }
};
Self {
contents,
}
}
}
-impl Clone for CResult_SecretKeyNoneZ {
+impl Clone for CResult_boolLightningErrorZ {
fn clone(&self) -> Self {
if self.result_ok {
- Self { result_ok: true, contents: CResult_SecretKeyNoneZPtr {
- result: Box::into_raw(Box::new(<crate::c_types::SecretKey>::clone(unsafe { &*self.contents.result })))
+ Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
+ result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
} }
} else {
- Self { result_ok: false, contents: CResult_SecretKeyNoneZPtr {
- err: core::ptr::null_mut()
+ Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
+ err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
} }
}
}
}
#[no_mangle]
-/// Creates a new CResult_SecretKeyNoneZ which has the same data as `orig`
+/// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_SecretKeyNoneZ_clone(orig: &CResult_SecretKeyNoneZ) -> CResult_SecretKeyNoneZ { Clone::clone(&orig) }
+pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) }
#[repr(C)]
-/// The contents of CResult_SignDecodeErrorZ
-pub union CResult_SignDecodeErrorZPtr {
- /// 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::chain::keysinterface::Sign,
- /// 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,
+/// A tuple of 3 elements. See the individual fields for the types contained.
+pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
+ /// The element at position 0
+ pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
+ /// The element at position 1
+ pub b: crate::lightning::ln::msgs::ChannelUpdate,
+ /// The element at position 2
+ pub c: crate::lightning::ln::msgs::ChannelUpdate,
}
-#[repr(C)]
-/// A CResult_SignDecodeErrorZ represents the result of a fallible operation,
-/// containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
-/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult_SignDecodeErrorZ {
- /// The contents of this CResult_SignDecodeErrorZ, accessible via either
- /// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_SignDecodeErrorZPtr,
- /// Whether this CResult_SignDecodeErrorZ represents a success state.
- pub result_ok: bool,
+impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
+ fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
+ Self {
+ a: tup.0,
+ b: tup.1,
+ c: tup.2,
+ }
+ }
}
-#[no_mangle]
-/// Creates a new CResult_SignDecodeErrorZ in the success state.
-pub extern "C" fn CResult_SignDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::Sign) -> CResult_SignDecodeErrorZ {
- CResult_SignDecodeErrorZ {
- contents: CResult_SignDecodeErrorZPtr {
- result: Box::into_raw(Box::new(o)),
- },
- result_ok: true,
+impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
+ #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
+ (self.a, self.b, self.c)
}
}
-#[no_mangle]
-/// Creates a new CResult_SignDecodeErrorZ in the error state.
-pub extern "C" fn CResult_SignDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SignDecodeErrorZ {
- CResult_SignDecodeErrorZ {
- contents: CResult_SignDecodeErrorZPtr {
- err: Box::into_raw(Box::new(e)),
- },
- result_ok: false,
+impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
+ fn clone(&self) -> Self {
+ Self {
+ a: Clone::clone(&self.a),
+ b: Clone::clone(&self.b),
+ c: Clone::clone(&self.c),
+ }
}
}
-/// Checks if the given object is currently in the success state
#[no_mangle]
-pub extern "C" fn CResult_SignDecodeErrorZ_is_ok(o: &CResult_SignDecodeErrorZ) -> bool {
- o.result_ok
+/// 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_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) }
+/// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
+#[no_mangle]
+pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a: crate::lightning::ln::msgs::ChannelAnnouncement, b: crate::lightning::ln::msgs::ChannelUpdate, c: crate::lightning::ln::msgs::ChannelUpdate) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
+ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
}
+
#[no_mangle]
-/// Frees any resources used by the CResult_SignDecodeErrorZ.
-pub extern "C" fn CResult_SignDecodeErrorZ_free(_res: CResult_SignDecodeErrorZ) { }
-impl Drop for CResult_SignDecodeErrorZ {
- 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) };
- }
- }
+/// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
+pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
+#[repr(C)]
+/// A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
+/// This corresponds to std::vector in C++
+pub struct CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
+ /// 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_ChannelAnnouncementChannelUpdateChannelUpdateZ,
+ /// The number of elements pointed to by `data`.
+ pub datalen: usize
+}
+impl CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
+ #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ> {
+ 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_ChannelAnnouncementChannelUpdateChannelUpdateZ] {
+ unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
}
}
-impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>> for CResult_SignDecodeErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, 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_SignDecodeErrorZPtr { result }
- } else {
- let err = unsafe { o.contents.err };
- unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_SignDecodeErrorZPtr { err }
- };
- Self {
- contents,
- result_ok: o.result_ok,
- }
+impl From<Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>> for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
+ fn from(v: Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>) -> Self {
+ let datalen = v.len();
+ let data = Box::into_raw(v.into_boxed_slice());
+ Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
}
}
-impl Clone for CResult_SignDecodeErrorZ {
+#[no_mangle]
+/// Frees the buffer pointed to by `data` if `datalen` is non-0.
+pub extern "C" fn CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
+impl Drop for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
+ fn drop(&mut self) {
+ if self.datalen == 0 { return; }
+ unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
+ }
+}
+impl Clone for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
fn clone(&self) -> Self {
- if self.result_ok {
- Self { result_ok: true, contents: CResult_SignDecodeErrorZPtr {
- result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::Sign>::clone(unsafe { &*self.contents.result })))
- } }
- } else {
- Self { result_ok: false, contents: CResult_SignDecodeErrorZPtr {
- err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
- } }
- }
+ 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)
}
}
-#[no_mangle]
-/// Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
-/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_SignDecodeErrorZ_clone(orig: &CResult_SignDecodeErrorZ) -> CResult_SignDecodeErrorZ { Clone::clone(&orig) }
#[repr(C)]
-/// A dynamically-allocated array of crate::c_types::u5s of arbitrary size.
+/// A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
/// This corresponds to std::vector in C++
-pub struct CVec_u5Z {
+pub struct CVec_NodeAnnouncementZ {
/// 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::u5,
+ pub data: *mut crate::lightning::ln::msgs::NodeAnnouncement,
/// The number of elements pointed to by `data`.
pub datalen: usize
}
-impl CVec_u5Z {
- #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::u5> {
+impl CVec_NodeAnnouncementZ {
+ #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NodeAnnouncement> {
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::u5] {
+ #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NodeAnnouncement] {
unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
}
}
-impl From<Vec<crate::c_types::u5>> for CVec_u5Z {
- fn from(v: Vec<crate::c_types::u5>) -> Self {
+impl From<Vec<crate::lightning::ln::msgs::NodeAnnouncement>> for CVec_NodeAnnouncementZ {
+ fn from(v: Vec<crate::lightning::ln::msgs::NodeAnnouncement>) -> 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_u5Z_free(_res: CVec_u5Z) { }
-impl Drop for CVec_u5Z {
+pub extern "C" fn CVec_NodeAnnouncementZ_free(_res: CVec_NodeAnnouncementZ) { }
+impl Drop for CVec_NodeAnnouncementZ {
fn drop(&mut self) {
if self.datalen == 0 { return; }
unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
}
}
-impl Clone for CVec_u5Z {
+impl Clone for CVec_NodeAnnouncementZ {
fn clone(&self) -> Self {
let mut res = Vec::new();
if self.datalen == 0 { return Self::from(res); }
}
}
#[repr(C)]
-/// The contents of CResult_RecoverableSignatureNoneZ
-pub union CResult_RecoverableSignatureNoneZPtr {
- /// 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::RecoverableSignature,
- /// Note that this value is always NULL, as there are no contents in the Err variant
- pub err: *mut core::ffi::c_void,
+/// The contents of CResult_NoneLightningErrorZ
+pub union CResult_NoneLightningErrorZPtr {
+ /// 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::ln::msgs::LightningError,
}
#[repr(C)]
-/// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
-/// containing a crate::c_types::RecoverableSignature on success and a () on failure.
+/// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
+/// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult_RecoverableSignatureNoneZ {
- /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
+pub struct CResult_NoneLightningErrorZ {
+ /// The contents of this CResult_NoneLightningErrorZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_RecoverableSignatureNoneZPtr,
- /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
+ pub contents: CResult_NoneLightningErrorZPtr,
+ /// Whether this CResult_NoneLightningErrorZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
-pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
- CResult_RecoverableSignatureNoneZ {
- contents: CResult_RecoverableSignatureNoneZPtr {
- result: Box::into_raw(Box::new(o)),
+/// Creates a new CResult_NoneLightningErrorZ in the success state.
+pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
+ CResult_NoneLightningErrorZ {
+ contents: CResult_NoneLightningErrorZPtr {
+ result: core::ptr::null_mut(),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
-pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
- CResult_RecoverableSignatureNoneZ {
- contents: CResult_RecoverableSignatureNoneZPtr {
- err: core::ptr::null_mut(),
+/// Creates a new CResult_NoneLightningErrorZ in the error state.
+pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
+ CResult_NoneLightningErrorZ {
+ contents: CResult_NoneLightningErrorZPtr {
+ 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_RecoverableSignatureNoneZ_is_ok(o: &CResult_RecoverableSignatureNoneZ) -> bool {
+pub extern "C" fn CResult_NoneLightningErrorZ_is_ok(o: &CResult_NoneLightningErrorZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
-pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
-impl Drop for CResult_RecoverableSignatureNoneZ {
+/// Frees any resources used by the CResult_NoneLightningErrorZ.
+pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
+impl Drop for CResult_NoneLightningErrorZ {
fn drop(&mut self) {
if self.result_ok {
- if unsafe { !(self.contents.result as *mut ()).is_null() } {
- let _ = unsafe { Box::from_raw(self.contents.result) };
- }
} else {
+ if unsafe { !(self.contents.err as *mut ()).is_null() } {
+ let _ = unsafe { Box::from_raw(self.contents.err) };
+ }
}
}
}
-impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
+impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
let contents = if o.result_ok {
- let result = unsafe { o.contents.result };
- unsafe { o.contents.result = core::ptr::null_mut() };
- CResult_RecoverableSignatureNoneZPtr { result }
+ let _ = unsafe { Box::from_raw(o.contents.result) };
+ o.contents.result = core::ptr::null_mut();
+ CResult_NoneLightningErrorZPtr { result: core::ptr::null_mut() }
} else {
- let _ = unsafe { Box::from_raw(o.contents.err) };
- o.contents.err = core::ptr::null_mut();
- CResult_RecoverableSignatureNoneZPtr { err: core::ptr::null_mut() }
+ let err = unsafe { o.contents.err };
+ unsafe { o.contents.err = core::ptr::null_mut(); }
+ CResult_NoneLightningErrorZPtr { err }
};
Self {
contents,
}
}
}
-impl Clone for CResult_RecoverableSignatureNoneZ {
+impl Clone for CResult_NoneLightningErrorZ {
fn clone(&self) -> Self {
if self.result_ok {
- Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
- result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
+ Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
+ result: core::ptr::null_mut()
} }
} else {
- Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
- err: core::ptr::null_mut()
+ Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
+ err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
} }
}
}
}
#[no_mangle]
-/// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
+/// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { Clone::clone(&orig) }
+pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) }
#[repr(C)]
-/// A dynamically-allocated array of u8s of arbitrary size.
-/// This corresponds to std::vector in C++
-pub struct CVec_u8Z {
- /// The elements in the array.
- /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
- pub data: *mut u8,
- /// The number of elements pointed to by `data`.
- pub datalen: usize
-}
-impl CVec_u8Z {
- #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
- 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) -> &[u8] {
- unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
- }
+/// The contents of CResult_ChannelUpdateInfoDecodeErrorZ
+pub union CResult_ChannelUpdateInfoDecodeErrorZPtr {
+ /// A pointer to the contents in the success state.
+ /// Reading from this pointer when `result_ok` is not set is undefined.
+ pub result: *mut crate::lightning::routing::gossip::ChannelUpdateInfo,
+ /// 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,
}
-impl From<Vec<u8>> for CVec_u8Z {
- fn from(v: Vec<u8>) -> Self {
- let datalen = v.len();
- let data = Box::into_raw(v.into_boxed_slice());
- Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
- }
+#[repr(C)]
+/// A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
+/// containing a crate::lightning::routing::gossip::ChannelUpdateInfo 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_ChannelUpdateInfoDecodeErrorZ {
+ /// The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
+ /// `err` or `result` depending on the state of `result_ok`.
+ pub contents: CResult_ChannelUpdateInfoDecodeErrorZPtr,
+ /// Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
+ pub result_ok: bool,
}
#[no_mangle]
-/// Frees the buffer pointed to by `data` if `datalen` is non-0.
-pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
-impl Drop for CVec_u8Z {
- fn drop(&mut self) {
- if self.datalen == 0 { return; }
- unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
- }
-}
-impl Clone for CVec_u8Z {
- 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)
+/// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
+pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelUpdateInfo) -> CResult_ChannelUpdateInfoDecodeErrorZ {
+ CResult_ChannelUpdateInfoDecodeErrorZ {
+ contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
+ result: Box::into_raw(Box::new(o)),
+ },
+ result_ok: true,
}
}
-#[repr(C)]
-/// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
-/// This corresponds to std::vector in C++
-pub struct CVec_CVec_u8ZZ {
- /// 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::CVec_u8Z,
- /// The number of elements pointed to by `data`.
- pub datalen: usize
-}
-impl CVec_CVec_u8ZZ {
- #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
- 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::CVec_u8Z] {
- unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
+#[no_mangle]
+/// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
+pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateInfoDecodeErrorZ {
+ CResult_ChannelUpdateInfoDecodeErrorZ {
+ contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
+ err: Box::into_raw(Box::new(e)),
+ },
+ result_ok: false,
}
}
-impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
- fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
- let datalen = v.len();
- let data = Box::into_raw(v.into_boxed_slice());
- Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
- }
+/// Checks if the given object is currently in the success state
+#[no_mangle]
+pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateInfoDecodeErrorZ) -> bool {
+ o.result_ok
}
#[no_mangle]
-/// Frees the buffer pointed to by `data` if `datalen` is non-0.
-pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
-impl Drop for CVec_CVec_u8ZZ {
+/// Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
+pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_free(_res: CResult_ChannelUpdateInfoDecodeErrorZ) { }
+impl Drop for CResult_ChannelUpdateInfoDecodeErrorZ {
fn drop(&mut self) {
- if self.datalen == 0 { return; }
- unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
+ 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 Clone for CVec_CVec_u8ZZ {
+impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateInfoDecodeErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, 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_ChannelUpdateInfoDecodeErrorZPtr { result }
+ } else {
+ let err = unsafe { o.contents.err };
+ unsafe { o.contents.err = core::ptr::null_mut(); }
+ CResult_ChannelUpdateInfoDecodeErrorZPtr { err }
+ };
+ Self {
+ contents,
+ result_ok: o.result_ok,
+ }
+ }
+}
+impl Clone for CResult_ChannelUpdateInfoDecodeErrorZ {
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)
+ if self.result_ok {
+ Self { result_ok: true, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
+ result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelUpdateInfo>::clone(unsafe { &*self.contents.result })))
+ } }
+ } else {
+ Self { result_ok: false, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
+ err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
+ } }
+ }
}
}
+#[no_mangle]
+/// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
+/// but with all dynamically-allocated buffers duplicated in new buffers.
+pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig: &CResult_ChannelUpdateInfoDecodeErrorZ) -> CResult_ChannelUpdateInfoDecodeErrorZ { Clone::clone(&orig) }
#[repr(C)]
-/// The contents of CResult_CVec_CVec_u8ZZNoneZ
-pub union CResult_CVec_CVec_u8ZZNoneZPtr {
+/// The contents of CResult_ChannelInfoDecodeErrorZ
+pub union CResult_ChannelInfoDecodeErrorZPtr {
/// 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::CVec_CVec_u8ZZ,
- /// Note that this value is always NULL, as there are no contents in the Err variant
- pub err: *mut core::ffi::c_void,
+ pub result: *mut crate::lightning::routing::gossip::ChannelInfo,
+ /// 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_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
-/// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
+/// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
+/// containing a crate::lightning::routing::gossip::ChannelInfo 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_CVec_CVec_u8ZZNoneZ {
- /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
+pub struct CResult_ChannelInfoDecodeErrorZ {
+ /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
- /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
+ pub contents: CResult_ChannelInfoDecodeErrorZPtr,
+ /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
-pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
- CResult_CVec_CVec_u8ZZNoneZ {
- contents: CResult_CVec_CVec_u8ZZNoneZPtr {
+/// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
+pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
+ CResult_ChannelInfoDecodeErrorZ {
+ contents: CResult_ChannelInfoDecodeErrorZPtr {
result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
-pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
- CResult_CVec_CVec_u8ZZNoneZ {
- contents: CResult_CVec_CVec_u8ZZNoneZPtr {
- err: core::ptr::null_mut(),
+/// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
+pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
+ CResult_ChannelInfoDecodeErrorZ {
+ contents: CResult_ChannelInfoDecodeErrorZPtr {
+ 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_CVec_CVec_u8ZZNoneZ_is_ok(o: &CResult_CVec_CVec_u8ZZNoneZ) -> bool {
+pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_is_ok(o: &CResult_ChannelInfoDecodeErrorZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
-pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
-impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
+/// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
+pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
+impl Drop for CResult_ChannelInfoDecodeErrorZ {
fn drop(&mut self) {
if self.result_ok {
if unsafe { !(self.contents.result as *mut ()).is_null() } {
let _ = unsafe { Box::from_raw(self.contents.result) };
}
} else {
+ if unsafe { !(self.contents.err as *mut ()).is_null() } {
+ let _ = unsafe { Box::from_raw(self.contents.err) };
+ }
}
}
}
-impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>> for CResult_CVec_CVec_u8ZZNoneZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, 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_CVec_CVec_u8ZZNoneZPtr { result }
+ CResult_ChannelInfoDecodeErrorZPtr { result }
} else {
- let _ = unsafe { Box::from_raw(o.contents.err) };
- o.contents.err = core::ptr::null_mut();
- CResult_CVec_CVec_u8ZZNoneZPtr { err: core::ptr::null_mut() }
+ let err = unsafe { o.contents.err };
+ unsafe { o.contents.err = core::ptr::null_mut(); }
+ CResult_ChannelInfoDecodeErrorZPtr { err }
};
Self {
contents,
}
}
}
-impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
+impl Clone for CResult_ChannelInfoDecodeErrorZ {
fn clone(&self) -> Self {
if self.result_ok {
- Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
- result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
+ Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
+ result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelInfo>::clone(unsafe { &*self.contents.result })))
} }
} else {
- Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
- err: core::ptr::null_mut()
+ Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
+ err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
} }
}
}
}
#[no_mangle]
-/// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
+/// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { Clone::clone(&orig) }
+pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) }
#[repr(C)]
-/// The contents of CResult_InMemorySignerDecodeErrorZ
-pub union CResult_InMemorySignerDecodeErrorZPtr {
+/// The contents of CResult_RoutingFeesDecodeErrorZ
+pub union CResult_RoutingFeesDecodeErrorZPtr {
/// 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::chain::keysinterface::InMemorySigner,
+ pub result: *mut crate::lightning::routing::gossip::RoutingFees,
/// 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_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
-/// containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
+/// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
+/// containing a crate::lightning::routing::gossip::RoutingFees 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_InMemorySignerDecodeErrorZ {
- /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
+pub struct CResult_RoutingFeesDecodeErrorZ {
+ /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_InMemorySignerDecodeErrorZPtr,
- /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
+ pub contents: CResult_RoutingFeesDecodeErrorZPtr,
+ /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
-pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
- CResult_InMemorySignerDecodeErrorZ {
- contents: CResult_InMemorySignerDecodeErrorZPtr {
+/// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
+pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::gossip::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
+ CResult_RoutingFeesDecodeErrorZ {
+ contents: CResult_RoutingFeesDecodeErrorZPtr {
result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
-pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
- CResult_InMemorySignerDecodeErrorZ {
- contents: CResult_InMemorySignerDecodeErrorZPtr {
+/// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
+pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
+ CResult_RoutingFeesDecodeErrorZ {
+ contents: CResult_RoutingFeesDecodeErrorZPtr {
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_InMemorySignerDecodeErrorZ_is_ok(o: &CResult_InMemorySignerDecodeErrorZ) -> bool {
+pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_is_ok(o: &CResult_RoutingFeesDecodeErrorZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
-pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
-impl Drop for CResult_InMemorySignerDecodeErrorZ {
+/// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
+pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
+impl Drop for CResult_RoutingFeesDecodeErrorZ {
fn drop(&mut self) {
if self.result_ok {
if unsafe { !(self.contents.result as *mut ()).is_null() } {
}
}
}
-impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, 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_InMemorySignerDecodeErrorZPtr { result }
+ CResult_RoutingFeesDecodeErrorZPtr { result }
} else {
let err = unsafe { o.contents.err };
unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_InMemorySignerDecodeErrorZPtr { err }
+ CResult_RoutingFeesDecodeErrorZPtr { err }
};
Self {
contents,
}
}
}
-impl Clone for CResult_InMemorySignerDecodeErrorZ {
+impl Clone for CResult_RoutingFeesDecodeErrorZ {
fn clone(&self) -> Self {
if self.result_ok {
- Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
- result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
+ Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
+ result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::RoutingFees>::clone(unsafe { &*self.contents.result })))
} }
} else {
- Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
+ Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
} }
}
}
}
#[no_mangle]
-/// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
+/// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { Clone::clone(&orig) }
+pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) }
#[repr(C)]
-/// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
+/// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
/// This corresponds to std::vector in C++
-pub struct CVec_TxOutZ {
+pub struct CVec_NetAddressZ {
/// 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::TxOut,
+ pub data: *mut crate::lightning::ln::msgs::NetAddress,
/// The number of elements pointed to by `data`.
pub datalen: usize
}
-impl CVec_TxOutZ {
- #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
- if self.datalen == 0 { return Vec::new(); }
+impl CVec_NetAddressZ {
+ #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
+ 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::TxOut] {
+ #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
}
}
-impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
- fn from(v: Vec<crate::c_types::TxOut>) -> Self {
+impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
+ fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> 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_TxOutZ_free(_res: CVec_TxOutZ) { }
-impl Drop for CVec_TxOutZ {
+pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
+impl Drop for CVec_NetAddressZ {
fn drop(&mut self) {
if self.datalen == 0 { return; }
unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
}
}
-impl Clone for CVec_TxOutZ {
+impl Clone for CVec_NetAddressZ {
fn clone(&self) -> Self {
let mut res = Vec::new();
if self.datalen == 0 { return Self::from(res); }
}
}
#[repr(C)]
-/// The contents of CResult_TransactionNoneZ
-pub union CResult_TransactionNoneZPtr {
+/// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
+pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
/// 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::Transaction,
- /// Note that this value is always NULL, as there are no contents in the Err variant
- pub err: *mut core::ffi::c_void,
+ pub result: *mut crate::lightning::routing::gossip::NodeAnnouncementInfo,
+ /// 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_TransactionNoneZ represents the result of a fallible operation,
-/// containing a crate::c_types::Transaction on success and a () on failure.
+/// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
+/// containing a crate::lightning::routing::gossip::NodeAnnouncementInfo 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_TransactionNoneZ {
- /// The contents of this CResult_TransactionNoneZ, accessible via either
+pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
+ /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_TransactionNoneZPtr,
- /// Whether this CResult_TransactionNoneZ represents a success state.
+ pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
+ /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_TransactionNoneZ in the success state.
-pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
- CResult_TransactionNoneZ {
- contents: CResult_TransactionNoneZPtr {
+/// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
+pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
+ CResult_NodeAnnouncementInfoDecodeErrorZ {
+ contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_TransactionNoneZ in the error state.
-pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
- CResult_TransactionNoneZ {
- contents: CResult_TransactionNoneZPtr {
- err: core::ptr::null_mut(),
+/// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
+pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
+ CResult_NodeAnnouncementInfoDecodeErrorZ {
+ contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
+ 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_TransactionNoneZ_is_ok(o: &CResult_TransactionNoneZ) -> bool {
+pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_TransactionNoneZ.
-pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
-impl Drop for CResult_TransactionNoneZ {
+/// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
+pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
+impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
fn drop(&mut self) {
if self.result_ok {
if unsafe { !(self.contents.result as *mut ()).is_null() } {
let _ = unsafe { Box::from_raw(self.contents.result) };
}
} else {
+ if unsafe { !(self.contents.err as *mut ()).is_null() } {
+ let _ = unsafe { Box::from_raw(self.contents.err) };
+ }
}
}
}
-impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, 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_TransactionNoneZPtr { result }
+ CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
} else {
- let _ = unsafe { Box::from_raw(o.contents.err) };
- o.contents.err = core::ptr::null_mut();
- CResult_TransactionNoneZPtr { err: core::ptr::null_mut() }
+ let err = unsafe { o.contents.err };
+ unsafe { o.contents.err = core::ptr::null_mut(); }
+ CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
};
Self {
contents,
}
}
}
-impl Clone for CResult_TransactionNoneZ {
+impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
fn clone(&self) -> Self {
if self.result_ok {
- Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
- result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
+ Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
+ result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
} }
} else {
- Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
- err: core::ptr::null_mut()
+ Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
+ err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
} }
}
}
}
#[no_mangle]
-/// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
+/// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { Clone::clone(&orig) }
-#[repr(C)]
-/// A tuple of 2 elements. See the individual fields for the types contained.
-pub struct C2Tuple_BlockHashChannelMonitorZ {
- /// The element at position 0
- pub a: crate::c_types::ThirtyTwoBytes,
- /// The element at position 1
- pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
-}
-impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
- fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
- Self {
- a: tup.0,
- b: tup.1,
- }
- }
-}
-impl C2Tuple_BlockHashChannelMonitorZ {
- #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
- (self.a, self.b)
- }
-}
-/// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
-#[no_mangle]
-pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
- C2Tuple_BlockHashChannelMonitorZ { a, b, }
-}
-
-#[no_mangle]
-/// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
-pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
+pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) }
#[repr(C)]
-/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
+/// A dynamically-allocated array of u64s of arbitrary size.
/// This corresponds to std::vector in C++
-pub struct CVec_C2Tuple_BlockHashChannelMonitorZZ {
+pub struct CVec_u64Z {
/// 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::C2Tuple_BlockHashChannelMonitorZ,
+ pub data: *mut u64,
/// The number of elements pointed to by `data`.
pub datalen: usize
}
-impl CVec_C2Tuple_BlockHashChannelMonitorZZ {
- #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ> {
+impl CVec_u64Z {
+ #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
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::C2Tuple_BlockHashChannelMonitorZ] {
+ #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
}
}
-impl From<Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>> for CVec_C2Tuple_BlockHashChannelMonitorZZ {
- fn from(v: Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>) -> Self {
+impl From<Vec<u64>> for CVec_u64Z {
+ fn from(v: Vec<u64>) -> 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_C2Tuple_BlockHashChannelMonitorZZ_free(_res: CVec_C2Tuple_BlockHashChannelMonitorZZ) { }
-impl Drop for CVec_C2Tuple_BlockHashChannelMonitorZZ {
+pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
+impl Drop for CVec_u64Z {
fn drop(&mut self) {
if self.datalen == 0 { return; }
unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
}
}
+impl Clone for CVec_u64Z {
+ 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_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
-pub union CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
+/// The contents of CResult_NodeInfoDecodeErrorZ
+pub union CResult_NodeInfoDecodeErrorZPtr {
/// 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::CVec_C2Tuple_BlockHashChannelMonitorZZ,
+ pub result: *mut crate::lightning::routing::gossip::NodeInfo,
/// A pointer to the contents in the error state.
/// Reading from this pointer when `result_ok` is set is undefined.
- pub err: *mut crate::c_types::IOError,
+ pub err: *mut crate::lightning::ln::msgs::DecodeError,
}
#[repr(C)]
-/// A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
-/// containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
+/// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
+/// containing a crate::lightning::routing::gossip::NodeInfo 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_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
- /// The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
+pub struct CResult_NodeInfoDecodeErrorZ {
+ /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr,
- /// Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
+ pub contents: CResult_NodeInfoDecodeErrorZPtr,
+ /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
-pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
- CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
- contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
+/// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
+pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
+ CResult_NodeInfoDecodeErrorZ {
+ contents: CResult_NodeInfoDecodeErrorZPtr {
result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
-pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
- CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
- contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
+/// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
+pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
+ CResult_NodeInfoDecodeErrorZ {
+ contents: CResult_NodeInfoDecodeErrorZPtr {
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_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o: &CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) -> bool {
+pub extern "C" fn CResult_NodeInfoDecodeErrorZ_is_ok(o: &CResult_NodeInfoDecodeErrorZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
-pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) { }
-impl Drop for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
+/// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
+pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
+impl Drop for CResult_NodeInfoDecodeErrorZ {
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::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, 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_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { result }
+ CResult_NodeInfoDecodeErrorZPtr { result }
} else {
let err = unsafe { o.contents.err };
unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { err }
+ CResult_NodeInfoDecodeErrorZPtr { err }
};
Self {
contents,
}
}
}
-#[repr(C)]
-#[derive(Clone)]
-/// An enum which can either contain a u16 or not
-pub enum COption_u16Z {
- /// When we're in this state, this COption_u16Z contains a u16
- Some(u16),
- /// When we're in this state, this COption_u16Z contains nothing
- None
-}
-impl COption_u16Z {
- #[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) -> u16 {
- if let Self::Some(v) = self { v } else { unreachable!() }
+impl Clone for CResult_NodeInfoDecodeErrorZ {
+ fn clone(&self) -> Self {
+ if self.result_ok {
+ Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
+ result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeInfo>::clone(unsafe { &*self.contents.result })))
+ } }
+ } else {
+ Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
+ err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
+ } }
+ }
}
}
#[no_mangle]
-/// Constructs a new COption_u16Z containing a u16
-pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
- COption_u16Z::Some(o)
-}
-#[no_mangle]
-/// Constructs a new COption_u16Z containing nothing
-pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
- COption_u16Z::None
-}
-#[no_mangle]
-/// Frees any resources associated with the u16, if we are in the Some state
-pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
-#[no_mangle]
-/// Creates a new COption_u16Z which has the same data as `orig`
+/// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) }
+pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) }
#[repr(C)]
-/// The contents of CResult_NoneAPIErrorZ
-pub union CResult_NoneAPIErrorZPtr {
- /// Note that this value is always NULL, as there are no contents in the OK variant
- pub result: *mut core::ffi::c_void,
+/// The contents of CResult_NetworkGraphDecodeErrorZ
+pub union CResult_NetworkGraphDecodeErrorZPtr {
+ /// A pointer to the contents in the success state.
+ /// Reading from this pointer when `result_ok` is not set is undefined.
+ pub result: *mut crate::lightning::routing::gossip::NetworkGraph,
/// A pointer to the contents in the error state.
/// Reading from this pointer when `result_ok` is set is undefined.
- pub err: *mut crate::lightning::util::errors::APIError,
+ pub err: *mut crate::lightning::ln::msgs::DecodeError,
}
#[repr(C)]
-/// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
-/// containing a () on success and a crate::lightning::util::errors::APIError on failure.
+/// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
+/// containing a crate::lightning::routing::gossip::NetworkGraph 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_NoneAPIErrorZ {
- /// The contents of this CResult_NoneAPIErrorZ, accessible via either
+pub struct CResult_NetworkGraphDecodeErrorZ {
+ /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_NoneAPIErrorZPtr,
- /// Whether this CResult_NoneAPIErrorZ represents a success state.
+ pub contents: CResult_NetworkGraphDecodeErrorZPtr,
+ /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_NoneAPIErrorZ in the success state.
-pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
- CResult_NoneAPIErrorZ {
- contents: CResult_NoneAPIErrorZPtr {
- result: core::ptr::null_mut(),
+/// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
+pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
+ CResult_NetworkGraphDecodeErrorZ {
+ contents: CResult_NetworkGraphDecodeErrorZPtr {
+ result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_NoneAPIErrorZ in the error state.
-pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
- CResult_NoneAPIErrorZ {
- contents: CResult_NoneAPIErrorZPtr {
+/// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
+pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
+ CResult_NetworkGraphDecodeErrorZ {
+ contents: CResult_NetworkGraphDecodeErrorZPtr {
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_NoneAPIErrorZ_is_ok(o: &CResult_NoneAPIErrorZ) -> bool {
+pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_is_ok(o: &CResult_NetworkGraphDecodeErrorZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_NoneAPIErrorZ.
-pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
-impl Drop for CResult_NoneAPIErrorZ {
+/// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
+pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
+impl Drop for CResult_NetworkGraphDecodeErrorZ {
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::util::errors::APIError>> for CResult_NoneAPIErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
let contents = if o.result_ok {
- let _ = unsafe { Box::from_raw(o.contents.result) };
- o.contents.result = core::ptr::null_mut();
- CResult_NoneAPIErrorZPtr { result: core::ptr::null_mut() }
+ let result = unsafe { o.contents.result };
+ unsafe { o.contents.result = core::ptr::null_mut() };
+ CResult_NetworkGraphDecodeErrorZPtr { result }
} else {
let err = unsafe { o.contents.err };
unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_NoneAPIErrorZPtr { err }
+ CResult_NetworkGraphDecodeErrorZPtr { err }
};
Self {
contents,
}
}
}
-impl Clone for CResult_NoneAPIErrorZ {
- fn clone(&self) -> Self {
- if self.result_ok {
- Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
- result: core::ptr::null_mut()
- } }
- } else {
- Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
- err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
- } }
- }
- }
-}
-#[no_mangle]
-/// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
-/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { Clone::clone(&orig) }
#[repr(C)]
-/// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
-/// This corresponds to std::vector in C++
-pub struct CVec_CResult_NoneAPIErrorZZ {
- /// 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::CResult_NoneAPIErrorZ,
- /// The number of elements pointed to by `data`.
- pub datalen: usize
+#[derive(Clone)]
+/// An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
+pub enum COption_CVec_NetAddressZZ {
+ /// When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
+ Some(crate::c_types::derived::CVec_NetAddressZ),
+ /// When we're in this state, this COption_CVec_NetAddressZZ contains nothing
+ None
}
-impl CVec_CResult_NoneAPIErrorZZ {
- #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
- 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
+impl COption_CVec_NetAddressZZ {
+ #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
+ if let Self::None = self { false } else { true }
}
- #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
- unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
+ #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
+ !self.is_some()
}
-}
-impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
- fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
- let datalen = v.len();
- let data = Box::into_raw(v.into_boxed_slice());
- Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
+ #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_NetAddressZ {
+ if let Self::Some(v) = self { v } else { unreachable!() }
}
}
#[no_mangle]
-/// Frees the buffer pointed to by `data` if `datalen` is non-0.
-pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
-impl Drop for CVec_CResult_NoneAPIErrorZZ {
- fn drop(&mut self) {
- if self.datalen == 0 { return; }
- unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
- }
-}
-impl Clone for CVec_CResult_NoneAPIErrorZZ {
- 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)]
-/// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
-/// This corresponds to std::vector in C++
-pub struct CVec_APIErrorZ {
- /// 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::util::errors::APIError,
- /// The number of elements pointed to by `data`.
- pub datalen: usize
-}
-impl CVec_APIErrorZ {
- #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
- 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::util::errors::APIError] {
- unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
- }
-}
-impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
- fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
- let datalen = v.len();
- let data = Box::into_raw(v.into_boxed_slice());
- Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
- }
+/// Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
+pub extern "C" fn COption_CVec_NetAddressZZ_some(o: crate::c_types::derived::CVec_NetAddressZ) -> COption_CVec_NetAddressZZ {
+ COption_CVec_NetAddressZZ::Some(o)
}
#[no_mangle]
-/// Frees the buffer pointed to by `data` if `datalen` is non-0.
-pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
-impl Drop for CVec_APIErrorZ {
- fn drop(&mut self) {
- if self.datalen == 0 { return; }
- unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
- }
-}
-impl Clone for CVec_APIErrorZ {
- 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)
- }
+/// Constructs a new COption_CVec_NetAddressZZ containing nothing
+pub extern "C" fn COption_CVec_NetAddressZZ_none() -> COption_CVec_NetAddressZZ {
+ COption_CVec_NetAddressZZ::None
}
+#[no_mangle]
+/// Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
+pub extern "C" fn COption_CVec_NetAddressZZ_free(_res: COption_CVec_NetAddressZZ) { }
+#[no_mangle]
+/// Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
+/// but with all dynamically-allocated buffers duplicated in new buffers.
+pub extern "C" fn COption_CVec_NetAddressZZ_clone(orig: &COption_CVec_NetAddressZZ) -> COption_CVec_NetAddressZZ { Clone::clone(&orig) }
#[repr(C)]
-/// The contents of CResult__u832APIErrorZ
-pub union CResult__u832APIErrorZPtr {
+/// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
+pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
/// A pointer to the contents in the success state.
/// Reading from this pointer when `result_ok` is not set is undefined.
- pub result: *mut crate::c_types::ThirtyTwoBytes,
+ pub result: *mut crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor,
/// A pointer to the contents in the error state.
/// Reading from this pointer when `result_ok` is set is undefined.
- pub err: *mut crate::lightning::util::errors::APIError,
+ pub err: *mut crate::lightning::ln::msgs::DecodeError,
}
#[repr(C)]
-/// A CResult__u832APIErrorZ represents the result of a fallible operation,
-/// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
+/// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
+/// containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult__u832APIErrorZ {
- /// The contents of this CResult__u832APIErrorZ, accessible via either
+pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
+ /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult__u832APIErrorZPtr,
- /// Whether this CResult__u832APIErrorZ represents a success state.
+ pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr,
+ /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult__u832APIErrorZ in the success state.
-pub extern "C" fn CResult__u832APIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult__u832APIErrorZ {
- CResult__u832APIErrorZ {
- contents: CResult__u832APIErrorZPtr {
+/// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
+pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
+ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
+ contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult__u832APIErrorZ in the error state.
-pub extern "C" fn CResult__u832APIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult__u832APIErrorZ {
- CResult__u832APIErrorZ {
- contents: CResult__u832APIErrorZPtr {
+/// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
+pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
+ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
+ contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
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__u832APIErrorZ_is_ok(o: &CResult__u832APIErrorZ) -> bool {
+pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult__u832APIErrorZ.
-pub extern "C" fn CResult__u832APIErrorZ_free(_res: CResult__u832APIErrorZ) { }
-impl Drop for CResult__u832APIErrorZ {
+/// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
+pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { }
+impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
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::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult__u832APIErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, 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__u832APIErrorZPtr { result }
+ CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result }
} else {
let err = unsafe { o.contents.err };
unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult__u832APIErrorZPtr { err }
+ CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err }
};
Self {
contents,
}
}
}
-impl Clone for CResult__u832APIErrorZ {
+impl Clone for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
fn clone(&self) -> Self {
if self.result_ok {
- Self { result_ok: true, contents: CResult__u832APIErrorZPtr {
- result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
+ Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
+ result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
} }
} else {
- Self { result_ok: false, contents: CResult__u832APIErrorZPtr {
- err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
+ Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
+ err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
} }
}
}
}
#[no_mangle]
-/// Creates a new CResult__u832APIErrorZ which has the same data as `orig`
+/// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult__u832APIErrorZ_clone(orig: &CResult__u832APIErrorZ) -> CResult__u832APIErrorZ { Clone::clone(&orig) }
+pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
#[repr(C)]
-/// The contents of CResult_PaymentIdPaymentSendFailureZ
-pub union CResult_PaymentIdPaymentSendFailureZPtr {
+/// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
+pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
/// A pointer to the contents in the success state.
/// Reading from this pointer when `result_ok` is not set is undefined.
- pub result: *mut crate::c_types::ThirtyTwoBytes,
+ pub result: *mut crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor,
/// 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::channelmanager::PaymentSendFailure,
+ pub err: *mut crate::lightning::ln::msgs::DecodeError,
}
#[repr(C)]
-/// A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation,
-/// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
+/// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
+/// containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult_PaymentIdPaymentSendFailureZ {
- /// The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either
+pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
+ /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_PaymentIdPaymentSendFailureZPtr,
- /// Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state.
+ pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr,
+ /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state.
-pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentSendFailureZ {
- CResult_PaymentIdPaymentSendFailureZ {
- contents: CResult_PaymentIdPaymentSendFailureZPtr {
+/// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
+pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
+ CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
+ contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state.
-pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_PaymentIdPaymentSendFailureZ {
- CResult_PaymentIdPaymentSendFailureZ {
- contents: CResult_PaymentIdPaymentSendFailureZPtr {
+/// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
+pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
+ CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
+ contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
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_PaymentIdPaymentSendFailureZ_is_ok(o: &CResult_PaymentIdPaymentSendFailureZ) -> bool {
+pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ.
-pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_free(_res: CResult_PaymentIdPaymentSendFailureZ) { }
-impl Drop for CResult_PaymentIdPaymentSendFailureZ {
+/// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
+pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { }
+impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
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::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_PaymentIdPaymentSendFailureZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, 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_PaymentIdPaymentSendFailureZPtr { result }
+ CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result }
} else {
let err = unsafe { o.contents.err };
unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_PaymentIdPaymentSendFailureZPtr { err }
+ CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err }
};
Self {
contents,
}
}
}
-impl Clone for CResult_PaymentIdPaymentSendFailureZ {
+impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
fn clone(&self) -> Self {
if self.result_ok {
- Self { result_ok: true, contents: CResult_PaymentIdPaymentSendFailureZPtr {
- result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
+ Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
+ result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
} }
} else {
- Self { result_ok: false, contents: CResult_PaymentIdPaymentSendFailureZPtr {
- err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
+ Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
+ err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
} }
}
}
}
#[no_mangle]
-/// Creates a new CResult_PaymentIdPaymentSendFailureZ which has the same data as `orig`
+/// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_clone(orig: &CResult_PaymentIdPaymentSendFailureZ) -> CResult_PaymentIdPaymentSendFailureZ { Clone::clone(&orig) }
+pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
#[repr(C)]
-/// The contents of CResult_NonePaymentSendFailureZ
-pub union CResult_NonePaymentSendFailureZPtr {
- /// Note that this value is always NULL, as there are no contents in the OK variant
- pub result: *mut core::ffi::c_void,
+/// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
+pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
+ /// 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::chain::keysinterface::SpendableOutputDescriptor,
/// 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::channelmanager::PaymentSendFailure,
+ pub err: *mut crate::lightning::ln::msgs::DecodeError,
}
#[repr(C)]
-/// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
-/// containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
+/// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
+/// containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult_NonePaymentSendFailureZ {
- /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
+pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
+ /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_NonePaymentSendFailureZPtr,
- /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
+ pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
+ /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_NonePaymentSendFailureZ in the success state.
-pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
- CResult_NonePaymentSendFailureZ {
- contents: CResult_NonePaymentSendFailureZPtr {
- result: core::ptr::null_mut(),
+/// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
+pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
+ CResult_SpendableOutputDescriptorDecodeErrorZ {
+ contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
+ result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_NonePaymentSendFailureZ in the error state.
-pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
- CResult_NonePaymentSendFailureZ {
- contents: CResult_NonePaymentSendFailureZPtr {
+/// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
+pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
+ CResult_SpendableOutputDescriptorDecodeErrorZ {
+ contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
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_NonePaymentSendFailureZ_is_ok(o: &CResult_NonePaymentSendFailureZ) -> bool {
+pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_NonePaymentSendFailureZ.
-pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
-impl Drop for CResult_NonePaymentSendFailureZ {
+/// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
+pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
+impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
fn drop(&mut self) {
if self.result_ok {
+ if unsafe { !(self.contents.result as *mut ()).is_null() } {
+ let _ = unsafe { Box::from_raw(self.contents.result) };
+ }
} else {
if unsafe { !(self.contents.err as *mut ()).is_null() } {
let _ = unsafe { Box::from_raw(self.contents.err) };
}
}
}
-impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
- fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
let contents = if o.result_ok {
- let _ = unsafe { Box::from_raw(o.contents.result) };
- o.contents.result = core::ptr::null_mut();
- CResult_NonePaymentSendFailureZPtr { result: core::ptr::null_mut() }
+ let result = unsafe { o.contents.result };
+ unsafe { o.contents.result = core::ptr::null_mut() };
+ CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
} else {
let err = unsafe { o.contents.err };
unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_NonePaymentSendFailureZPtr { err }
+ CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
};
Self {
contents,
}
}
}
-impl Clone for CResult_NonePaymentSendFailureZ {
+impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
fn clone(&self) -> Self {
if self.result_ok {
- Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
- result: core::ptr::null_mut()
+ Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
+ result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
} }
} else {
- Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
- err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
+ Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
+ err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
} }
}
}
}
#[no_mangle]
-/// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
+/// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { Clone::clone(&orig) }
+pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
+#[repr(C)]
+/// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
+/// This corresponds to std::vector in C++
+pub struct CVec_PaymentPreimageZ {
+ /// 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::ThirtyTwoBytes,
+ /// The number of elements pointed to by `data`.
+ pub datalen: usize
+}
+impl CVec_PaymentPreimageZ {
+ #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
+ 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::ThirtyTwoBytes] {
+ unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
+ }
+}
+impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_PaymentPreimageZ {
+ fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> 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_PaymentPreimageZ_free(_res: CVec_PaymentPreimageZ) { }
+impl Drop for CVec_PaymentPreimageZ {
+ fn drop(&mut self) {
+ if self.datalen == 0 { return; }
+ unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
+ }
+}
+impl Clone for CVec_PaymentPreimageZ {
+ 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)]
/// A tuple of 2 elements. See the individual fields for the types contained.
-pub struct C2Tuple_PaymentHashPaymentIdZ {
+pub struct C2Tuple_SignatureCVec_SignatureZZ {
/// The element at position 0
- pub a: crate::c_types::ThirtyTwoBytes,
+ pub a: crate::c_types::Signature,
/// The element at position 1
- pub b: crate::c_types::ThirtyTwoBytes,
+ pub b: crate::c_types::derived::CVec_SignatureZ,
}
-impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentIdZ {
- fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
+impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
+ fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
Self {
a: tup.0,
b: tup.1,
}
}
}
-impl C2Tuple_PaymentHashPaymentIdZ {
- #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
+impl C2Tuple_SignatureCVec_SignatureZZ {
+ #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
(self.a, self.b)
}
}
-impl Clone for C2Tuple_PaymentHashPaymentIdZ {
+impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
fn clone(&self) -> Self {
Self {
a: Clone::clone(&self.a),
#[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 C2Tuple_PaymentHashPaymentIdZ_clone(orig: &C2Tuple_PaymentHashPaymentIdZ) -> C2Tuple_PaymentHashPaymentIdZ { Clone::clone(&orig) }
-/// Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
+pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { Clone::clone(&orig) }
+/// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
#[no_mangle]
-pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentIdZ {
- C2Tuple_PaymentHashPaymentIdZ { a, b, }
+pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
+ C2Tuple_SignatureCVec_SignatureZZ { a, b, }
}
#[no_mangle]
-/// Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
-pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_free(_res: C2Tuple_PaymentHashPaymentIdZ) { }
+/// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
+pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
#[repr(C)]
-/// The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
-pub union CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
+/// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
+pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
/// A pointer to the contents in the success state.
/// Reading from this pointer when `result_ok` is not set is undefined.
- pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ,
- /// 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::channelmanager::PaymentSendFailure,
+ pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
+ /// 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_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
-/// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
+/// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
+/// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
- /// The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
+pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
+ /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr,
- /// Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
+ pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
+ /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
-pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
- CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
- contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
+/// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
+pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
+ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
+ contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
-pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
- CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
- contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
- err: Box::into_raw(Box::new(e)),
+/// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
+pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
+ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
+ contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
+ 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_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> bool {
+pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
-pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) { }
-impl Drop for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
+/// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
+pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
+impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
fn drop(&mut self) {
if self.result_ok {
if unsafe { !(self.contents.result as *mut ()).is_null() } {
let _ = unsafe { Box::from_raw(self.contents.result) };
}
} else {
- if unsafe { !(self.contents.err as *mut ()).is_null() } {
- let _ = unsafe { Box::from_raw(self.contents.err) };
- }
}
}
}
-impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>) -> Self {
let contents = if o.result_ok {
let result = unsafe { o.contents.result };
unsafe { o.contents.result = core::ptr::null_mut() };
- CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { result }
+ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
} else {
- let err = unsafe { o.contents.err };
- unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { err }
- };
+ let _ = unsafe { Box::from_raw(o.contents.err) };
+ o.contents.err = core::ptr::null_mut();
+ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: core::ptr::null_mut() }
+ };
Self {
contents,
result_ok: o.result_ok,
}
}
}
-impl Clone for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
+impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
fn clone(&self) -> Self {
if self.result_ok {
- Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
- result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ>::clone(unsafe { &*self.contents.result })))
+ Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
+ result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
} }
} else {
- Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
- err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
+ Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
+ err: core::ptr::null_mut()
} }
}
}
}
#[no_mangle]
-/// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
+/// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { Clone::clone(&orig) }
+pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { Clone::clone(&orig) }
#[repr(C)]
-/// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
-/// This corresponds to std::vector in C++
-pub struct CVec_NetAddressZ {
- /// 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::ln::msgs::NetAddress,
- /// The number of elements pointed to by `data`.
- pub datalen: usize
+/// The contents of CResult_SignatureNoneZ
+pub union CResult_SignatureNoneZPtr {
+ /// 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::Signature,
+ /// Note that this value is always NULL, as there are no contents in the Err variant
+ pub err: *mut core::ffi::c_void,
}
-impl CVec_NetAddressZ {
- #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
- 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::ln::msgs::NetAddress] {
- unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
+#[repr(C)]
+/// A CResult_SignatureNoneZ represents the result of a fallible operation,
+/// containing a crate::c_types::Signature on success and a () on failure.
+/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
+pub struct CResult_SignatureNoneZ {
+ /// The contents of this CResult_SignatureNoneZ, accessible via either
+ /// `err` or `result` depending on the state of `result_ok`.
+ pub contents: CResult_SignatureNoneZPtr,
+ /// Whether this CResult_SignatureNoneZ represents a success state.
+ pub result_ok: bool,
+}
+#[no_mangle]
+/// Creates a new CResult_SignatureNoneZ in the success state.
+pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
+ CResult_SignatureNoneZ {
+ contents: CResult_SignatureNoneZPtr {
+ result: Box::into_raw(Box::new(o)),
+ },
+ result_ok: true,
}
}
-impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
- fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
- let datalen = v.len();
- let data = Box::into_raw(v.into_boxed_slice());
- Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
+#[no_mangle]
+/// Creates a new CResult_SignatureNoneZ in the error state.
+pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
+ CResult_SignatureNoneZ {
+ contents: CResult_SignatureNoneZPtr {
+ err: core::ptr::null_mut(),
+ },
+ result_ok: false,
}
}
+/// Checks if the given object is currently in the success state
#[no_mangle]
-/// Frees the buffer pointed to by `data` if `datalen` is non-0.
-pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
-impl Drop for CVec_NetAddressZ {
+pub extern "C" fn CResult_SignatureNoneZ_is_ok(o: &CResult_SignatureNoneZ) -> bool {
+ o.result_ok
+}
+#[no_mangle]
+/// Frees any resources used by the CResult_SignatureNoneZ.
+pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
+impl Drop for CResult_SignatureNoneZ {
fn drop(&mut self) {
- if self.datalen == 0 { return; }
- unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
+ if self.result_ok {
+ if unsafe { !(self.contents.result as *mut ()).is_null() } {
+ let _ = unsafe { Box::from_raw(self.contents.result) };
+ }
+ } else {
+ }
}
}
-impl Clone for CVec_NetAddressZ {
+impl From<crate::c_types::CResultTempl<crate::c_types::Signature, ()>> for CResult_SignatureNoneZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, ()>) -> Self {
+ let contents = if o.result_ok {
+ let result = unsafe { o.contents.result };
+ unsafe { o.contents.result = core::ptr::null_mut() };
+ CResult_SignatureNoneZPtr { result }
+ } else {
+ let _ = unsafe { Box::from_raw(o.contents.err) };
+ o.contents.err = core::ptr::null_mut();
+ CResult_SignatureNoneZPtr { err: core::ptr::null_mut() }
+ };
+ Self {
+ contents,
+ result_ok: o.result_ok,
+ }
+ }
+}
+impl Clone for CResult_SignatureNoneZ {
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)
+ if self.result_ok {
+ Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
+ result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
+ } }
+ } else {
+ Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
+ err: core::ptr::null_mut()
+ } }
+ }
}
}
+#[no_mangle]
+/// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
+/// but with all dynamically-allocated buffers duplicated in new buffers.
+pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { Clone::clone(&orig) }
#[repr(C)]
/// A tuple of 2 elements. See the individual fields for the types contained.
-pub struct C2Tuple_PaymentHashPaymentSecretZ {
+pub struct C2Tuple_SignatureSignatureZ {
/// The element at position 0
- pub a: crate::c_types::ThirtyTwoBytes,
+ pub a: crate::c_types::Signature,
/// The element at position 1
- pub b: crate::c_types::ThirtyTwoBytes,
+ pub b: crate::c_types::Signature,
}
-impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentSecretZ {
- fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
+impl From<(crate::c_types::Signature, crate::c_types::Signature)> for C2Tuple_SignatureSignatureZ {
+ fn from (tup: (crate::c_types::Signature, crate::c_types::Signature)) -> Self {
Self {
a: tup.0,
b: tup.1,
}
}
}
-impl C2Tuple_PaymentHashPaymentSecretZ {
- #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
+impl C2Tuple_SignatureSignatureZ {
+ #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::Signature) {
(self.a, self.b)
}
}
-impl Clone for C2Tuple_PaymentHashPaymentSecretZ {
+impl Clone for C2Tuple_SignatureSignatureZ {
fn clone(&self) -> Self {
Self {
a: Clone::clone(&self.a),
#[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 C2Tuple_PaymentHashPaymentSecretZ_clone(orig: &C2Tuple_PaymentHashPaymentSecretZ) -> C2Tuple_PaymentHashPaymentSecretZ { Clone::clone(&orig) }
-/// Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
+pub extern "C" fn C2Tuple_SignatureSignatureZ_clone(orig: &C2Tuple_SignatureSignatureZ) -> C2Tuple_SignatureSignatureZ { Clone::clone(&orig) }
+/// Creates a new C2Tuple_SignatureSignatureZ from the contained elements.
#[no_mangle]
-pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentSecretZ {
- C2Tuple_PaymentHashPaymentSecretZ { a, b, }
+pub extern "C" fn C2Tuple_SignatureSignatureZ_new(a: crate::c_types::Signature, b: crate::c_types::Signature) -> C2Tuple_SignatureSignatureZ {
+ C2Tuple_SignatureSignatureZ { a, b, }
}
#[no_mangle]
-/// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
-pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { }
+/// Frees any resources used by the C2Tuple_SignatureSignatureZ.
+pub extern "C" fn C2Tuple_SignatureSignatureZ_free(_res: C2Tuple_SignatureSignatureZ) { }
#[repr(C)]
-/// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ
-pub union CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
+/// The contents of CResult_C2Tuple_SignatureSignatureZNoneZ
+pub union CResult_C2Tuple_SignatureSignatureZNoneZPtr {
/// A pointer to the contents in the success state.
/// Reading from this pointer when `result_ok` is not set is undefined.
- pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
+ pub result: *mut crate::c_types::derived::C2Tuple_SignatureSignatureZ,
/// 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_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation,
-/// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure.
+/// A CResult_C2Tuple_SignatureSignatureZNoneZ represents the result of a fallible operation,
+/// containing a crate::c_types::derived::C2Tuple_SignatureSignatureZ on success and a () on failure.
/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
- /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either
+pub struct CResult_C2Tuple_SignatureSignatureZNoneZ {
+ /// The contents of this CResult_C2Tuple_SignatureSignatureZNoneZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr,
- /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state.
+ pub contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr,
+ /// Whether this CResult_C2Tuple_SignatureSignatureZNoneZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state.
-pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
- CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
- contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
+/// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the success state.
+pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureSignatureZ) -> CResult_C2Tuple_SignatureSignatureZNoneZ {
+ CResult_C2Tuple_SignatureSignatureZNoneZ {
+ contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state.
-pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
- CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
- contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
+/// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the error state.
+pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_err() -> CResult_C2Tuple_SignatureSignatureZNoneZ {
+ CResult_C2Tuple_SignatureSignatureZNoneZ {
+ contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
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_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> bool {
+pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureSignatureZNoneZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ.
-pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) { }
-impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
+/// Frees any resources used by the CResult_C2Tuple_SignatureSignatureZNoneZ.
+pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_free(_res: CResult_C2Tuple_SignatureSignatureZNoneZ) { }
+impl Drop for CResult_C2Tuple_SignatureSignatureZNoneZ {
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::C2Tuple_PaymentHashPaymentSecretZ, ()>> for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureSignatureZ, ()>> for CResult_C2Tuple_SignatureSignatureZNoneZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureSignatureZ, ()>) -> Self {
let contents = if o.result_ok {
let result = unsafe { o.contents.result };
unsafe { o.contents.result = core::ptr::null_mut() };
- CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { result }
+ CResult_C2Tuple_SignatureSignatureZNoneZPtr { result }
} else {
let _ = unsafe { Box::from_raw(o.contents.err) };
o.contents.err = core::ptr::null_mut();
- CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { err: core::ptr::null_mut() }
+ CResult_C2Tuple_SignatureSignatureZNoneZPtr { err: core::ptr::null_mut() }
};
Self {
contents,
}
}
}
-impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
+impl Clone for CResult_C2Tuple_SignatureSignatureZNoneZ {
fn clone(&self) -> Self {
if self.result_ok {
- Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
- result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
+ Self { result_ok: true, contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
+ result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureSignatureZ>::clone(unsafe { &*self.contents.result })))
} }
} else {
- Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
+ Self { result_ok: false, contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
err: core::ptr::null_mut()
} }
}
}
}
#[no_mangle]
-/// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig`
+/// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ which has the same data as `orig`
/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ { Clone::clone(&orig) }
+pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_clone(orig: &CResult_C2Tuple_SignatureSignatureZNoneZ) -> CResult_C2Tuple_SignatureSignatureZNoneZ { Clone::clone(&orig) }
#[repr(C)]
-/// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ
-pub union CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
+/// The contents of CResult_SecretKeyNoneZ
+pub union CResult_SecretKeyNoneZPtr {
/// A pointer to the contents in the success state.
/// Reading from this pointer when `result_ok` is not set is undefined.
- pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
- /// A pointer to the contents in the error state.
- /// Reading from this pointer when `result_ok` is set is undefined.
- pub err: *mut crate::lightning::util::errors::APIError,
+ pub result: *mut crate::c_types::SecretKey,
+ /// 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_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents the result of a fallible operation,
-/// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a crate::lightning::util::errors::APIError on failure.
+/// A CResult_SecretKeyNoneZ represents the result of a fallible operation,
+/// containing a crate::c_types::SecretKey on success and a () on failure.
/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
- /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ, accessible via either
+pub struct CResult_SecretKeyNoneZ {
+ /// The contents of this CResult_SecretKeyNoneZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr,
- /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents a success state.
+ pub contents: CResult_SecretKeyNoneZPtr,
+ /// Whether this CResult_SecretKeyNoneZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state.
-pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
- CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
- contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
+/// Creates a new CResult_SecretKeyNoneZ in the success state.
+pub extern "C" fn CResult_SecretKeyNoneZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeyNoneZ {
+ CResult_SecretKeyNoneZ {
+ contents: CResult_SecretKeyNoneZPtr {
result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state.
-pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
- CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
- contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
- err: Box::into_raw(Box::new(e)),
+/// Creates a new CResult_SecretKeyNoneZ in the error state.
+pub extern "C" fn CResult_SecretKeyNoneZ_err() -> CResult_SecretKeyNoneZ {
+ CResult_SecretKeyNoneZ {
+ contents: CResult_SecretKeyNoneZPtr {
+ 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_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> bool {
+pub extern "C" fn CResult_SecretKeyNoneZ_is_ok(o: &CResult_SecretKeyNoneZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.
-pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) { }
-impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
+/// Frees any resources used by the CResult_SecretKeyNoneZ.
+pub extern "C" fn CResult_SecretKeyNoneZ_free(_res: CResult_SecretKeyNoneZ) { }
+impl Drop for CResult_SecretKeyNoneZ {
fn drop(&mut self) {
if self.result_ok {
if unsafe { !(self.contents.result as *mut ()).is_null() } {
let _ = unsafe { Box::from_raw(self.contents.result) };
}
} else {
- if unsafe { !(self.contents.err as *mut ()).is_null() } {
- let _ = unsafe { Box::from_raw(self.contents.err) };
- }
}
}
}
-impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>> for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::c_types::SecretKey, ()>> for CResult_SecretKeyNoneZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, ()>) -> Self {
let contents = if o.result_ok {
let result = unsafe { o.contents.result };
unsafe { o.contents.result = core::ptr::null_mut() };
- CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { result }
+ CResult_SecretKeyNoneZPtr { result }
} else {
- let err = unsafe { o.contents.err };
- unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { err }
+ let _ = unsafe { Box::from_raw(o.contents.err) };
+ o.contents.err = core::ptr::null_mut();
+ CResult_SecretKeyNoneZPtr { err: core::ptr::null_mut() }
};
Self {
contents,
}
}
}
-impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
+impl Clone for CResult_SecretKeyNoneZ {
fn clone(&self) -> Self {
if self.result_ok {
- Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
- result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
+ Self { result_ok: true, contents: CResult_SecretKeyNoneZPtr {
+ result: Box::into_raw(Box::new(<crate::c_types::SecretKey>::clone(unsafe { &*self.contents.result })))
} }
} else {
- Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
- err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
+ Self { result_ok: false, contents: CResult_SecretKeyNoneZPtr {
+ err: core::ptr::null_mut()
} }
}
}
}
#[no_mangle]
-/// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig`
+/// Creates a new CResult_SecretKeyNoneZ which has the same data as `orig`
/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ { Clone::clone(&orig) }
+pub extern "C" fn CResult_SecretKeyNoneZ_clone(orig: &CResult_SecretKeyNoneZ) -> CResult_SecretKeyNoneZ { Clone::clone(&orig) }
#[repr(C)]
-/// The contents of CResult_PaymentSecretNoneZ
-pub union CResult_PaymentSecretNoneZPtr {
+/// The contents of CResult_SignDecodeErrorZ
+pub union CResult_SignDecodeErrorZPtr {
/// A pointer to the contents in the success state.
/// Reading from this pointer when `result_ok` is not set is undefined.
- pub result: *mut crate::c_types::ThirtyTwoBytes,
- /// Note that this value is always NULL, as there are no contents in the Err variant
- pub err: *mut core::ffi::c_void,
+ pub result: *mut crate::lightning::chain::keysinterface::Sign,
+ /// 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_PaymentSecretNoneZ represents the result of a fallible operation,
-/// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
+/// A CResult_SignDecodeErrorZ represents the result of a fallible operation,
+/// containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult_PaymentSecretNoneZ {
- /// The contents of this CResult_PaymentSecretNoneZ, accessible via either
+pub struct CResult_SignDecodeErrorZ {
+ /// The contents of this CResult_SignDecodeErrorZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_PaymentSecretNoneZPtr,
- /// Whether this CResult_PaymentSecretNoneZ represents a success state.
+ pub contents: CResult_SignDecodeErrorZPtr,
+ /// Whether this CResult_SignDecodeErrorZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_PaymentSecretNoneZ in the success state.
-pub extern "C" fn CResult_PaymentSecretNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretNoneZ {
- CResult_PaymentSecretNoneZ {
- contents: CResult_PaymentSecretNoneZPtr {
+/// Creates a new CResult_SignDecodeErrorZ in the success state.
+pub extern "C" fn CResult_SignDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::Sign) -> CResult_SignDecodeErrorZ {
+ CResult_SignDecodeErrorZ {
+ contents: CResult_SignDecodeErrorZPtr {
result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_PaymentSecretNoneZ in the error state.
-pub extern "C" fn CResult_PaymentSecretNoneZ_err() -> CResult_PaymentSecretNoneZ {
- CResult_PaymentSecretNoneZ {
- contents: CResult_PaymentSecretNoneZPtr {
- err: core::ptr::null_mut(),
+/// Creates a new CResult_SignDecodeErrorZ in the error state.
+pub extern "C" fn CResult_SignDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SignDecodeErrorZ {
+ CResult_SignDecodeErrorZ {
+ contents: CResult_SignDecodeErrorZPtr {
+ 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_PaymentSecretNoneZ_is_ok(o: &CResult_PaymentSecretNoneZ) -> bool {
+pub extern "C" fn CResult_SignDecodeErrorZ_is_ok(o: &CResult_SignDecodeErrorZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_PaymentSecretNoneZ.
-pub extern "C" fn CResult_PaymentSecretNoneZ_free(_res: CResult_PaymentSecretNoneZ) { }
-impl Drop for CResult_PaymentSecretNoneZ {
+/// Frees any resources used by the CResult_SignDecodeErrorZ.
+pub extern "C" fn CResult_SignDecodeErrorZ_free(_res: CResult_SignDecodeErrorZ) { }
+impl Drop for CResult_SignDecodeErrorZ {
fn drop(&mut self) {
if self.result_ok {
if unsafe { !(self.contents.result as *mut ()).is_null() } {
let _ = unsafe { Box::from_raw(self.contents.result) };
}
} else {
+ if unsafe { !(self.contents.err as *mut ()).is_null() } {
+ let _ = unsafe { Box::from_raw(self.contents.err) };
+ }
}
}
}
-impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>> for CResult_PaymentSecretNoneZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>> for CResult_SignDecodeErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, 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_PaymentSecretNoneZPtr { result }
+ CResult_SignDecodeErrorZPtr { result }
} else {
- let _ = unsafe { Box::from_raw(o.contents.err) };
- o.contents.err = core::ptr::null_mut();
- CResult_PaymentSecretNoneZPtr { err: core::ptr::null_mut() }
+ let err = unsafe { o.contents.err };
+ unsafe { o.contents.err = core::ptr::null_mut(); }
+ CResult_SignDecodeErrorZPtr { err }
};
Self {
contents,
}
}
}
-impl Clone for CResult_PaymentSecretNoneZ {
+impl Clone for CResult_SignDecodeErrorZ {
fn clone(&self) -> Self {
if self.result_ok {
- Self { result_ok: true, contents: CResult_PaymentSecretNoneZPtr {
- result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
+ Self { result_ok: true, contents: CResult_SignDecodeErrorZPtr {
+ result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::Sign>::clone(unsafe { &*self.contents.result })))
} }
} else {
- Self { result_ok: false, contents: CResult_PaymentSecretNoneZPtr {
- err: core::ptr::null_mut()
+ Self { result_ok: false, contents: CResult_SignDecodeErrorZPtr {
+ err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
} }
}
}
}
#[no_mangle]
-/// Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig`
+/// Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_PaymentSecretNoneZ_clone(orig: &CResult_PaymentSecretNoneZ) -> CResult_PaymentSecretNoneZ { Clone::clone(&orig) }
+pub extern "C" fn CResult_SignDecodeErrorZ_clone(orig: &CResult_SignDecodeErrorZ) -> CResult_SignDecodeErrorZ { Clone::clone(&orig) }
#[repr(C)]
-/// The contents of CResult_PaymentSecretAPIErrorZ
-pub union CResult_PaymentSecretAPIErrorZPtr {
+/// A dynamically-allocated array of crate::c_types::u5s of arbitrary size.
+/// This corresponds to std::vector in C++
+pub struct CVec_u5Z {
+ /// 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::u5,
+ /// The number of elements pointed to by `data`.
+ pub datalen: usize
+}
+impl CVec_u5Z {
+ #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::u5> {
+ 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::u5] {
+ unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
+ }
+}
+impl From<Vec<crate::c_types::u5>> for CVec_u5Z {
+ fn from(v: Vec<crate::c_types::u5>) -> 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_u5Z_free(_res: CVec_u5Z) { }
+impl Drop for CVec_u5Z {
+ fn drop(&mut self) {
+ if self.datalen == 0 { return; }
+ unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
+ }
+}
+impl Clone for CVec_u5Z {
+ 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_RecoverableSignatureNoneZ
+pub union CResult_RecoverableSignatureNoneZPtr {
/// A pointer to the contents in the success state.
/// Reading from this pointer when `result_ok` is not set is undefined.
- pub result: *mut crate::c_types::ThirtyTwoBytes,
- /// A pointer to the contents in the error state.
- /// Reading from this pointer when `result_ok` is set is undefined.
- pub err: *mut crate::lightning::util::errors::APIError,
+ pub result: *mut crate::c_types::RecoverableSignature,
+ /// 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_PaymentSecretAPIErrorZ represents the result of a fallible operation,
-/// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
+/// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
+/// containing a crate::c_types::RecoverableSignature on success and a () on failure.
/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult_PaymentSecretAPIErrorZ {
- /// The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
+pub struct CResult_RecoverableSignatureNoneZ {
+ /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_PaymentSecretAPIErrorZPtr,
- /// Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
+ pub contents: CResult_RecoverableSignatureNoneZPtr,
+ /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
-pub extern "C" fn CResult_PaymentSecretAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretAPIErrorZ {
- CResult_PaymentSecretAPIErrorZ {
- contents: CResult_PaymentSecretAPIErrorZPtr {
+/// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
+pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
+ CResult_RecoverableSignatureNoneZ {
+ contents: CResult_RecoverableSignatureNoneZPtr {
result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
-pub extern "C" fn CResult_PaymentSecretAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentSecretAPIErrorZ {
- CResult_PaymentSecretAPIErrorZ {
- contents: CResult_PaymentSecretAPIErrorZPtr {
- err: Box::into_raw(Box::new(e)),
+/// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
+pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
+ CResult_RecoverableSignatureNoneZ {
+ contents: CResult_RecoverableSignatureNoneZPtr {
+ 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_PaymentSecretAPIErrorZ_is_ok(o: &CResult_PaymentSecretAPIErrorZ) -> bool {
+pub extern "C" fn CResult_RecoverableSignatureNoneZ_is_ok(o: &CResult_RecoverableSignatureNoneZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
-pub extern "C" fn CResult_PaymentSecretAPIErrorZ_free(_res: CResult_PaymentSecretAPIErrorZ) { }
-impl Drop for CResult_PaymentSecretAPIErrorZ {
+/// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
+pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
+impl Drop for CResult_RecoverableSignatureNoneZ {
fn drop(&mut self) {
if self.result_ok {
if unsafe { !(self.contents.result as *mut ()).is_null() } {
let _ = unsafe { Box::from_raw(self.contents.result) };
}
} else {
- if unsafe { !(self.contents.err as *mut ()).is_null() } {
- let _ = unsafe { Box::from_raw(self.contents.err) };
- }
}
}
}
-impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentSecretAPIErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
let contents = if o.result_ok {
let result = unsafe { o.contents.result };
unsafe { o.contents.result = core::ptr::null_mut() };
- CResult_PaymentSecretAPIErrorZPtr { result }
+ CResult_RecoverableSignatureNoneZPtr { result }
} else {
- let err = unsafe { o.contents.err };
- unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_PaymentSecretAPIErrorZPtr { err }
+ let _ = unsafe { Box::from_raw(o.contents.err) };
+ o.contents.err = core::ptr::null_mut();
+ CResult_RecoverableSignatureNoneZPtr { err: core::ptr::null_mut() }
};
Self {
contents,
}
}
}
-impl Clone for CResult_PaymentSecretAPIErrorZ {
+impl Clone for CResult_RecoverableSignatureNoneZ {
fn clone(&self) -> Self {
if self.result_ok {
- Self { result_ok: true, contents: CResult_PaymentSecretAPIErrorZPtr {
- result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
+ Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
+ result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
} }
} else {
- Self { result_ok: false, contents: CResult_PaymentSecretAPIErrorZPtr {
- err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
+ Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
+ err: core::ptr::null_mut()
} }
}
}
}
#[no_mangle]
-/// Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
+/// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_PaymentSecretAPIErrorZ_clone(orig: &CResult_PaymentSecretAPIErrorZ) -> CResult_PaymentSecretAPIErrorZ { Clone::clone(&orig) }
-#[repr(C)]
-/// The contents of CResult_PaymentPreimageAPIErrorZ
-pub union CResult_PaymentPreimageAPIErrorZPtr {
- /// A pointer to the contents in the success state.
- /// Reading from this pointer when `result_ok` is not set is undefined.
- pub result: *mut crate::c_types::ThirtyTwoBytes,
- /// A pointer to the contents in the error state.
- /// Reading from this pointer when `result_ok` is set is undefined.
- pub err: *mut crate::lightning::util::errors::APIError,
-}
+pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { Clone::clone(&orig) }
#[repr(C)]
-/// A CResult_PaymentPreimageAPIErrorZ represents the result of a fallible operation,
-/// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
+/// A dynamically-allocated array of u8s of arbitrary size.
+/// This corresponds to std::vector in C++
+pub struct CVec_u8Z {
+ /// The elements in the array.
+ /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ pub data: *mut u8,
+ /// The number of elements pointed to by `data`.
+ pub datalen: usize
+}
+impl CVec_u8Z {
+ #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
+ 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) -> &[u8] {
+ unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
+ }
+}
+impl From<Vec<u8>> for CVec_u8Z {
+ fn from(v: Vec<u8>) -> 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_u8Z_free(_res: CVec_u8Z) { }
+impl Drop for CVec_u8Z {
+ fn drop(&mut self) {
+ if self.datalen == 0 { return; }
+ unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
+ }
+}
+impl Clone for CVec_u8Z {
+ 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)]
+/// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
+/// This corresponds to std::vector in C++
+pub struct CVec_CVec_u8ZZ {
+ /// 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::CVec_u8Z,
+ /// The number of elements pointed to by `data`.
+ pub datalen: usize
+}
+impl CVec_CVec_u8ZZ {
+ #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
+ 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::CVec_u8Z] {
+ unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
+ }
+}
+impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
+ fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> 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_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
+impl Drop for CVec_CVec_u8ZZ {
+ fn drop(&mut self) {
+ if self.datalen == 0 { return; }
+ unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
+ }
+}
+impl Clone for CVec_CVec_u8ZZ {
+ 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_CVec_CVec_u8ZZNoneZ
+pub union CResult_CVec_CVec_u8ZZNoneZPtr {
+ /// 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::CVec_CVec_u8ZZ,
+ /// 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_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
+/// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult_PaymentPreimageAPIErrorZ {
- /// The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either
+pub struct CResult_CVec_CVec_u8ZZNoneZ {
+ /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_PaymentPreimageAPIErrorZPtr,
- /// Whether this CResult_PaymentPreimageAPIErrorZ represents a success state.
+ pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
+ /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_PaymentPreimageAPIErrorZ in the success state.
-pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentPreimageAPIErrorZ {
- CResult_PaymentPreimageAPIErrorZ {
- contents: CResult_PaymentPreimageAPIErrorZPtr {
+/// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
+pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
+ CResult_CVec_CVec_u8ZZNoneZ {
+ contents: CResult_CVec_CVec_u8ZZNoneZPtr {
result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_PaymentPreimageAPIErrorZ in the error state.
-pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentPreimageAPIErrorZ {
- CResult_PaymentPreimageAPIErrorZ {
- contents: CResult_PaymentPreimageAPIErrorZPtr {
- err: Box::into_raw(Box::new(e)),
+/// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
+pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
+ CResult_CVec_CVec_u8ZZNoneZ {
+ contents: CResult_CVec_CVec_u8ZZNoneZPtr {
+ 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_PaymentPreimageAPIErrorZ_is_ok(o: &CResult_PaymentPreimageAPIErrorZ) -> bool {
+pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_is_ok(o: &CResult_CVec_CVec_u8ZZNoneZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_PaymentPreimageAPIErrorZ.
-pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_free(_res: CResult_PaymentPreimageAPIErrorZ) { }
-impl Drop for CResult_PaymentPreimageAPIErrorZ {
+/// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
+pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
+impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
fn drop(&mut self) {
if self.result_ok {
if unsafe { !(self.contents.result as *mut ()).is_null() } {
let _ = unsafe { Box::from_raw(self.contents.result) };
}
} else {
- if unsafe { !(self.contents.err as *mut ()).is_null() } {
- let _ = unsafe { Box::from_raw(self.contents.err) };
- }
}
}
}
-impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentPreimageAPIErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>> for CResult_CVec_CVec_u8ZZNoneZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>) -> Self {
let contents = if o.result_ok {
let result = unsafe { o.contents.result };
unsafe { o.contents.result = core::ptr::null_mut() };
- CResult_PaymentPreimageAPIErrorZPtr { result }
+ CResult_CVec_CVec_u8ZZNoneZPtr { result }
} else {
- let err = unsafe { o.contents.err };
- unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_PaymentPreimageAPIErrorZPtr { err }
+ let _ = unsafe { Box::from_raw(o.contents.err) };
+ o.contents.err = core::ptr::null_mut();
+ CResult_CVec_CVec_u8ZZNoneZPtr { err: core::ptr::null_mut() }
};
Self {
contents,
}
}
}
-impl Clone for CResult_PaymentPreimageAPIErrorZ {
+impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
fn clone(&self) -> Self {
if self.result_ok {
- Self { result_ok: true, contents: CResult_PaymentPreimageAPIErrorZPtr {
- result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
+ Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
+ result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
} }
} else {
- Self { result_ok: false, contents: CResult_PaymentPreimageAPIErrorZPtr {
- err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
+ Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
+ err: core::ptr::null_mut()
} }
}
}
}
#[no_mangle]
-/// Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig`
+/// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_clone(orig: &CResult_PaymentPreimageAPIErrorZ) -> CResult_PaymentPreimageAPIErrorZ { Clone::clone(&orig) }
+pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { Clone::clone(&orig) }
#[repr(C)]
-/// The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
-pub union CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
+/// The contents of CResult_InMemorySignerDecodeErrorZ
+pub union CResult_InMemorySignerDecodeErrorZPtr {
/// A pointer to the contents in the success state.
/// Reading from this pointer when `result_ok` is not set is undefined.
- pub result: *mut crate::lightning::ln::channelmanager::CounterpartyForwardingInfo,
+ pub result: *mut crate::lightning::chain::keysinterface::InMemorySigner,
/// 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_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
-/// containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
+/// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
+/// containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult_CounterpartyForwardingInfoDecodeErrorZ {
- /// The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
+pub struct CResult_InMemorySignerDecodeErrorZ {
+ /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr,
- /// Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
+ pub contents: CResult_InMemorySignerDecodeErrorZPtr,
+ /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
-pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::CounterpartyForwardingInfo) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
- CResult_CounterpartyForwardingInfoDecodeErrorZ {
- contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
+/// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
+pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
+ CResult_InMemorySignerDecodeErrorZ {
+ contents: CResult_InMemorySignerDecodeErrorZPtr {
result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
-pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
- CResult_CounterpartyForwardingInfoDecodeErrorZ {
- contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
+/// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
+pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
+ CResult_InMemorySignerDecodeErrorZ {
+ contents: CResult_InMemorySignerDecodeErrorZPtr {
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_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> bool {
+pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_is_ok(o: &CResult_InMemorySignerDecodeErrorZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
-pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res: CResult_CounterpartyForwardingInfoDecodeErrorZ) { }
-impl Drop for CResult_CounterpartyForwardingInfoDecodeErrorZ {
+/// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
+pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
+impl Drop for CResult_InMemorySignerDecodeErrorZ {
fn drop(&mut self) {
if self.result_ok {
if unsafe { !(self.contents.result as *mut ()).is_null() } {
}
}
}
-impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyForwardingInfoDecodeErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, 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_CounterpartyForwardingInfoDecodeErrorZPtr { result }
+ CResult_InMemorySignerDecodeErrorZPtr { result }
} else {
let err = unsafe { o.contents.err };
unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_CounterpartyForwardingInfoDecodeErrorZPtr { err }
+ CResult_InMemorySignerDecodeErrorZPtr { err }
};
Self {
contents,
}
}
}
-impl Clone for CResult_CounterpartyForwardingInfoDecodeErrorZ {
+impl Clone for CResult_InMemorySignerDecodeErrorZ {
fn clone(&self) -> Self {
if self.result_ok {
- Self { result_ok: true, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
- result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo>::clone(unsafe { &*self.contents.result })))
+ Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
+ result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
} }
} else {
- Self { result_ok: false, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
+ Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
} }
}
}
}
#[no_mangle]
-/// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
+/// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> CResult_CounterpartyForwardingInfoDecodeErrorZ { Clone::clone(&orig) }
-#[repr(C)]
-/// The contents of CResult_ChannelCounterpartyDecodeErrorZ
-pub union CResult_ChannelCounterpartyDecodeErrorZPtr {
- /// A pointer to the contents in the success state.
- /// Reading from this pointer when `result_ok` is not set is undefined.
- pub result: *mut crate::lightning::ln::channelmanager::ChannelCounterparty,
- /// 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,
-}
+pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { Clone::clone(&orig) }
#[repr(C)]
-/// A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
-/// containing a crate::lightning::ln::channelmanager::ChannelCounterparty 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_ChannelCounterpartyDecodeErrorZ {
- /// The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
- /// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_ChannelCounterpartyDecodeErrorZPtr,
- /// Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
- pub result_ok: bool,
+/// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
+/// This corresponds to std::vector in C++
+pub struct CVec_TxOutZ {
+ /// 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::TxOut,
+ /// The number of elements pointed to by `data`.
+ pub datalen: usize
}
-#[no_mangle]
-/// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
-pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelCounterparty) -> CResult_ChannelCounterpartyDecodeErrorZ {
- CResult_ChannelCounterpartyDecodeErrorZ {
- contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
+impl CVec_TxOutZ {
+ #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
+ 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::TxOut] {
+ unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
+ }
+}
+impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
+ fn from(v: Vec<crate::c_types::TxOut>) -> 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_TxOutZ_free(_res: CVec_TxOutZ) { }
+impl Drop for CVec_TxOutZ {
+ fn drop(&mut self) {
+ if self.datalen == 0 { return; }
+ unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
+ }
+}
+impl Clone for CVec_TxOutZ {
+ 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_TransactionNoneZ
+pub union CResult_TransactionNoneZPtr {
+ /// 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::Transaction,
+ /// 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_TransactionNoneZ represents the result of a fallible operation,
+/// containing a crate::c_types::Transaction on success and a () on failure.
+/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
+pub struct CResult_TransactionNoneZ {
+ /// The contents of this CResult_TransactionNoneZ, accessible via either
+ /// `err` or `result` depending on the state of `result_ok`.
+ pub contents: CResult_TransactionNoneZPtr,
+ /// Whether this CResult_TransactionNoneZ represents a success state.
+ pub result_ok: bool,
+}
+#[no_mangle]
+/// Creates a new CResult_TransactionNoneZ in the success state.
+pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
+ CResult_TransactionNoneZ {
+ contents: CResult_TransactionNoneZPtr {
result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
-pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelCounterpartyDecodeErrorZ {
- CResult_ChannelCounterpartyDecodeErrorZ {
- contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
- err: Box::into_raw(Box::new(e)),
+/// Creates a new CResult_TransactionNoneZ in the error state.
+pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
+ CResult_TransactionNoneZ {
+ contents: CResult_TransactionNoneZPtr {
+ 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_ChannelCounterpartyDecodeErrorZ_is_ok(o: &CResult_ChannelCounterpartyDecodeErrorZ) -> bool {
+pub extern "C" fn CResult_TransactionNoneZ_is_ok(o: &CResult_TransactionNoneZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
-pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_free(_res: CResult_ChannelCounterpartyDecodeErrorZ) { }
-impl Drop for CResult_ChannelCounterpartyDecodeErrorZ {
+/// Frees any resources used by the CResult_TransactionNoneZ.
+pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
+impl Drop for CResult_TransactionNoneZ {
fn drop(&mut self) {
if self.result_ok {
if unsafe { !(self.contents.result as *mut ()).is_null() } {
let _ = unsafe { Box::from_raw(self.contents.result) };
}
} else {
- if unsafe { !(self.contents.err as *mut ()).is_null() } {
- let _ = unsafe { Box::from_raw(self.contents.err) };
- }
}
}
}
-impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelCounterpartyDecodeErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
let contents = if o.result_ok {
let result = unsafe { o.contents.result };
unsafe { o.contents.result = core::ptr::null_mut() };
- CResult_ChannelCounterpartyDecodeErrorZPtr { result }
+ CResult_TransactionNoneZPtr { result }
} else {
- let err = unsafe { o.contents.err };
- unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_ChannelCounterpartyDecodeErrorZPtr { err }
+ let _ = unsafe { Box::from_raw(o.contents.err) };
+ o.contents.err = core::ptr::null_mut();
+ CResult_TransactionNoneZPtr { err: core::ptr::null_mut() }
};
Self {
contents,
}
}
}
-impl Clone for CResult_ChannelCounterpartyDecodeErrorZ {
+impl Clone for CResult_TransactionNoneZ {
fn clone(&self) -> Self {
if self.result_ok {
- Self { result_ok: true, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
- result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelCounterparty>::clone(unsafe { &*self.contents.result })))
+ Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
+ result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
} }
} else {
- Self { result_ok: false, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
- err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
+ Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
+ err: core::ptr::null_mut()
} }
}
}
}
#[no_mangle]
-/// Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
+/// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_clone(orig: &CResult_ChannelCounterpartyDecodeErrorZ) -> CResult_ChannelCounterpartyDecodeErrorZ { Clone::clone(&orig) }
+pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { Clone::clone(&orig) }
#[repr(C)]
-/// The contents of CResult_ChannelDetailsDecodeErrorZ
-pub union CResult_ChannelDetailsDecodeErrorZPtr {
+/// A tuple of 2 elements. See the individual fields for the types contained.
+pub struct C2Tuple_BlockHashChannelMonitorZ {
+ /// The element at position 0
+ pub a: crate::c_types::ThirtyTwoBytes,
+ /// The element at position 1
+ pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
+}
+impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
+ fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
+ Self {
+ a: tup.0,
+ b: tup.1,
+ }
+ }
+}
+impl C2Tuple_BlockHashChannelMonitorZ {
+ #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
+ (self.a, self.b)
+ }
+}
+/// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
+#[no_mangle]
+pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
+ C2Tuple_BlockHashChannelMonitorZ { a, b, }
+}
+
+#[no_mangle]
+/// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
+pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
+#[repr(C)]
+/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
+/// This corresponds to std::vector in C++
+pub struct CVec_C2Tuple_BlockHashChannelMonitorZZ {
+ /// 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::C2Tuple_BlockHashChannelMonitorZ,
+ /// The number of elements pointed to by `data`.
+ pub datalen: usize
+}
+impl CVec_C2Tuple_BlockHashChannelMonitorZZ {
+ #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ> {
+ 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::C2Tuple_BlockHashChannelMonitorZ] {
+ unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
+ }
+}
+impl From<Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>> for CVec_C2Tuple_BlockHashChannelMonitorZZ {
+ fn from(v: Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>) -> 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_C2Tuple_BlockHashChannelMonitorZZ_free(_res: CVec_C2Tuple_BlockHashChannelMonitorZZ) { }
+impl Drop for CVec_C2Tuple_BlockHashChannelMonitorZZ {
+ fn drop(&mut self) {
+ if self.datalen == 0 { return; }
+ unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
+ }
+}
+#[repr(C)]
+/// The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
+pub union CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
/// A pointer to the contents in the success state.
/// Reading from this pointer when `result_ok` is not set is undefined.
- pub result: *mut crate::lightning::ln::channelmanager::ChannelDetails,
+ pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ,
/// 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,
+ pub err: *mut crate::c_types::IOError,
}
#[repr(C)]
-/// A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
-/// containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
+/// A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
+/// containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult_ChannelDetailsDecodeErrorZ {
- /// The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
+pub struct CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
+ /// The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_ChannelDetailsDecodeErrorZPtr,
- /// Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
+ pub contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr,
+ /// Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
-pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelDetails) -> CResult_ChannelDetailsDecodeErrorZ {
- CResult_ChannelDetailsDecodeErrorZ {
- contents: CResult_ChannelDetailsDecodeErrorZPtr {
+/// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
+pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
+ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
+ contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
-pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDetailsDecodeErrorZ {
- CResult_ChannelDetailsDecodeErrorZ {
- contents: CResult_ChannelDetailsDecodeErrorZPtr {
+/// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
+pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
+ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
+ contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
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_ChannelDetailsDecodeErrorZ_is_ok(o: &CResult_ChannelDetailsDecodeErrorZ) -> bool {
+pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o: &CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
-pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_free(_res: CResult_ChannelDetailsDecodeErrorZ) { }
-impl Drop for CResult_ChannelDetailsDecodeErrorZ {
+/// Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
+pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) { }
+impl Drop for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
fn drop(&mut self) {
if self.result_ok {
if unsafe { !(self.contents.result as *mut ()).is_null() } {
}
}
}
-impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelDetailsDecodeErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>) -> Self {
let contents = if o.result_ok {
let result = unsafe { o.contents.result };
unsafe { o.contents.result = core::ptr::null_mut() };
- CResult_ChannelDetailsDecodeErrorZPtr { result }
+ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { result }
} else {
let err = unsafe { o.contents.err };
unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_ChannelDetailsDecodeErrorZPtr { err }
+ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { err }
};
Self {
contents,
}
}
}
-impl Clone for CResult_ChannelDetailsDecodeErrorZ {
- fn clone(&self) -> Self {
- if self.result_ok {
- Self { result_ok: true, contents: CResult_ChannelDetailsDecodeErrorZPtr {
- result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelDetails>::clone(unsafe { &*self.contents.result })))
- } }
- } else {
- Self { result_ok: false, contents: CResult_ChannelDetailsDecodeErrorZPtr {
- err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
- } }
- }
- }
-}
-#[no_mangle]
-/// Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
-/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_clone(orig: &CResult_ChannelDetailsDecodeErrorZ) -> CResult_ChannelDetailsDecodeErrorZ { Clone::clone(&orig) }
#[repr(C)]
-/// The contents of CResult_PhantomRouteHintsDecodeErrorZ
-pub union CResult_PhantomRouteHintsDecodeErrorZPtr {
- /// A pointer to the contents in the success state.
- /// Reading from this pointer when `result_ok` is not set is undefined.
- pub result: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
- /// 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,
+#[derive(Clone)]
+/// An enum which can either contain a u16 or not
+pub enum COption_u16Z {
+ /// When we're in this state, this COption_u16Z contains a u16
+ Some(u16),
+ /// When we're in this state, this COption_u16Z contains nothing
+ None
+}
+impl COption_u16Z {
+ #[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) -> u16 {
+ if let Self::Some(v) = self { v } else { unreachable!() }
+ }
+}
+#[no_mangle]
+/// Constructs a new COption_u16Z containing a u16
+pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
+ COption_u16Z::Some(o)
+}
+#[no_mangle]
+/// Constructs a new COption_u16Z containing nothing
+pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
+ COption_u16Z::None
+}
+#[no_mangle]
+/// Frees any resources associated with the u16, if we are in the Some state
+pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
+#[no_mangle]
+/// Creates a new COption_u16Z which has the same data as `orig`
+/// but with all dynamically-allocated buffers duplicated in new buffers.
+pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) }
+#[repr(C)]
+/// The contents of CResult_NoneAPIErrorZ
+pub union CResult_NoneAPIErrorZPtr {
+ /// 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::util::errors::APIError,
}
#[repr(C)]
-/// A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
-/// containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure.
+/// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
+/// containing a () on success and a crate::lightning::util::errors::APIError on failure.
/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult_PhantomRouteHintsDecodeErrorZ {
- /// The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
+pub struct CResult_NoneAPIErrorZ {
+ /// The contents of this CResult_NoneAPIErrorZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_PhantomRouteHintsDecodeErrorZPtr,
- /// Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
+ pub contents: CResult_NoneAPIErrorZPtr,
+ /// Whether this CResult_NoneAPIErrorZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
-pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PhantomRouteHints) -> CResult_PhantomRouteHintsDecodeErrorZ {
- CResult_PhantomRouteHintsDecodeErrorZ {
- contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
- result: Box::into_raw(Box::new(o)),
+/// Creates a new CResult_NoneAPIErrorZ in the success state.
+pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
+ CResult_NoneAPIErrorZ {
+ contents: CResult_NoneAPIErrorZPtr {
+ result: core::ptr::null_mut(),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
-pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PhantomRouteHintsDecodeErrorZ {
- CResult_PhantomRouteHintsDecodeErrorZ {
- contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
+/// Creates a new CResult_NoneAPIErrorZ in the error state.
+pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
+ CResult_NoneAPIErrorZ {
+ contents: CResult_NoneAPIErrorZPtr {
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_PhantomRouteHintsDecodeErrorZ_is_ok(o: &CResult_PhantomRouteHintsDecodeErrorZ) -> bool {
+pub extern "C" fn CResult_NoneAPIErrorZ_is_ok(o: &CResult_NoneAPIErrorZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
-pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_free(_res: CResult_PhantomRouteHintsDecodeErrorZ) { }
-impl Drop for CResult_PhantomRouteHintsDecodeErrorZ {
+/// Frees any resources used by the CResult_NoneAPIErrorZ.
+pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
+impl Drop for CResult_NoneAPIErrorZ {
fn drop(&mut self) {
if self.result_ok {
- if unsafe { !(self.contents.result as *mut ()).is_null() } {
- let _ = unsafe { Box::from_raw(self.contents.result) };
- }
} else {
if unsafe { !(self.contents.err as *mut ()).is_null() } {
let _ = unsafe { Box::from_raw(self.contents.err) };
}
}
}
-impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>> for CResult_PhantomRouteHintsDecodeErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>) -> Self {
+impl From<crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
let contents = if o.result_ok {
- let result = unsafe { o.contents.result };
- unsafe { o.contents.result = core::ptr::null_mut() };
- CResult_PhantomRouteHintsDecodeErrorZPtr { result }
+ let _ = unsafe { Box::from_raw(o.contents.result) };
+ o.contents.result = core::ptr::null_mut();
+ CResult_NoneAPIErrorZPtr { result: core::ptr::null_mut() }
} else {
let err = unsafe { o.contents.err };
unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_PhantomRouteHintsDecodeErrorZPtr { err }
+ CResult_NoneAPIErrorZPtr { err }
};
Self {
contents,
}
}
}
-impl Clone for CResult_PhantomRouteHintsDecodeErrorZ {
+impl Clone for CResult_NoneAPIErrorZ {
fn clone(&self) -> Self {
if self.result_ok {
- Self { result_ok: true, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
- result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PhantomRouteHints>::clone(unsafe { &*self.contents.result })))
+ Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
+ result: core::ptr::null_mut()
} }
} else {
- Self { result_ok: false, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
- err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
+ Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
+ err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
} }
}
}
}
#[no_mangle]
-/// Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig`
+/// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_clone(orig: &CResult_PhantomRouteHintsDecodeErrorZ) -> CResult_PhantomRouteHintsDecodeErrorZ { Clone::clone(&orig) }
+pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { Clone::clone(&orig) }
#[repr(C)]
-/// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
+/// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
/// This corresponds to std::vector in C++
-pub struct CVec_ChannelMonitorZ {
+pub struct CVec_CResult_NoneAPIErrorZZ {
/// 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::chain::channelmonitor::ChannelMonitor,
+ pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
/// The number of elements pointed to by `data`.
pub datalen: usize
}
-impl CVec_ChannelMonitorZ {
- #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
+impl CVec_CResult_NoneAPIErrorZZ {
+ #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
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::chain::channelmonitor::ChannelMonitor] {
+ #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
}
}
-impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
- fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
+impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
+ fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> 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_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
-impl Drop for CVec_ChannelMonitorZ {
+pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
+impl Drop for CVec_CResult_NoneAPIErrorZZ {
fn drop(&mut self) {
if self.datalen == 0 { return; }
unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
}
}
+impl Clone for CVec_CResult_NoneAPIErrorZZ {
+ 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)]
-/// A tuple of 2 elements. See the individual fields for the types contained.
-pub struct C2Tuple_BlockHashChannelManagerZ {
- /// The element at position 0
- pub a: crate::c_types::ThirtyTwoBytes,
- /// The element at position 1
- pub b: crate::lightning::ln::channelmanager::ChannelManager,
+/// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
+/// This corresponds to std::vector in C++
+pub struct CVec_APIErrorZ {
+ /// 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::util::errors::APIError,
+ /// The number of elements pointed to by `data`.
+ pub datalen: usize
}
-impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
- fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
- Self {
- a: tup.0,
- b: tup.1,
- }
+impl CVec_APIErrorZ {
+ #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
+ 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::util::errors::APIError] {
+ unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
}
}
-impl C2Tuple_BlockHashChannelManagerZ {
- #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
- (self.a, self.b)
+impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
+ fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
+ let datalen = v.len();
+ let data = Box::into_raw(v.into_boxed_slice());
+ Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
}
}
-/// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
#[no_mangle]
-pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
- C2Tuple_BlockHashChannelManagerZ { a, b, }
+/// Frees the buffer pointed to by `data` if `datalen` is non-0.
+pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
+impl Drop for CVec_APIErrorZ {
+ fn drop(&mut self) {
+ if self.datalen == 0 { return; }
+ unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
+ }
+}
+impl Clone for CVec_APIErrorZ {
+ 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)
+ }
}
-
-#[no_mangle]
-/// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
-pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
#[repr(C)]
-/// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
-pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
+/// The contents of CResult__u832APIErrorZ
+pub union CResult__u832APIErrorZPtr {
/// A pointer to the contents in the success state.
/// Reading from this pointer when `result_ok` is not set is undefined.
- pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
+ pub result: *mut crate::c_types::ThirtyTwoBytes,
/// A pointer to the contents in the error state.
/// Reading from this pointer when `result_ok` is set is undefined.
- pub err: *mut crate::lightning::ln::msgs::DecodeError,
+ pub err: *mut crate::lightning::util::errors::APIError,
}
#[repr(C)]
-/// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
-/// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
+/// A CResult__u832APIErrorZ represents the result of a fallible operation,
+/// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
- /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
+pub struct CResult__u832APIErrorZ {
+ /// The contents of this CResult__u832APIErrorZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
- /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
+ pub contents: CResult__u832APIErrorZPtr,
+ /// Whether this CResult__u832APIErrorZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
-pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
- CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
- contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
+/// Creates a new CResult__u832APIErrorZ in the success state.
+pub extern "C" fn CResult__u832APIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult__u832APIErrorZ {
+ CResult__u832APIErrorZ {
+ contents: CResult__u832APIErrorZPtr {
result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
-pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
- CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
- contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
+/// Creates a new CResult__u832APIErrorZ in the error state.
+pub extern "C" fn CResult__u832APIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult__u832APIErrorZ {
+ CResult__u832APIErrorZ {
+ contents: CResult__u832APIErrorZPtr {
err: Box::into_raw(Box::new(e)),
},
result_ok: false,
}
/// Checks if the given object is currently in the success state
#[no_mangle]
-pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) -> bool {
+pub extern "C" fn CResult__u832APIErrorZ_is_ok(o: &CResult__u832APIErrorZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
-pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
-impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
+/// Frees any resources used by the CResult__u832APIErrorZ.
+pub extern "C" fn CResult__u832APIErrorZ_free(_res: CResult__u832APIErrorZ) { }
+impl Drop for CResult__u832APIErrorZ {
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::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult__u832APIErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
let contents = if o.result_ok {
let result = unsafe { o.contents.result };
unsafe { o.contents.result = core::ptr::null_mut() };
- CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
+ CResult__u832APIErrorZPtr { result }
} else {
let err = unsafe { o.contents.err };
unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
+ CResult__u832APIErrorZPtr { err }
};
Self {
contents,
}
}
}
-#[repr(C)]
-/// The contents of CResult_ChannelConfigDecodeErrorZ
-pub union CResult_ChannelConfigDecodeErrorZPtr {
- /// A pointer to the contents in the success state.
+impl Clone for CResult__u832APIErrorZ {
+ fn clone(&self) -> Self {
+ if self.result_ok {
+ Self { result_ok: true, contents: CResult__u832APIErrorZPtr {
+ result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
+ } }
+ } else {
+ Self { result_ok: false, contents: CResult__u832APIErrorZPtr {
+ err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
+ } }
+ }
+ }
+}
+#[no_mangle]
+/// Creates a new CResult__u832APIErrorZ which has the same data as `orig`
+/// but with all dynamically-allocated buffers duplicated in new buffers.
+pub extern "C" fn CResult__u832APIErrorZ_clone(orig: &CResult__u832APIErrorZ) -> CResult__u832APIErrorZ { Clone::clone(&orig) }
+#[repr(C)]
+/// The contents of CResult_PaymentIdPaymentSendFailureZ
+pub union CResult_PaymentIdPaymentSendFailureZPtr {
+ /// 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::util::config::ChannelConfig,
+ pub result: *mut crate::c_types::ThirtyTwoBytes,
/// A pointer to the contents in the error state.
/// Reading from this pointer when `result_ok` is set is undefined.
- pub err: *mut crate::lightning::ln::msgs::DecodeError,
+ pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
}
#[repr(C)]
-/// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
-/// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
+/// A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation,
+/// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult_ChannelConfigDecodeErrorZ {
- /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
+pub struct CResult_PaymentIdPaymentSendFailureZ {
+ /// The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_ChannelConfigDecodeErrorZPtr,
- /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
+ pub contents: CResult_PaymentIdPaymentSendFailureZPtr,
+ /// Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
-pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
- CResult_ChannelConfigDecodeErrorZ {
- contents: CResult_ChannelConfigDecodeErrorZPtr {
+/// Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state.
+pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentSendFailureZ {
+ CResult_PaymentIdPaymentSendFailureZ {
+ contents: CResult_PaymentIdPaymentSendFailureZPtr {
result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
-pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
- CResult_ChannelConfigDecodeErrorZ {
- contents: CResult_ChannelConfigDecodeErrorZPtr {
+/// Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state.
+pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_PaymentIdPaymentSendFailureZ {
+ CResult_PaymentIdPaymentSendFailureZ {
+ contents: CResult_PaymentIdPaymentSendFailureZPtr {
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_ChannelConfigDecodeErrorZ_is_ok(o: &CResult_ChannelConfigDecodeErrorZ) -> bool {
+pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_is_ok(o: &CResult_PaymentIdPaymentSendFailureZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
-pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
-impl Drop for CResult_ChannelConfigDecodeErrorZ {
+/// Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ.
+pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_free(_res: CResult_PaymentIdPaymentSendFailureZ) { }
+impl Drop for CResult_PaymentIdPaymentSendFailureZ {
fn drop(&mut self) {
if self.result_ok {
if unsafe { !(self.contents.result as *mut ()).is_null() } {
}
}
}
-impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_PaymentIdPaymentSendFailureZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
let contents = if o.result_ok {
let result = unsafe { o.contents.result };
unsafe { o.contents.result = core::ptr::null_mut() };
- CResult_ChannelConfigDecodeErrorZPtr { result }
+ CResult_PaymentIdPaymentSendFailureZPtr { result }
} else {
let err = unsafe { o.contents.err };
unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_ChannelConfigDecodeErrorZPtr { err }
+ CResult_PaymentIdPaymentSendFailureZPtr { err }
};
Self {
contents,
}
}
}
-impl Clone for CResult_ChannelConfigDecodeErrorZ {
+impl Clone for CResult_PaymentIdPaymentSendFailureZ {
fn clone(&self) -> Self {
if self.result_ok {
- Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
- result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
+ Self { result_ok: true, contents: CResult_PaymentIdPaymentSendFailureZPtr {
+ result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
} }
} else {
- Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
- err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
+ Self { result_ok: false, contents: CResult_PaymentIdPaymentSendFailureZPtr {
+ err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
} }
}
}
}
#[no_mangle]
-/// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
+/// Creates a new CResult_PaymentIdPaymentSendFailureZ which has the same data as `orig`
/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) }
+pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_clone(orig: &CResult_PaymentIdPaymentSendFailureZ) -> CResult_PaymentIdPaymentSendFailureZ { Clone::clone(&orig) }
#[repr(C)]
-/// The contents of CResult_OutPointDecodeErrorZ
-pub union CResult_OutPointDecodeErrorZPtr {
- /// 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::chain::transaction::OutPoint,
+/// The contents of CResult_NonePaymentSendFailureZ
+pub union CResult_NonePaymentSendFailureZPtr {
+ /// 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::ln::msgs::DecodeError,
+ pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
}
#[repr(C)]
-/// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
-/// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
+/// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
+/// containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult_OutPointDecodeErrorZ {
- /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
+pub struct CResult_NonePaymentSendFailureZ {
+ /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_OutPointDecodeErrorZPtr,
- /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
+ pub contents: CResult_NonePaymentSendFailureZPtr,
+ /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_OutPointDecodeErrorZ in the success state.
-pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
- CResult_OutPointDecodeErrorZ {
- contents: CResult_OutPointDecodeErrorZPtr {
- result: Box::into_raw(Box::new(o)),
+/// Creates a new CResult_NonePaymentSendFailureZ in the success state.
+pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
+ CResult_NonePaymentSendFailureZ {
+ contents: CResult_NonePaymentSendFailureZPtr {
+ result: core::ptr::null_mut(),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_OutPointDecodeErrorZ in the error state.
-pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
- CResult_OutPointDecodeErrorZ {
- contents: CResult_OutPointDecodeErrorZPtr {
+/// Creates a new CResult_NonePaymentSendFailureZ in the error state.
+pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
+ CResult_NonePaymentSendFailureZ {
+ contents: CResult_NonePaymentSendFailureZPtr {
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_OutPointDecodeErrorZ_is_ok(o: &CResult_OutPointDecodeErrorZ) -> bool {
+pub extern "C" fn CResult_NonePaymentSendFailureZ_is_ok(o: &CResult_NonePaymentSendFailureZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_OutPointDecodeErrorZ.
-pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
-impl Drop for CResult_OutPointDecodeErrorZ {
+/// Frees any resources used by the CResult_NonePaymentSendFailureZ.
+pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
+impl Drop for CResult_NonePaymentSendFailureZ {
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::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
+impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
+ fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
let contents = if o.result_ok {
- let result = unsafe { o.contents.result };
- unsafe { o.contents.result = core::ptr::null_mut() };
- CResult_OutPointDecodeErrorZPtr { result }
+ let _ = unsafe { Box::from_raw(o.contents.result) };
+ o.contents.result = core::ptr::null_mut();
+ CResult_NonePaymentSendFailureZPtr { result: core::ptr::null_mut() }
} else {
let err = unsafe { o.contents.err };
unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_OutPointDecodeErrorZPtr { err }
+ CResult_NonePaymentSendFailureZPtr { err }
};
Self {
contents,
}
}
}
-impl Clone for CResult_OutPointDecodeErrorZ {
+impl Clone for CResult_NonePaymentSendFailureZ {
fn clone(&self) -> Self {
if self.result_ok {
- Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
- result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
+ Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
+ result: core::ptr::null_mut()
} }
} else {
- Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
- err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
+ Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
+ err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
} }
}
}
}
#[no_mangle]
-/// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
+/// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) }
+pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { Clone::clone(&orig) }
#[repr(C)]
-/// An enum which can either contain a crate::lightning::ln::wire::Type or not
-pub enum COption_TypeZ {
- /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
- Some(crate::lightning::ln::wire::Type),
- /// When we're in this state, this COption_TypeZ contains nothing
- None
+/// A tuple of 2 elements. See the individual fields for the types contained.
+pub struct C2Tuple_PaymentHashPaymentIdZ {
+ /// The element at position 0
+ pub a: crate::c_types::ThirtyTwoBytes,
+ /// The element at position 1
+ pub b: crate::c_types::ThirtyTwoBytes,
}
-impl COption_TypeZ {
- #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
- if let Self::None = self { false } else { true }
+impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentIdZ {
+ fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
+ Self {
+ a: tup.0,
+ b: tup.1,
+ }
}
- #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
- !self.is_some()
+}
+impl C2Tuple_PaymentHashPaymentIdZ {
+ #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
+ (self.a, self.b)
}
- #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::wire::Type {
- if let Self::Some(v) = self { v } else { unreachable!() }
+}
+impl Clone for C2Tuple_PaymentHashPaymentIdZ {
+ fn clone(&self) -> Self {
+ Self {
+ a: Clone::clone(&self.a),
+ b: Clone::clone(&self.b),
+ }
}
}
#[no_mangle]
-/// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
-pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ {
- COption_TypeZ::Some(o)
-}
+/// 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 C2Tuple_PaymentHashPaymentIdZ_clone(orig: &C2Tuple_PaymentHashPaymentIdZ) -> C2Tuple_PaymentHashPaymentIdZ { Clone::clone(&orig) }
+/// Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
#[no_mangle]
-/// Constructs a new COption_TypeZ containing nothing
-pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ {
- COption_TypeZ::None
+pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentIdZ {
+ C2Tuple_PaymentHashPaymentIdZ { a, b, }
}
+
#[no_mangle]
-/// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
-pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { }
+/// Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
+pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_free(_res: C2Tuple_PaymentHashPaymentIdZ) { }
#[repr(C)]
-/// The contents of CResult_COption_TypeZDecodeErrorZ
-pub union CResult_COption_TypeZDecodeErrorZPtr {
+/// The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
+pub union CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
/// 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_TypeZ,
+ pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ,
/// 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,
+ pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
}
#[repr(C)]
-/// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
-/// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
+/// A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
+/// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult_COption_TypeZDecodeErrorZ {
- /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
+pub struct CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
+ /// The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_COption_TypeZDecodeErrorZPtr,
- /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
+ pub contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr,
+ /// Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
-pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ {
- CResult_COption_TypeZDecodeErrorZ {
- contents: CResult_COption_TypeZDecodeErrorZPtr {
+/// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
+pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
+ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
+ contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
-pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ {
- CResult_COption_TypeZDecodeErrorZ {
- contents: CResult_COption_TypeZDecodeErrorZPtr {
+/// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
+pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
+ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
+ contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
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_TypeZDecodeErrorZ_is_ok(o: &CResult_COption_TypeZDecodeErrorZ) -> bool {
+pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
-pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { }
-impl Drop for CResult_COption_TypeZDecodeErrorZ {
+/// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
+pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) { }
+impl Drop for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
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_TypeZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_TypeZDecodeErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
let contents = if o.result_ok {
let result = unsafe { o.contents.result };
unsafe { o.contents.result = core::ptr::null_mut() };
- CResult_COption_TypeZDecodeErrorZPtr { result }
+ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { result }
} else {
let err = unsafe { o.contents.err };
unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_COption_TypeZDecodeErrorZPtr { err }
+ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { err }
};
Self {
contents,
}
}
}
+impl Clone for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
+ fn clone(&self) -> Self {
+ if self.result_ok {
+ Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
+ result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ>::clone(unsafe { &*self.contents.result })))
+ } }
+ } else {
+ Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
+ err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
+ } }
+ }
+ }
+}
+#[no_mangle]
+/// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
+/// but with all dynamically-allocated buffers duplicated in new buffers.
+pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { Clone::clone(&orig) }
#[repr(C)]
-/// The contents of CResult_PaymentIdPaymentErrorZ
-pub union CResult_PaymentIdPaymentErrorZPtr {
+/// A tuple of 2 elements. See the individual fields for the types contained.
+pub struct C2Tuple_PaymentHashPaymentSecretZ {
+ /// The element at position 0
+ pub a: crate::c_types::ThirtyTwoBytes,
+ /// The element at position 1
+ pub b: crate::c_types::ThirtyTwoBytes,
+}
+impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentSecretZ {
+ fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
+ Self {
+ a: tup.0,
+ b: tup.1,
+ }
+ }
+}
+impl C2Tuple_PaymentHashPaymentSecretZ {
+ #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
+ (self.a, self.b)
+ }
+}
+impl Clone for C2Tuple_PaymentHashPaymentSecretZ {
+ fn clone(&self) -> Self {
+ Self {
+ a: Clone::clone(&self.a),
+ b: Clone::clone(&self.b),
+ }
+ }
+}
+#[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 C2Tuple_PaymentHashPaymentSecretZ_clone(orig: &C2Tuple_PaymentHashPaymentSecretZ) -> C2Tuple_PaymentHashPaymentSecretZ { Clone::clone(&orig) }
+/// Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
+#[no_mangle]
+pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentSecretZ {
+ C2Tuple_PaymentHashPaymentSecretZ { a, b, }
+}
+
+#[no_mangle]
+/// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
+pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { }
+#[repr(C)]
+/// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ
+pub union CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
/// A pointer to the contents in the success state.
/// Reading from this pointer when `result_ok` is not set is undefined.
- pub result: *mut crate::c_types::ThirtyTwoBytes,
- /// A pointer to the contents in the error state.
- /// Reading from this pointer when `result_ok` is set is undefined.
- pub err: *mut crate::lightning_invoice::payment::PaymentError,
+ pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
+ /// Note that this value is always NULL, as there are no contents in the Err variant
+ pub err: *mut core::ffi::c_void,
}
#[repr(C)]
-/// A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
-/// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
+/// A CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation,
+/// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure.
/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult_PaymentIdPaymentErrorZ {
- /// The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
+pub struct CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
+ /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_PaymentIdPaymentErrorZPtr,
- /// Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
+ pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr,
+ /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
-pub extern "C" fn CResult_PaymentIdPaymentErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentErrorZ {
- CResult_PaymentIdPaymentErrorZ {
- contents: CResult_PaymentIdPaymentErrorZPtr {
+/// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state.
+pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
+ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
+ contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
-pub extern "C" fn CResult_PaymentIdPaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_PaymentIdPaymentErrorZ {
- CResult_PaymentIdPaymentErrorZ {
- contents: CResult_PaymentIdPaymentErrorZPtr {
- err: Box::into_raw(Box::new(e)),
+/// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state.
+pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
+ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
+ contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
+ err: 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_PaymentIdPaymentErrorZ_is_ok(o: &CResult_PaymentIdPaymentErrorZ) -> bool {
+pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
-pub extern "C" fn CResult_PaymentIdPaymentErrorZ_free(_res: CResult_PaymentIdPaymentErrorZ) { }
-impl Drop for CResult_PaymentIdPaymentErrorZ {
+/// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ.
+pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) { }
+impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
fn drop(&mut self) {
if self.result_ok {
if unsafe { !(self.contents.result as *mut ()).is_null() } {
let _ = unsafe { Box::from_raw(self.contents.result) };
}
} else {
- if unsafe { !(self.contents.err as *mut ()).is_null() } {
- let _ = unsafe { Box::from_raw(self.contents.err) };
- }
}
}
}
-impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>> for CResult_PaymentIdPaymentErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>> for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>) -> Self {
let contents = if o.result_ok {
let result = unsafe { o.contents.result };
unsafe { o.contents.result = core::ptr::null_mut() };
- CResult_PaymentIdPaymentErrorZPtr { result }
+ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { result }
} else {
- let err = unsafe { o.contents.err };
- unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_PaymentIdPaymentErrorZPtr { err }
+ let _ = unsafe { Box::from_raw(o.contents.err) };
+ o.contents.err = core::ptr::null_mut();
+ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { err: core::ptr::null_mut() }
};
Self {
contents,
}
}
}
-impl Clone for CResult_PaymentIdPaymentErrorZ {
+impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
fn clone(&self) -> Self {
if self.result_ok {
- Self { result_ok: true, contents: CResult_PaymentIdPaymentErrorZPtr {
- result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
+ Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
+ result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
} }
} else {
- Self { result_ok: false, contents: CResult_PaymentIdPaymentErrorZPtr {
- err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
+ Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
+ err: core::ptr::null_mut()
} }
}
}
}
#[no_mangle]
-/// Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
+/// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig`
/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_PaymentIdPaymentErrorZ_clone(orig: &CResult_PaymentIdPaymentErrorZ) -> CResult_PaymentIdPaymentErrorZ { Clone::clone(&orig) }
+pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ { Clone::clone(&orig) }
#[repr(C)]
-/// The contents of CResult_SiPrefixParseErrorZ
-pub union CResult_SiPrefixParseErrorZPtr {
+/// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ
+pub union CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
/// A pointer to the contents in the success state.
/// Reading from this pointer when `result_ok` is not set is undefined.
- pub result: *mut crate::lightning_invoice::SiPrefix,
+ pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
/// A pointer to the contents in the error state.
/// Reading from this pointer when `result_ok` is set is undefined.
- pub err: *mut crate::lightning_invoice::ParseError,
+ pub err: *mut crate::lightning::util::errors::APIError,
}
#[repr(C)]
-/// A CResult_SiPrefixParseErrorZ represents the result of a fallible operation,
-/// containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::ParseError on failure.
+/// A CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents the result of a fallible operation,
+/// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a crate::lightning::util::errors::APIError on failure.
/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult_SiPrefixParseErrorZ {
- /// The contents of this CResult_SiPrefixParseErrorZ, accessible via either
+pub struct CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
+ /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_SiPrefixParseErrorZPtr,
- /// Whether this CResult_SiPrefixParseErrorZ represents a success state.
+ pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr,
+ /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_SiPrefixParseErrorZ in the success state.
-pub extern "C" fn CResult_SiPrefixParseErrorZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixParseErrorZ {
- CResult_SiPrefixParseErrorZ {
- contents: CResult_SiPrefixParseErrorZPtr {
+/// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state.
+pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
+ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
+ contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_SiPrefixParseErrorZ in the error state.
-pub extern "C" fn CResult_SiPrefixParseErrorZ_err(e: crate::lightning_invoice::ParseError) -> CResult_SiPrefixParseErrorZ {
- CResult_SiPrefixParseErrorZ {
- contents: CResult_SiPrefixParseErrorZPtr {
+/// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state.
+pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
+ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
+ contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
err: Box::into_raw(Box::new(e)),
},
result_ok: false,
}
/// Checks if the given object is currently in the success state
#[no_mangle]
-pub extern "C" fn CResult_SiPrefixParseErrorZ_is_ok(o: &CResult_SiPrefixParseErrorZ) -> bool {
+pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_SiPrefixParseErrorZ.
-pub extern "C" fn CResult_SiPrefixParseErrorZ_free(_res: CResult_SiPrefixParseErrorZ) { }
-impl Drop for CResult_SiPrefixParseErrorZ {
+/// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.
+pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) { }
+impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
fn drop(&mut self) {
if self.result_ok {
if unsafe { !(self.contents.result as *mut ()).is_null() } {
}
}
}
-impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::ParseError>> for CResult_SiPrefixParseErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::ParseError>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>> for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>) -> Self {
let contents = if o.result_ok {
let result = unsafe { o.contents.result };
unsafe { o.contents.result = core::ptr::null_mut() };
- CResult_SiPrefixParseErrorZPtr { result }
+ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { result }
} else {
let err = unsafe { o.contents.err };
unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_SiPrefixParseErrorZPtr { err }
+ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { err }
};
Self {
contents,
}
}
}
-impl Clone for CResult_SiPrefixParseErrorZ {
+impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
fn clone(&self) -> Self {
if self.result_ok {
- Self { result_ok: true, contents: CResult_SiPrefixParseErrorZPtr {
- result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
+ Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
+ result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
} }
} else {
- Self { result_ok: false, contents: CResult_SiPrefixParseErrorZPtr {
- err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseError>::clone(unsafe { &*self.contents.err })))
+ Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
+ err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
} }
}
}
}
#[no_mangle]
-/// Creates a new CResult_SiPrefixParseErrorZ which has the same data as `orig`
+/// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig`
/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_SiPrefixParseErrorZ_clone(orig: &CResult_SiPrefixParseErrorZ) -> CResult_SiPrefixParseErrorZ { Clone::clone(&orig) }
+pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ { Clone::clone(&orig) }
#[repr(C)]
-/// The contents of CResult_InvoiceParseOrSemanticErrorZ
-pub union CResult_InvoiceParseOrSemanticErrorZPtr {
+/// The contents of CResult_PaymentSecretNoneZ
+pub union CResult_PaymentSecretNoneZPtr {
/// A pointer to the contents in the success state.
/// Reading from this pointer when `result_ok` is not set is undefined.
- pub result: *mut crate::lightning_invoice::Invoice,
- /// 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_invoice::ParseOrSemanticError,
+ pub result: *mut crate::c_types::ThirtyTwoBytes,
+ /// Note that this value is always NULL, as there are no contents in the Err variant
+ pub err: *mut core::ffi::c_void,
}
#[repr(C)]
-/// A CResult_InvoiceParseOrSemanticErrorZ represents the result of a fallible operation,
-/// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::ParseOrSemanticError on failure.
+/// A CResult_PaymentSecretNoneZ represents the result of a fallible operation,
+/// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult_InvoiceParseOrSemanticErrorZ {
- /// The contents of this CResult_InvoiceParseOrSemanticErrorZ, accessible via either
+pub struct CResult_PaymentSecretNoneZ {
+ /// The contents of this CResult_PaymentSecretNoneZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_InvoiceParseOrSemanticErrorZPtr,
- /// Whether this CResult_InvoiceParseOrSemanticErrorZ represents a success state.
+ pub contents: CResult_PaymentSecretNoneZPtr,
+ /// Whether this CResult_PaymentSecretNoneZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_InvoiceParseOrSemanticErrorZ in the success state.
-pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceParseOrSemanticErrorZ {
- CResult_InvoiceParseOrSemanticErrorZ {
- contents: CResult_InvoiceParseOrSemanticErrorZPtr {
+/// Creates a new CResult_PaymentSecretNoneZ in the success state.
+pub extern "C" fn CResult_PaymentSecretNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretNoneZ {
+ CResult_PaymentSecretNoneZ {
+ contents: CResult_PaymentSecretNoneZPtr {
result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_InvoiceParseOrSemanticErrorZ in the error state.
-pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_err(e: crate::lightning_invoice::ParseOrSemanticError) -> CResult_InvoiceParseOrSemanticErrorZ {
- CResult_InvoiceParseOrSemanticErrorZ {
- contents: CResult_InvoiceParseOrSemanticErrorZPtr {
- err: Box::into_raw(Box::new(e)),
+/// Creates a new CResult_PaymentSecretNoneZ in the error state.
+pub extern "C" fn CResult_PaymentSecretNoneZ_err() -> CResult_PaymentSecretNoneZ {
+ CResult_PaymentSecretNoneZ {
+ contents: CResult_PaymentSecretNoneZPtr {
+ 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_InvoiceParseOrSemanticErrorZ_is_ok(o: &CResult_InvoiceParseOrSemanticErrorZ) -> bool {
+pub extern "C" fn CResult_PaymentSecretNoneZ_is_ok(o: &CResult_PaymentSecretNoneZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_InvoiceParseOrSemanticErrorZ.
-pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_free(_res: CResult_InvoiceParseOrSemanticErrorZ) { }
-impl Drop for CResult_InvoiceParseOrSemanticErrorZ {
+/// Frees any resources used by the CResult_PaymentSecretNoneZ.
+pub extern "C" fn CResult_PaymentSecretNoneZ_free(_res: CResult_PaymentSecretNoneZ) { }
+impl Drop for CResult_PaymentSecretNoneZ {
fn drop(&mut self) {
if self.result_ok {
if unsafe { !(self.contents.result as *mut ()).is_null() } {
let _ = unsafe { Box::from_raw(self.contents.result) };
}
} else {
- 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_invoice::Invoice, crate::lightning_invoice::ParseOrSemanticError>> for CResult_InvoiceParseOrSemanticErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::ParseOrSemanticError>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>> for CResult_PaymentSecretNoneZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>) -> Self {
let contents = if o.result_ok {
let result = unsafe { o.contents.result };
unsafe { o.contents.result = core::ptr::null_mut() };
- CResult_InvoiceParseOrSemanticErrorZPtr { result }
+ CResult_PaymentSecretNoneZPtr { result }
} else {
- let err = unsafe { o.contents.err };
- unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_InvoiceParseOrSemanticErrorZPtr { err }
+ let _ = unsafe { Box::from_raw(o.contents.err) };
+ o.contents.err = core::ptr::null_mut();
+ CResult_PaymentSecretNoneZPtr { err: core::ptr::null_mut() }
};
Self {
contents,
}
}
}
-impl Clone for CResult_InvoiceParseOrSemanticErrorZ {
+impl Clone for CResult_PaymentSecretNoneZ {
fn clone(&self) -> Self {
if self.result_ok {
- Self { result_ok: true, contents: CResult_InvoiceParseOrSemanticErrorZPtr {
- result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
+ Self { result_ok: true, contents: CResult_PaymentSecretNoneZPtr {
+ result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
} }
} else {
- Self { result_ok: false, contents: CResult_InvoiceParseOrSemanticErrorZPtr {
- err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseOrSemanticError>::clone(unsafe { &*self.contents.err })))
+ Self { result_ok: false, contents: CResult_PaymentSecretNoneZPtr {
+ err: core::ptr::null_mut()
} }
}
}
}
#[no_mangle]
-/// Creates a new CResult_InvoiceParseOrSemanticErrorZ which has the same data as `orig`
+/// Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig`
/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_clone(orig: &CResult_InvoiceParseOrSemanticErrorZ) -> CResult_InvoiceParseOrSemanticErrorZ { Clone::clone(&orig) }
+pub extern "C" fn CResult_PaymentSecretNoneZ_clone(orig: &CResult_PaymentSecretNoneZ) -> CResult_PaymentSecretNoneZ { Clone::clone(&orig) }
#[repr(C)]
-/// The contents of CResult_SignedRawInvoiceParseErrorZ
-pub union CResult_SignedRawInvoiceParseErrorZPtr {
+/// The contents of CResult_PaymentSecretAPIErrorZ
+pub union CResult_PaymentSecretAPIErrorZPtr {
/// 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_invoice::SignedRawInvoice,
+ pub result: *mut crate::c_types::ThirtyTwoBytes,
/// A pointer to the contents in the error state.
/// Reading from this pointer when `result_ok` is set is undefined.
- pub err: *mut crate::lightning_invoice::ParseError,
+ pub err: *mut crate::lightning::util::errors::APIError,
}
#[repr(C)]
-/// A CResult_SignedRawInvoiceParseErrorZ represents the result of a fallible operation,
-/// containing a crate::lightning_invoice::SignedRawInvoice on success and a crate::lightning_invoice::ParseError on failure.
+/// A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
+/// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult_SignedRawInvoiceParseErrorZ {
- /// The contents of this CResult_SignedRawInvoiceParseErrorZ, accessible via either
+pub struct CResult_PaymentSecretAPIErrorZ {
+ /// The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_SignedRawInvoiceParseErrorZPtr,
- /// Whether this CResult_SignedRawInvoiceParseErrorZ represents a success state.
+ pub contents: CResult_PaymentSecretAPIErrorZPtr,
+ /// Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_SignedRawInvoiceParseErrorZ in the success state.
-pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_ok(o: crate::lightning_invoice::SignedRawInvoice) -> CResult_SignedRawInvoiceParseErrorZ {
- CResult_SignedRawInvoiceParseErrorZ {
- contents: CResult_SignedRawInvoiceParseErrorZPtr {
+/// Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
+pub extern "C" fn CResult_PaymentSecretAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretAPIErrorZ {
+ CResult_PaymentSecretAPIErrorZ {
+ contents: CResult_PaymentSecretAPIErrorZPtr {
result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_SignedRawInvoiceParseErrorZ in the error state.
-pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_err(e: crate::lightning_invoice::ParseError) -> CResult_SignedRawInvoiceParseErrorZ {
- CResult_SignedRawInvoiceParseErrorZ {
- contents: CResult_SignedRawInvoiceParseErrorZPtr {
+/// Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
+pub extern "C" fn CResult_PaymentSecretAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentSecretAPIErrorZ {
+ CResult_PaymentSecretAPIErrorZ {
+ contents: CResult_PaymentSecretAPIErrorZPtr {
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_SignedRawInvoiceParseErrorZ_is_ok(o: &CResult_SignedRawInvoiceParseErrorZ) -> bool {
+pub extern "C" fn CResult_PaymentSecretAPIErrorZ_is_ok(o: &CResult_PaymentSecretAPIErrorZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_SignedRawInvoiceParseErrorZ.
-pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_free(_res: CResult_SignedRawInvoiceParseErrorZ) { }
-impl Drop for CResult_SignedRawInvoiceParseErrorZ {
+/// Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
+pub extern "C" fn CResult_PaymentSecretAPIErrorZ_free(_res: CResult_PaymentSecretAPIErrorZ) { }
+impl Drop for CResult_PaymentSecretAPIErrorZ {
fn drop(&mut self) {
if self.result_ok {
if unsafe { !(self.contents.result as *mut ()).is_null() } {
}
}
}
-impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, crate::lightning_invoice::ParseError>> for CResult_SignedRawInvoiceParseErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, crate::lightning_invoice::ParseError>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentSecretAPIErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
let contents = if o.result_ok {
let result = unsafe { o.contents.result };
unsafe { o.contents.result = core::ptr::null_mut() };
- CResult_SignedRawInvoiceParseErrorZPtr { result }
+ CResult_PaymentSecretAPIErrorZPtr { result }
} else {
let err = unsafe { o.contents.err };
unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_SignedRawInvoiceParseErrorZPtr { err }
+ CResult_PaymentSecretAPIErrorZPtr { err }
};
Self {
contents,
}
}
}
-impl Clone for CResult_SignedRawInvoiceParseErrorZ {
+impl Clone for CResult_PaymentSecretAPIErrorZ {
fn clone(&self) -> Self {
if self.result_ok {
- Self { result_ok: true, contents: CResult_SignedRawInvoiceParseErrorZPtr {
- result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawInvoice>::clone(unsafe { &*self.contents.result })))
+ Self { result_ok: true, contents: CResult_PaymentSecretAPIErrorZPtr {
+ result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
} }
} else {
- Self { result_ok: false, contents: CResult_SignedRawInvoiceParseErrorZPtr {
- err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseError>::clone(unsafe { &*self.contents.err })))
+ Self { result_ok: false, contents: CResult_PaymentSecretAPIErrorZPtr {
+ err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
} }
}
}
}
#[no_mangle]
-/// Creates a new CResult_SignedRawInvoiceParseErrorZ which has the same data as `orig`
-/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_clone(orig: &CResult_SignedRawInvoiceParseErrorZ) -> CResult_SignedRawInvoiceParseErrorZ { Clone::clone(&orig) }
-#[repr(C)]
-/// A tuple of 3 elements. See the individual fields for the types contained.
-pub struct C3Tuple_RawInvoice_u832InvoiceSignatureZ {
- /// The element at position 0
- pub a: crate::lightning_invoice::RawInvoice,
- /// The element at position 1
- pub b: crate::c_types::ThirtyTwoBytes,
- /// The element at position 2
- pub c: crate::lightning_invoice::InvoiceSignature,
-}
-impl From<(crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)> for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
- fn from (tup: (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)) -> Self {
- Self {
- a: tup.0,
- b: tup.1,
- c: tup.2,
- }
- }
-}
-impl C3Tuple_RawInvoice_u832InvoiceSignatureZ {
- #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature) {
- (self.a, self.b, self.c)
- }
-}
-impl Clone for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
- 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`
+/// Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig: &C3Tuple_RawInvoice_u832InvoiceSignatureZ) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ { Clone::clone(&orig) }
-/// Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
-#[no_mangle]
-pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a: crate::lightning_invoice::RawInvoice, b: crate::c_types::ThirtyTwoBytes, c: crate::lightning_invoice::InvoiceSignature) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ {
- C3Tuple_RawInvoice_u832InvoiceSignatureZ { a, b, c, }
-}
-
-#[no_mangle]
-/// Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
-pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res: C3Tuple_RawInvoice_u832InvoiceSignatureZ) { }
+pub extern "C" fn CResult_PaymentSecretAPIErrorZ_clone(orig: &CResult_PaymentSecretAPIErrorZ) -> CResult_PaymentSecretAPIErrorZ { Clone::clone(&orig) }
#[repr(C)]
-/// The contents of CResult_PayeePubKeyErrorZ
-pub union CResult_PayeePubKeyErrorZPtr {
+/// The contents of CResult_PaymentPreimageAPIErrorZ
+pub union CResult_PaymentPreimageAPIErrorZPtr {
/// A pointer to the contents in the success state.
/// Reading from this pointer when `result_ok` is not set is undefined.
- pub result: *mut crate::lightning_invoice::PayeePubKey,
+ pub result: *mut crate::c_types::ThirtyTwoBytes,
/// A pointer to the contents in the error state.
/// Reading from this pointer when `result_ok` is set is undefined.
- pub err: *mut crate::c_types::Secp256k1Error,
+ pub err: *mut crate::lightning::util::errors::APIError,
}
#[repr(C)]
-/// A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
-/// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
+/// A CResult_PaymentPreimageAPIErrorZ represents the result of a fallible operation,
+/// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult_PayeePubKeyErrorZ {
- /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either
+pub struct CResult_PaymentPreimageAPIErrorZ {
+ /// The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_PayeePubKeyErrorZPtr,
- /// Whether this CResult_PayeePubKeyErrorZ represents a success state.
+ pub contents: CResult_PaymentPreimageAPIErrorZPtr,
+ /// Whether this CResult_PaymentPreimageAPIErrorZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_PayeePubKeyErrorZ in the success state.
-pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ {
- CResult_PayeePubKeyErrorZ {
- contents: CResult_PayeePubKeyErrorZPtr {
+/// Creates a new CResult_PaymentPreimageAPIErrorZ in the success state.
+pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentPreimageAPIErrorZ {
+ CResult_PaymentPreimageAPIErrorZ {
+ contents: CResult_PaymentPreimageAPIErrorZPtr {
result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_PayeePubKeyErrorZ in the error state.
-pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ {
- CResult_PayeePubKeyErrorZ {
- contents: CResult_PayeePubKeyErrorZPtr {
+/// Creates a new CResult_PaymentPreimageAPIErrorZ in the error state.
+pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentPreimageAPIErrorZ {
+ CResult_PaymentPreimageAPIErrorZ {
+ contents: CResult_PaymentPreimageAPIErrorZPtr {
err: Box::into_raw(Box::new(e)),
},
result_ok: false,
}
/// Checks if the given object is currently in the success state
#[no_mangle]
-pub extern "C" fn CResult_PayeePubKeyErrorZ_is_ok(o: &CResult_PayeePubKeyErrorZ) -> bool {
+pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_is_ok(o: &CResult_PaymentPreimageAPIErrorZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_PayeePubKeyErrorZ.
-pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { }
-impl Drop for CResult_PayeePubKeyErrorZ {
+/// Frees any resources used by the CResult_PaymentPreimageAPIErrorZ.
+pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_free(_res: CResult_PaymentPreimageAPIErrorZ) { }
+impl Drop for CResult_PaymentPreimageAPIErrorZ {
fn drop(&mut self) {
if self.result_ok {
if unsafe { !(self.contents.result as *mut ()).is_null() } {
}
}
}
-impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeyErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentPreimageAPIErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
let contents = if o.result_ok {
let result = unsafe { o.contents.result };
unsafe { o.contents.result = core::ptr::null_mut() };
- CResult_PayeePubKeyErrorZPtr { result }
+ CResult_PaymentPreimageAPIErrorZPtr { result }
} else {
let err = unsafe { o.contents.err };
unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_PayeePubKeyErrorZPtr { err }
+ CResult_PaymentPreimageAPIErrorZPtr { err }
};
Self {
contents,
}
}
}
-impl Clone for CResult_PayeePubKeyErrorZ {
+impl Clone for CResult_PaymentPreimageAPIErrorZ {
fn clone(&self) -> Self {
if self.result_ok {
- Self { result_ok: true, contents: CResult_PayeePubKeyErrorZPtr {
- result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
+ Self { result_ok: true, contents: CResult_PaymentPreimageAPIErrorZPtr {
+ result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
} }
} else {
- Self { result_ok: false, contents: CResult_PayeePubKeyErrorZPtr {
- err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
+ Self { result_ok: false, contents: CResult_PaymentPreimageAPIErrorZPtr {
+ err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
} }
}
}
}
#[no_mangle]
-/// Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
+/// Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig`
/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_PayeePubKeyErrorZ_clone(orig: &CResult_PayeePubKeyErrorZ) -> CResult_PayeePubKeyErrorZ { Clone::clone(&orig) }
+pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_clone(orig: &CResult_PaymentPreimageAPIErrorZ) -> CResult_PaymentPreimageAPIErrorZ { Clone::clone(&orig) }
#[repr(C)]
-/// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
-/// This corresponds to std::vector in C++
-pub struct CVec_PrivateRouteZ {
- /// 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_invoice::PrivateRoute,
- /// The number of elements pointed to by `data`.
- pub datalen: usize
+/// The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
+pub union CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
+ /// A pointer to the contents in the success state.
+ /// Reading from this pointer when `result_ok` is not set is undefined.
+ pub result: *mut crate::lightning::ln::channelmanager::CounterpartyForwardingInfo,
+ /// 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,
}
-impl CVec_PrivateRouteZ {
- #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
- 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_invoice::PrivateRoute] {
- unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
- }
-}
-impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
- fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> 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_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
-impl Drop for CVec_PrivateRouteZ {
- fn drop(&mut self) {
- if self.datalen == 0 { return; }
- unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
- }
-}
-impl Clone for CVec_PrivateRouteZ {
- 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_PositiveTimestampCreationErrorZ
-pub union CResult_PositiveTimestampCreationErrorZPtr {
- /// 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_invoice::PositiveTimestamp,
- /// 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_invoice::CreationError,
-}
-#[repr(C)]
-/// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
-/// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
-/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult_PositiveTimestampCreationErrorZ {
- /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
- /// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_PositiveTimestampCreationErrorZPtr,
- /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
- pub result_ok: bool,
+#[repr(C)]
+/// A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
+/// containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo 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_CounterpartyForwardingInfoDecodeErrorZ {
+ /// The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
+ /// `err` or `result` depending on the state of `result_ok`.
+ pub contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr,
+ /// Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
+ pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
-pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
- CResult_PositiveTimestampCreationErrorZ {
- contents: CResult_PositiveTimestampCreationErrorZPtr {
+/// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
+pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::CounterpartyForwardingInfo) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
+ CResult_CounterpartyForwardingInfoDecodeErrorZ {
+ contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
-pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
- CResult_PositiveTimestampCreationErrorZ {
- contents: CResult_PositiveTimestampCreationErrorZPtr {
+/// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
+pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
+ CResult_CounterpartyForwardingInfoDecodeErrorZ {
+ contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
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_PositiveTimestampCreationErrorZ_is_ok(o: &CResult_PositiveTimestampCreationErrorZ) -> bool {
+pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
-pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
-impl Drop for CResult_PositiveTimestampCreationErrorZ {
+/// Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
+pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res: CResult_CounterpartyForwardingInfoDecodeErrorZ) { }
+impl Drop for CResult_CounterpartyForwardingInfoDecodeErrorZ {
fn drop(&mut self) {
if self.result_ok {
if unsafe { !(self.contents.result as *mut ()).is_null() } {
}
}
}
-impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyForwardingInfoDecodeErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, 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_PositiveTimestampCreationErrorZPtr { result }
+ CResult_CounterpartyForwardingInfoDecodeErrorZPtr { result }
} else {
let err = unsafe { o.contents.err };
unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_PositiveTimestampCreationErrorZPtr { err }
+ CResult_CounterpartyForwardingInfoDecodeErrorZPtr { err }
};
Self {
contents,
}
}
}
-impl Clone for CResult_PositiveTimestampCreationErrorZ {
+impl Clone for CResult_CounterpartyForwardingInfoDecodeErrorZ {
fn clone(&self) -> Self {
if self.result_ok {
- Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
- result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
+ Self { result_ok: true, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
+ result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo>::clone(unsafe { &*self.contents.result })))
} }
} else {
- Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
- err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
+ Self { result_ok: false, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
+ err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
} }
}
}
}
#[no_mangle]
-/// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
+/// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) }
+pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> CResult_CounterpartyForwardingInfoDecodeErrorZ { Clone::clone(&orig) }
#[repr(C)]
-/// The contents of CResult_NoneSemanticErrorZ
-pub union CResult_NoneSemanticErrorZPtr {
- /// Note that this value is always NULL, as there are no contents in the OK variant
- pub result: *mut core::ffi::c_void,
+/// The contents of CResult_ChannelCounterpartyDecodeErrorZ
+pub union CResult_ChannelCounterpartyDecodeErrorZPtr {
+ /// A pointer to the contents in the success state.
+ /// Reading from this pointer when `result_ok` is not set is undefined.
+ pub result: *mut crate::lightning::ln::channelmanager::ChannelCounterparty,
/// 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_invoice::SemanticError,
+ pub err: *mut crate::lightning::ln::msgs::DecodeError,
}
#[repr(C)]
-/// A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
-/// containing a () on success and a crate::lightning_invoice::SemanticError on failure.
+/// A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
+/// containing a crate::lightning::ln::channelmanager::ChannelCounterparty 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_NoneSemanticErrorZ {
- /// The contents of this CResult_NoneSemanticErrorZ, accessible via either
+pub struct CResult_ChannelCounterpartyDecodeErrorZ {
+ /// The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_NoneSemanticErrorZPtr,
- /// Whether this CResult_NoneSemanticErrorZ represents a success state.
+ pub contents: CResult_ChannelCounterpartyDecodeErrorZPtr,
+ /// Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_NoneSemanticErrorZ in the success state.
-pub extern "C" fn CResult_NoneSemanticErrorZ_ok() -> CResult_NoneSemanticErrorZ {
- CResult_NoneSemanticErrorZ {
- contents: CResult_NoneSemanticErrorZPtr {
- result: core::ptr::null_mut(),
+/// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
+pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelCounterparty) -> CResult_ChannelCounterpartyDecodeErrorZ {
+ CResult_ChannelCounterpartyDecodeErrorZ {
+ contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
+ result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_NoneSemanticErrorZ in the error state.
-pub extern "C" fn CResult_NoneSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_NoneSemanticErrorZ {
- CResult_NoneSemanticErrorZ {
- contents: CResult_NoneSemanticErrorZPtr {
+/// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
+pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelCounterpartyDecodeErrorZ {
+ CResult_ChannelCounterpartyDecodeErrorZ {
+ contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
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_NoneSemanticErrorZ_is_ok(o: &CResult_NoneSemanticErrorZ) -> bool {
+pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o: &CResult_ChannelCounterpartyDecodeErrorZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_NoneSemanticErrorZ.
-pub extern "C" fn CResult_NoneSemanticErrorZ_free(_res: CResult_NoneSemanticErrorZ) { }
-impl Drop for CResult_NoneSemanticErrorZ {
+/// Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
+pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_free(_res: CResult_ChannelCounterpartyDecodeErrorZ) { }
+impl Drop for CResult_ChannelCounterpartyDecodeErrorZ {
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_invoice::SemanticError>> for CResult_NoneSemanticErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelCounterpartyDecodeErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>) -> Self {
let contents = if o.result_ok {
- let _ = unsafe { Box::from_raw(o.contents.result) };
- o.contents.result = core::ptr::null_mut();
- CResult_NoneSemanticErrorZPtr { result: core::ptr::null_mut() }
+ let result = unsafe { o.contents.result };
+ unsafe { o.contents.result = core::ptr::null_mut() };
+ CResult_ChannelCounterpartyDecodeErrorZPtr { result }
} else {
let err = unsafe { o.contents.err };
unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_NoneSemanticErrorZPtr { err }
+ CResult_ChannelCounterpartyDecodeErrorZPtr { err }
};
Self {
contents,
}
}
}
-impl Clone for CResult_NoneSemanticErrorZ {
+impl Clone for CResult_ChannelCounterpartyDecodeErrorZ {
fn clone(&self) -> Self {
if self.result_ok {
- Self { result_ok: true, contents: CResult_NoneSemanticErrorZPtr {
- result: core::ptr::null_mut()
+ Self { result_ok: true, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
+ result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelCounterparty>::clone(unsafe { &*self.contents.result })))
} }
} else {
- Self { result_ok: false, contents: CResult_NoneSemanticErrorZPtr {
- err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
+ Self { result_ok: false, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
+ err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
} }
}
}
}
#[no_mangle]
-/// Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
+/// Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_NoneSemanticErrorZ_clone(orig: &CResult_NoneSemanticErrorZ) -> CResult_NoneSemanticErrorZ { Clone::clone(&orig) }
+pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_clone(orig: &CResult_ChannelCounterpartyDecodeErrorZ) -> CResult_ChannelCounterpartyDecodeErrorZ { Clone::clone(&orig) }
#[repr(C)]
-/// The contents of CResult_InvoiceSemanticErrorZ
-pub union CResult_InvoiceSemanticErrorZPtr {
+/// The contents of CResult_ChannelDetailsDecodeErrorZ
+pub union CResult_ChannelDetailsDecodeErrorZPtr {
/// 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_invoice::Invoice,
+ pub result: *mut crate::lightning::ln::channelmanager::ChannelDetails,
/// 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_invoice::SemanticError,
+ pub err: *mut crate::lightning::ln::msgs::DecodeError,
}
#[repr(C)]
-/// A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
-/// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
+/// A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
+/// containing a crate::lightning::ln::channelmanager::ChannelDetails 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_InvoiceSemanticErrorZ {
- /// The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
+pub struct CResult_ChannelDetailsDecodeErrorZ {
+ /// The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_InvoiceSemanticErrorZPtr,
- /// Whether this CResult_InvoiceSemanticErrorZ represents a success state.
+ pub contents: CResult_ChannelDetailsDecodeErrorZPtr,
+ /// Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_InvoiceSemanticErrorZ in the success state.
-pub extern "C" fn CResult_InvoiceSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSemanticErrorZ {
- CResult_InvoiceSemanticErrorZ {
- contents: CResult_InvoiceSemanticErrorZPtr {
+/// Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
+pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelDetails) -> CResult_ChannelDetailsDecodeErrorZ {
+ CResult_ChannelDetailsDecodeErrorZ {
+ contents: CResult_ChannelDetailsDecodeErrorZPtr {
result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_InvoiceSemanticErrorZ in the error state.
-pub extern "C" fn CResult_InvoiceSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_InvoiceSemanticErrorZ {
- CResult_InvoiceSemanticErrorZ {
- contents: CResult_InvoiceSemanticErrorZPtr {
+/// Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
+pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDetailsDecodeErrorZ {
+ CResult_ChannelDetailsDecodeErrorZ {
+ contents: CResult_ChannelDetailsDecodeErrorZPtr {
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_InvoiceSemanticErrorZ_is_ok(o: &CResult_InvoiceSemanticErrorZ) -> bool {
+pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_is_ok(o: &CResult_ChannelDetailsDecodeErrorZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_InvoiceSemanticErrorZ.
-pub extern "C" fn CResult_InvoiceSemanticErrorZ_free(_res: CResult_InvoiceSemanticErrorZ) { }
-impl Drop for CResult_InvoiceSemanticErrorZ {
+/// Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
+pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_free(_res: CResult_ChannelDetailsDecodeErrorZ) { }
+impl Drop for CResult_ChannelDetailsDecodeErrorZ {
fn drop(&mut self) {
if self.result_ok {
if unsafe { !(self.contents.result as *mut ()).is_null() } {
}
}
}
-impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>> for CResult_InvoiceSemanticErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelDetailsDecodeErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, 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_InvoiceSemanticErrorZPtr { result }
+ CResult_ChannelDetailsDecodeErrorZPtr { result }
} else {
let err = unsafe { o.contents.err };
unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_InvoiceSemanticErrorZPtr { err }
+ CResult_ChannelDetailsDecodeErrorZPtr { err }
};
Self {
contents,
}
}
}
-impl Clone for CResult_InvoiceSemanticErrorZ {
+impl Clone for CResult_ChannelDetailsDecodeErrorZ {
fn clone(&self) -> Self {
if self.result_ok {
- Self { result_ok: true, contents: CResult_InvoiceSemanticErrorZPtr {
- result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
+ Self { result_ok: true, contents: CResult_ChannelDetailsDecodeErrorZPtr {
+ result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelDetails>::clone(unsafe { &*self.contents.result })))
} }
} else {
- Self { result_ok: false, contents: CResult_InvoiceSemanticErrorZPtr {
- err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
+ Self { result_ok: false, contents: CResult_ChannelDetailsDecodeErrorZPtr {
+ err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
} }
}
}
}
#[no_mangle]
-/// Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
+/// Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_InvoiceSemanticErrorZ_clone(orig: &CResult_InvoiceSemanticErrorZ) -> CResult_InvoiceSemanticErrorZ { Clone::clone(&orig) }
+pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_clone(orig: &CResult_ChannelDetailsDecodeErrorZ) -> CResult_ChannelDetailsDecodeErrorZ { Clone::clone(&orig) }
#[repr(C)]
-/// The contents of CResult_DescriptionCreationErrorZ
-pub union CResult_DescriptionCreationErrorZPtr {
+/// The contents of CResult_PhantomRouteHintsDecodeErrorZ
+pub union CResult_PhantomRouteHintsDecodeErrorZPtr {
/// 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_invoice::Description,
+ pub result: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
/// 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_invoice::CreationError,
+ pub err: *mut crate::lightning::ln::msgs::DecodeError,
}
#[repr(C)]
-/// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
-/// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
+/// A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
+/// containing a crate::lightning::ln::channelmanager::PhantomRouteHints 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_DescriptionCreationErrorZ {
- /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
+pub struct CResult_PhantomRouteHintsDecodeErrorZ {
+ /// The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_DescriptionCreationErrorZPtr,
- /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
+ pub contents: CResult_PhantomRouteHintsDecodeErrorZPtr,
+ /// Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_DescriptionCreationErrorZ in the success state.
-pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
- CResult_DescriptionCreationErrorZ {
- contents: CResult_DescriptionCreationErrorZPtr {
- result: Box::into_raw(Box::new(o)),
- },
+/// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
+pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PhantomRouteHints) -> CResult_PhantomRouteHintsDecodeErrorZ {
+ CResult_PhantomRouteHintsDecodeErrorZ {
+ contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
+ result: Box::into_raw(Box::new(o)),
+ },
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_DescriptionCreationErrorZ in the error state.
-pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
- CResult_DescriptionCreationErrorZ {
- contents: CResult_DescriptionCreationErrorZPtr {
+/// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
+pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PhantomRouteHintsDecodeErrorZ {
+ CResult_PhantomRouteHintsDecodeErrorZ {
+ contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
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_DescriptionCreationErrorZ_is_ok(o: &CResult_DescriptionCreationErrorZ) -> bool {
+pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o: &CResult_PhantomRouteHintsDecodeErrorZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_DescriptionCreationErrorZ.
-pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
-impl Drop for CResult_DescriptionCreationErrorZ {
+/// Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
+pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_free(_res: CResult_PhantomRouteHintsDecodeErrorZ) { }
+impl Drop for CResult_PhantomRouteHintsDecodeErrorZ {
fn drop(&mut self) {
if self.result_ok {
if unsafe { !(self.contents.result as *mut ()).is_null() } {
}
}
}
-impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>> for CResult_PhantomRouteHintsDecodeErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, 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_DescriptionCreationErrorZPtr { result }
+ CResult_PhantomRouteHintsDecodeErrorZPtr { result }
} else {
let err = unsafe { o.contents.err };
unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_DescriptionCreationErrorZPtr { err }
+ CResult_PhantomRouteHintsDecodeErrorZPtr { err }
};
Self {
contents,
}
}
}
-impl Clone for CResult_DescriptionCreationErrorZ {
+impl Clone for CResult_PhantomRouteHintsDecodeErrorZ {
fn clone(&self) -> Self {
if self.result_ok {
- Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
- result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
+ Self { result_ok: true, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
+ result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PhantomRouteHints>::clone(unsafe { &*self.contents.result })))
} }
} else {
- Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
- err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
+ Self { result_ok: false, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
+ err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
} }
}
}
}
#[no_mangle]
-/// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
+/// Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig`
/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) }
+pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_clone(orig: &CResult_PhantomRouteHintsDecodeErrorZ) -> CResult_PhantomRouteHintsDecodeErrorZ { Clone::clone(&orig) }
#[repr(C)]
-/// The contents of CResult_PrivateRouteCreationErrorZ
-pub union CResult_PrivateRouteCreationErrorZPtr {
+/// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
+/// This corresponds to std::vector in C++
+pub struct CVec_ChannelMonitorZ {
+ /// 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::chain::channelmonitor::ChannelMonitor,
+ /// The number of elements pointed to by `data`.
+ pub datalen: usize
+}
+impl CVec_ChannelMonitorZ {
+ #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
+ 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::chain::channelmonitor::ChannelMonitor] {
+ unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
+ }
+}
+impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
+ fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> 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_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
+impl Drop for CVec_ChannelMonitorZ {
+ fn drop(&mut self) {
+ if self.datalen == 0 { return; }
+ unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
+ }
+}
+#[repr(C)]
+/// A tuple of 2 elements. See the individual fields for the types contained.
+pub struct C2Tuple_BlockHashChannelManagerZ {
+ /// The element at position 0
+ pub a: crate::c_types::ThirtyTwoBytes,
+ /// The element at position 1
+ pub b: crate::lightning::ln::channelmanager::ChannelManager,
+}
+impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
+ fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
+ Self {
+ a: tup.0,
+ b: tup.1,
+ }
+ }
+}
+impl C2Tuple_BlockHashChannelManagerZ {
+ #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
+ (self.a, self.b)
+ }
+}
+/// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
+#[no_mangle]
+pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
+ C2Tuple_BlockHashChannelManagerZ { a, b, }
+}
+
+#[no_mangle]
+/// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
+pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
+#[repr(C)]
+/// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
+pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
/// 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_invoice::PrivateRoute,
+ pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
/// 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_invoice::CreationError,
+ pub err: *mut crate::lightning::ln::msgs::DecodeError,
}
#[repr(C)]
-/// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
-/// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
+/// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
+/// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult_PrivateRouteCreationErrorZ {
- /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
+pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
+ /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_PrivateRouteCreationErrorZPtr,
- /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
+ pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
+ /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
-pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
- CResult_PrivateRouteCreationErrorZ {
- contents: CResult_PrivateRouteCreationErrorZPtr {
+/// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
+pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
+ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
+ contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
-pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
- CResult_PrivateRouteCreationErrorZ {
- contents: CResult_PrivateRouteCreationErrorZPtr {
+/// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
+pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
+ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
+ contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
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_PrivateRouteCreationErrorZ_is_ok(o: &CResult_PrivateRouteCreationErrorZ) -> bool {
+pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
-pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
-impl Drop for CResult_PrivateRouteCreationErrorZ {
+/// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
+pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
+impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
fn drop(&mut self) {
if self.result_ok {
if unsafe { !(self.contents.result as *mut ()).is_null() } {
}
}
}
-impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, 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_PrivateRouteCreationErrorZPtr { result }
+ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
} else {
let err = unsafe { o.contents.err };
unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_PrivateRouteCreationErrorZPtr { err }
+ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
};
Self {
contents,
}
}
}
-impl Clone for CResult_PrivateRouteCreationErrorZ {
- fn clone(&self) -> Self {
- if self.result_ok {
- Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
- result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
- } }
- } else {
- Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
- err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
- } }
- }
- }
-}
-#[no_mangle]
-/// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
-/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) }
#[repr(C)]
-/// The contents of CResult_StringErrorZ
-pub union CResult_StringErrorZPtr {
+/// The contents of CResult_ChannelConfigDecodeErrorZ
+pub union CResult_ChannelConfigDecodeErrorZPtr {
/// 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::Str,
+ pub result: *mut crate::lightning::util::config::ChannelConfig,
/// A pointer to the contents in the error state.
/// Reading from this pointer when `result_ok` is set is undefined.
- pub err: *mut crate::c_types::Secp256k1Error,
+ pub err: *mut crate::lightning::ln::msgs::DecodeError,
}
#[repr(C)]
-/// A CResult_StringErrorZ represents the result of a fallible operation,
-/// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
+/// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
+/// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult_StringErrorZ {
- /// The contents of this CResult_StringErrorZ, accessible via either
+pub struct CResult_ChannelConfigDecodeErrorZ {
+ /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_StringErrorZPtr,
- /// Whether this CResult_StringErrorZ represents a success state.
+ pub contents: CResult_ChannelConfigDecodeErrorZPtr,
+ /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_StringErrorZ in the success state.
-pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::Str) -> CResult_StringErrorZ {
- CResult_StringErrorZ {
- contents: CResult_StringErrorZPtr {
+/// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
+pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
+ CResult_ChannelConfigDecodeErrorZ {
+ contents: CResult_ChannelConfigDecodeErrorZPtr {
result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_StringErrorZ in the error state.
-pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ {
- CResult_StringErrorZ {
- contents: CResult_StringErrorZPtr {
+/// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
+pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
+ CResult_ChannelConfigDecodeErrorZ {
+ contents: CResult_ChannelConfigDecodeErrorZPtr {
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_StringErrorZ_is_ok(o: &CResult_StringErrorZ) -> bool {
+pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_is_ok(o: &CResult_ChannelConfigDecodeErrorZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_StringErrorZ.
-pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { }
-impl Drop for CResult_StringErrorZ {
+/// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
+pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
+impl Drop for CResult_ChannelConfigDecodeErrorZ {
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::Str, crate::c_types::Secp256k1Error>> for CResult_StringErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, 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_StringErrorZPtr { result }
+ CResult_ChannelConfigDecodeErrorZPtr { result }
} else {
let err = unsafe { o.contents.err };
unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_StringErrorZPtr { err }
+ CResult_ChannelConfigDecodeErrorZPtr { err }
};
Self {
contents,
}
}
}
+impl Clone for CResult_ChannelConfigDecodeErrorZ {
+ fn clone(&self) -> Self {
+ if self.result_ok {
+ Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
+ result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
+ } }
+ } else {
+ Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
+ err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
+ } }
+ }
+ }
+}
+#[no_mangle]
+/// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
+/// but with all dynamically-allocated buffers duplicated in new buffers.
+pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) }
#[repr(C)]
-/// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
-pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
+/// The contents of CResult_OutPointDecodeErrorZ
+pub union CResult_OutPointDecodeErrorZPtr {
/// 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::chain::channelmonitor::ChannelMonitorUpdate,
+ pub result: *mut crate::lightning::chain::transaction::OutPoint,
/// 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_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
-/// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
+/// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
+/// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
- /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
+pub struct CResult_OutPointDecodeErrorZ {
+ /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
- /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
+ pub contents: CResult_OutPointDecodeErrorZPtr,
+ /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
-pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
- CResult_ChannelMonitorUpdateDecodeErrorZ {
- contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
+/// Creates a new CResult_OutPointDecodeErrorZ in the success state.
+pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
+ CResult_OutPointDecodeErrorZ {
+ contents: CResult_OutPointDecodeErrorZPtr {
result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
-pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
- CResult_ChannelMonitorUpdateDecodeErrorZ {
- contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
+/// Creates a new CResult_OutPointDecodeErrorZ in the error state.
+pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
+ CResult_OutPointDecodeErrorZ {
+ contents: CResult_OutPointDecodeErrorZPtr {
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_ChannelMonitorUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> bool {
+pub extern "C" fn CResult_OutPointDecodeErrorZ_is_ok(o: &CResult_OutPointDecodeErrorZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
-pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
-impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
+/// Frees any resources used by the CResult_OutPointDecodeErrorZ.
+pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
+impl Drop for CResult_OutPointDecodeErrorZ {
fn drop(&mut self) {
if self.result_ok {
if unsafe { !(self.contents.result as *mut ()).is_null() } {
}
}
}
-impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, 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_ChannelMonitorUpdateDecodeErrorZPtr { result }
+ CResult_OutPointDecodeErrorZPtr { result }
} else {
let err = unsafe { o.contents.err };
unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
+ CResult_OutPointDecodeErrorZPtr { err }
};
Self {
contents,
}
}
}
-impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
+impl Clone for CResult_OutPointDecodeErrorZ {
fn clone(&self) -> Self {
if self.result_ok {
- Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
- result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
+ Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
+ result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
} }
} else {
- Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
+ Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
} }
}
}
}
#[no_mangle]
-/// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
+/// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) }
+pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) }
#[repr(C)]
-#[derive(Clone)]
-/// An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
-pub enum COption_MonitorEventZ {
- /// When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
- Some(crate::lightning::chain::channelmonitor::MonitorEvent),
- /// When we're in this state, this COption_MonitorEventZ contains nothing
+/// An enum which can either contain a crate::lightning::ln::wire::Type or not
+pub enum COption_TypeZ {
+ /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
+ Some(crate::lightning::ln::wire::Type),
+ /// When we're in this state, this COption_TypeZ contains nothing
None
}
-impl COption_MonitorEventZ {
+impl COption_TypeZ {
#[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::chain::channelmonitor::MonitorEvent {
+ #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::wire::Type {
if let Self::Some(v) = self { v } else { unreachable!() }
}
}
#[no_mangle]
-/// Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
-pub extern "C" fn COption_MonitorEventZ_some(o: crate::lightning::chain::channelmonitor::MonitorEvent) -> COption_MonitorEventZ {
- COption_MonitorEventZ::Some(o)
+/// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
+pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ {
+ COption_TypeZ::Some(o)
}
#[no_mangle]
-/// Constructs a new COption_MonitorEventZ containing nothing
-pub extern "C" fn COption_MonitorEventZ_none() -> COption_MonitorEventZ {
- COption_MonitorEventZ::None
+/// Constructs a new COption_TypeZ containing nothing
+pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ {
+ COption_TypeZ::None
}
#[no_mangle]
-/// Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
-pub extern "C" fn COption_MonitorEventZ_free(_res: COption_MonitorEventZ) { }
-#[no_mangle]
-/// Creates a new COption_MonitorEventZ which has the same data as `orig`
-/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn COption_MonitorEventZ_clone(orig: &COption_MonitorEventZ) -> COption_MonitorEventZ { Clone::clone(&orig) }
+/// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
+pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { }
#[repr(C)]
-/// The contents of CResult_COption_MonitorEventZDecodeErrorZ
-pub union CResult_COption_MonitorEventZDecodeErrorZPtr {
+/// The contents of CResult_COption_TypeZDecodeErrorZ
+pub union CResult_COption_TypeZDecodeErrorZPtr {
/// 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_MonitorEventZ,
+ pub result: *mut crate::c_types::derived::COption_TypeZ,
/// 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_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
-/// containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
+/// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
+/// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult_COption_MonitorEventZDecodeErrorZ {
- /// The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
+pub struct CResult_COption_TypeZDecodeErrorZ {
+ /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_COption_MonitorEventZDecodeErrorZPtr,
- /// Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
+ pub contents: CResult_COption_TypeZDecodeErrorZPtr,
+ /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
-pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_MonitorEventZ) -> CResult_COption_MonitorEventZDecodeErrorZ {
- CResult_COption_MonitorEventZDecodeErrorZ {
- contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
+/// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
+pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ {
+ CResult_COption_TypeZDecodeErrorZ {
+ contents: CResult_COption_TypeZDecodeErrorZPtr {
result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
-pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_MonitorEventZDecodeErrorZ {
- CResult_COption_MonitorEventZDecodeErrorZ {
- contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
+/// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
+pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ {
+ CResult_COption_TypeZDecodeErrorZ {
+ contents: CResult_COption_TypeZDecodeErrorZPtr {
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_MonitorEventZDecodeErrorZ_is_ok(o: &CResult_COption_MonitorEventZDecodeErrorZ) -> bool {
+pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_is_ok(o: &CResult_COption_TypeZDecodeErrorZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
-pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_free(_res: CResult_COption_MonitorEventZDecodeErrorZ) { }
-impl Drop for CResult_COption_MonitorEventZDecodeErrorZ {
+/// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
+pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { }
+impl Drop for CResult_COption_TypeZDecodeErrorZ {
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_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_MonitorEventZDecodeErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_TypeZDecodeErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, 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_MonitorEventZDecodeErrorZPtr { result }
+ CResult_COption_TypeZDecodeErrorZPtr { result }
} else {
let err = unsafe { o.contents.err };
unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_COption_MonitorEventZDecodeErrorZPtr { err }
+ CResult_COption_TypeZDecodeErrorZPtr { err }
};
Self {
contents,
}
}
}
-impl Clone for CResult_COption_MonitorEventZDecodeErrorZ {
- fn clone(&self) -> Self {
- if self.result_ok {
- Self { result_ok: true, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
- result: Box::into_raw(Box::new(<crate::c_types::derived::COption_MonitorEventZ>::clone(unsafe { &*self.contents.result })))
- } }
- } else {
- Self { result_ok: false, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
- err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
- } }
- }
- }
-}
-#[no_mangle]
-/// Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
-/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_clone(orig: &CResult_COption_MonitorEventZDecodeErrorZ) -> CResult_COption_MonitorEventZDecodeErrorZ { Clone::clone(&orig) }
#[repr(C)]
-/// The contents of CResult_HTLCUpdateDecodeErrorZ
-pub union CResult_HTLCUpdateDecodeErrorZPtr {
+/// The contents of CResult_PaymentIdPaymentErrorZ
+pub union CResult_PaymentIdPaymentErrorZPtr {
/// 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::chain::channelmonitor::HTLCUpdate,
+ pub result: *mut crate::c_types::ThirtyTwoBytes,
/// A pointer to the contents in the error state.
/// Reading from this pointer when `result_ok` is set is undefined.
- pub err: *mut crate::lightning::ln::msgs::DecodeError,
+ pub err: *mut crate::lightning_invoice::payment::PaymentError,
}
#[repr(C)]
-/// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
-/// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
+/// A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
+/// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult_HTLCUpdateDecodeErrorZ {
- /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
+pub struct CResult_PaymentIdPaymentErrorZ {
+ /// The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
- /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
+ pub contents: CResult_PaymentIdPaymentErrorZPtr,
+ /// Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
-pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
- CResult_HTLCUpdateDecodeErrorZ {
- contents: CResult_HTLCUpdateDecodeErrorZPtr {
+/// Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
+pub extern "C" fn CResult_PaymentIdPaymentErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentErrorZ {
+ CResult_PaymentIdPaymentErrorZ {
+ contents: CResult_PaymentIdPaymentErrorZPtr {
result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
-pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
- CResult_HTLCUpdateDecodeErrorZ {
- contents: CResult_HTLCUpdateDecodeErrorZPtr {
+/// Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
+pub extern "C" fn CResult_PaymentIdPaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_PaymentIdPaymentErrorZ {
+ CResult_PaymentIdPaymentErrorZ {
+ contents: CResult_PaymentIdPaymentErrorZPtr {
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_HTLCUpdateDecodeErrorZ_is_ok(o: &CResult_HTLCUpdateDecodeErrorZ) -> bool {
+pub extern "C" fn CResult_PaymentIdPaymentErrorZ_is_ok(o: &CResult_PaymentIdPaymentErrorZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
-pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
-impl Drop for CResult_HTLCUpdateDecodeErrorZ {
+/// Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
+pub extern "C" fn CResult_PaymentIdPaymentErrorZ_free(_res: CResult_PaymentIdPaymentErrorZ) { }
+impl Drop for CResult_PaymentIdPaymentErrorZ {
fn drop(&mut self) {
if self.result_ok {
if unsafe { !(self.contents.result as *mut ()).is_null() } {
}
}
}
-impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>> for CResult_PaymentIdPaymentErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>) -> Self {
let contents = if o.result_ok {
let result = unsafe { o.contents.result };
unsafe { o.contents.result = core::ptr::null_mut() };
- CResult_HTLCUpdateDecodeErrorZPtr { result }
+ CResult_PaymentIdPaymentErrorZPtr { result }
} else {
let err = unsafe { o.contents.err };
unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_HTLCUpdateDecodeErrorZPtr { err }
+ CResult_PaymentIdPaymentErrorZPtr { err }
};
Self {
contents,
}
}
}
-impl Clone for CResult_HTLCUpdateDecodeErrorZ {
+impl Clone for CResult_PaymentIdPaymentErrorZ {
fn clone(&self) -> Self {
if self.result_ok {
- Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
- result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
+ Self { result_ok: true, contents: CResult_PaymentIdPaymentErrorZPtr {
+ result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
} }
} else {
- Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
- err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
+ Self { result_ok: false, contents: CResult_PaymentIdPaymentErrorZPtr {
+ err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
} }
}
}
}
#[no_mangle]
-/// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
+/// Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) }
+pub extern "C" fn CResult_PaymentIdPaymentErrorZ_clone(orig: &CResult_PaymentIdPaymentErrorZ) -> CResult_PaymentIdPaymentErrorZ { Clone::clone(&orig) }
#[repr(C)]
-/// A tuple of 2 elements. See the individual fields for the types contained.
-pub struct C2Tuple_OutPointScriptZ {
- /// The element at position 0
- pub a: crate::lightning::chain::transaction::OutPoint,
- /// The element at position 1
- pub b: crate::c_types::derived::CVec_u8Z,
+/// The contents of CResult_SiPrefixParseErrorZ
+pub union CResult_SiPrefixParseErrorZPtr {
+ /// 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_invoice::SiPrefix,
+ /// 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_invoice::ParseError,
}
-impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
- fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
- Self {
- a: tup.0,
- b: tup.1,
- }
- }
+#[repr(C)]
+/// A CResult_SiPrefixParseErrorZ represents the result of a fallible operation,
+/// containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::ParseError on failure.
+/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
+pub struct CResult_SiPrefixParseErrorZ {
+ /// The contents of this CResult_SiPrefixParseErrorZ, accessible via either
+ /// `err` or `result` depending on the state of `result_ok`.
+ pub contents: CResult_SiPrefixParseErrorZPtr,
+ /// Whether this CResult_SiPrefixParseErrorZ represents a success state.
+ pub result_ok: bool,
}
-impl C2Tuple_OutPointScriptZ {
- #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
- (self.a, self.b)
+#[no_mangle]
+/// Creates a new CResult_SiPrefixParseErrorZ in the success state.
+pub extern "C" fn CResult_SiPrefixParseErrorZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixParseErrorZ {
+ CResult_SiPrefixParseErrorZ {
+ contents: CResult_SiPrefixParseErrorZPtr {
+ result: Box::into_raw(Box::new(o)),
+ },
+ result_ok: true,
}
}
-impl Clone for C2Tuple_OutPointScriptZ {
- fn clone(&self) -> Self {
- Self {
- a: Clone::clone(&self.a),
- b: Clone::clone(&self.b),
- }
+#[no_mangle]
+/// Creates a new CResult_SiPrefixParseErrorZ in the error state.
+pub extern "C" fn CResult_SiPrefixParseErrorZ_err(e: crate::lightning_invoice::ParseError) -> CResult_SiPrefixParseErrorZ {
+ CResult_SiPrefixParseErrorZ {
+ contents: CResult_SiPrefixParseErrorZPtr {
+ err: Box::into_raw(Box::new(e)),
+ },
+ result_ok: false,
}
}
+/// Checks if the given object is currently in the success state
#[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 C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { Clone::clone(&orig) }
-/// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
-#[no_mangle]
-pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
- C2Tuple_OutPointScriptZ { a, b, }
+pub extern "C" fn CResult_SiPrefixParseErrorZ_is_ok(o: &CResult_SiPrefixParseErrorZ) -> bool {
+ o.result_ok
}
-
#[no_mangle]
-/// Frees any resources used by the C2Tuple_OutPointScriptZ.
-pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
-#[repr(C)]
-/// A tuple of 2 elements. See the individual fields for the types contained.
-pub struct C2Tuple_u32ScriptZ {
- /// The element at position 0
- pub a: u32,
- /// The element at position 1
- pub b: crate::c_types::derived::CVec_u8Z,
-}
-impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
- fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
- Self {
- a: tup.0,
- b: tup.1,
+/// Frees any resources used by the CResult_SiPrefixParseErrorZ.
+pub extern "C" fn CResult_SiPrefixParseErrorZ_free(_res: CResult_SiPrefixParseErrorZ) { }
+impl Drop for CResult_SiPrefixParseErrorZ {
+ 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 C2Tuple_u32ScriptZ {
- #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
- (self.a, self.b)
+impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::ParseError>> for CResult_SiPrefixParseErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::ParseError>) -> Self {
+ let contents = if o.result_ok {
+ let result = unsafe { o.contents.result };
+ unsafe { o.contents.result = core::ptr::null_mut() };
+ CResult_SiPrefixParseErrorZPtr { result }
+ } else {
+ let err = unsafe { o.contents.err };
+ unsafe { o.contents.err = core::ptr::null_mut(); }
+ CResult_SiPrefixParseErrorZPtr { err }
+ };
+ Self {
+ contents,
+ result_ok: o.result_ok,
+ }
}
}
-impl Clone for C2Tuple_u32ScriptZ {
+impl Clone for CResult_SiPrefixParseErrorZ {
fn clone(&self) -> Self {
- Self {
- a: Clone::clone(&self.a),
- b: Clone::clone(&self.b),
+ if self.result_ok {
+ Self { result_ok: true, contents: CResult_SiPrefixParseErrorZPtr {
+ result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
+ } }
+ } else {
+ Self { result_ok: false, contents: CResult_SiPrefixParseErrorZPtr {
+ err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseError>::clone(unsafe { &*self.contents.err })))
+ } }
}
}
}
#[no_mangle]
-/// Creates a new tuple which has the same data as `orig`
+/// Creates a new CResult_SiPrefixParseErrorZ which has the same data as `orig`
/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { Clone::clone(&orig) }
-/// Creates a new C2Tuple_u32ScriptZ from the contained elements.
-#[no_mangle]
-pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
- C2Tuple_u32ScriptZ { a, b, }
+pub extern "C" fn CResult_SiPrefixParseErrorZ_clone(orig: &CResult_SiPrefixParseErrorZ) -> CResult_SiPrefixParseErrorZ { Clone::clone(&orig) }
+#[repr(C)]
+/// The contents of CResult_InvoiceParseOrSemanticErrorZ
+pub union CResult_InvoiceParseOrSemanticErrorZPtr {
+ /// 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_invoice::Invoice,
+ /// 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_invoice::ParseOrSemanticError,
}
-
-#[no_mangle]
-/// Frees any resources used by the C2Tuple_u32ScriptZ.
-pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
#[repr(C)]
-/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
-/// This corresponds to std::vector in C++
-pub struct CVec_C2Tuple_u32ScriptZZ {
- /// 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::C2Tuple_u32ScriptZ,
- /// The number of elements pointed to by `data`.
- pub datalen: usize
+/// A CResult_InvoiceParseOrSemanticErrorZ represents the result of a fallible operation,
+/// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::ParseOrSemanticError on failure.
+/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
+pub struct CResult_InvoiceParseOrSemanticErrorZ {
+ /// The contents of this CResult_InvoiceParseOrSemanticErrorZ, accessible via either
+ /// `err` or `result` depending on the state of `result_ok`.
+ pub contents: CResult_InvoiceParseOrSemanticErrorZPtr,
+ /// Whether this CResult_InvoiceParseOrSemanticErrorZ represents a success state.
+ pub result_ok: bool,
}
-impl CVec_C2Tuple_u32ScriptZZ {
- #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
- 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::C2Tuple_u32ScriptZ] {
- unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
+#[no_mangle]
+/// Creates a new CResult_InvoiceParseOrSemanticErrorZ in the success state.
+pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceParseOrSemanticErrorZ {
+ CResult_InvoiceParseOrSemanticErrorZ {
+ contents: CResult_InvoiceParseOrSemanticErrorZPtr {
+ result: Box::into_raw(Box::new(o)),
+ },
+ result_ok: true,
}
}
-impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
- fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
- let datalen = v.len();
- let data = Box::into_raw(v.into_boxed_slice());
- Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
+#[no_mangle]
+/// Creates a new CResult_InvoiceParseOrSemanticErrorZ in the error state.
+pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_err(e: crate::lightning_invoice::ParseOrSemanticError) -> CResult_InvoiceParseOrSemanticErrorZ {
+ CResult_InvoiceParseOrSemanticErrorZ {
+ contents: CResult_InvoiceParseOrSemanticErrorZPtr {
+ err: Box::into_raw(Box::new(e)),
+ },
+ result_ok: false,
}
}
+/// Checks if the given object is currently in the success state
#[no_mangle]
-/// Frees the buffer pointed to by `data` if `datalen` is non-0.
-pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
-impl Drop for CVec_C2Tuple_u32ScriptZZ {
- fn drop(&mut self) {
- if self.datalen == 0 { return; }
- unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
- }
+pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_is_ok(o: &CResult_InvoiceParseOrSemanticErrorZ) -> bool {
+ o.result_ok
}
-impl Clone for CVec_C2Tuple_u32ScriptZZ {
- 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)
+#[no_mangle]
+/// Frees any resources used by the CResult_InvoiceParseOrSemanticErrorZ.
+pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_free(_res: CResult_InvoiceParseOrSemanticErrorZ) { }
+impl Drop for CResult_InvoiceParseOrSemanticErrorZ {
+ 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) };
+ }
+ }
}
}
-#[repr(C)]
-/// A tuple of 2 elements. See the individual fields for the types contained.
-pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
- /// The element at position 0
- pub a: crate::c_types::ThirtyTwoBytes,
- /// The element at position 1
- pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
-}
-impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
- fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
+impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::ParseOrSemanticError>> for CResult_InvoiceParseOrSemanticErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::ParseOrSemanticError>) -> Self {
+ let contents = if o.result_ok {
+ let result = unsafe { o.contents.result };
+ unsafe { o.contents.result = core::ptr::null_mut() };
+ CResult_InvoiceParseOrSemanticErrorZPtr { result }
+ } else {
+ let err = unsafe { o.contents.err };
+ unsafe { o.contents.err = core::ptr::null_mut(); }
+ CResult_InvoiceParseOrSemanticErrorZPtr { err }
+ };
Self {
- a: tup.0,
- b: tup.1,
+ contents,
+ result_ok: o.result_ok,
}
}
}
-impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
- #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
- (self.a, self.b)
- }
-}
-impl Clone for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
+impl Clone for CResult_InvoiceParseOrSemanticErrorZ {
fn clone(&self) -> Self {
- Self {
- a: Clone::clone(&self.a),
- b: Clone::clone(&self.b),
+ if self.result_ok {
+ Self { result_ok: true, contents: CResult_InvoiceParseOrSemanticErrorZPtr {
+ result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
+ } }
+ } else {
+ Self { result_ok: false, contents: CResult_InvoiceParseOrSemanticErrorZPtr {
+ err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseOrSemanticError>::clone(unsafe { &*self.contents.err })))
+ } }
}
}
}
#[no_mangle]
-/// Creates a new tuple which has the same data as `orig`
+/// Creates a new CResult_InvoiceParseOrSemanticErrorZ which has the same data as `orig`
/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { Clone::clone(&orig) }
-/// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
-#[no_mangle]
-pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
- C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
+pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_clone(orig: &CResult_InvoiceParseOrSemanticErrorZ) -> CResult_InvoiceParseOrSemanticErrorZ { Clone::clone(&orig) }
+#[repr(C)]
+/// The contents of CResult_SignedRawInvoiceParseErrorZ
+pub union CResult_SignedRawInvoiceParseErrorZPtr {
+ /// 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_invoice::SignedRawInvoice,
+ /// 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_invoice::ParseError,
}
-
-#[no_mangle]
-/// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
-pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
#[repr(C)]
-/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
-/// This corresponds to std::vector in C++
-pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
- /// 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::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
- /// The number of elements pointed to by `data`.
- pub datalen: usize
-}
-impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
- #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
- 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::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
- unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
- }
-}
-impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
- fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
- let datalen = v.len();
- let data = Box::into_raw(v.into_boxed_slice());
- Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
- }
+/// A CResult_SignedRawInvoiceParseErrorZ represents the result of a fallible operation,
+/// containing a crate::lightning_invoice::SignedRawInvoice on success and a crate::lightning_invoice::ParseError on failure.
+/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
+pub struct CResult_SignedRawInvoiceParseErrorZ {
+ /// The contents of this CResult_SignedRawInvoiceParseErrorZ, accessible via either
+ /// `err` or `result` depending on the state of `result_ok`.
+ pub contents: CResult_SignedRawInvoiceParseErrorZPtr,
+ /// Whether this CResult_SignedRawInvoiceParseErrorZ represents a success state.
+ pub result_ok: bool,
}
#[no_mangle]
-/// Frees the buffer pointed to by `data` if `datalen` is non-0.
-pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
-impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
- fn drop(&mut self) {
- if self.datalen == 0 { return; }
- unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
- }
-}
-impl Clone for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
- 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)
+/// Creates a new CResult_SignedRawInvoiceParseErrorZ in the success state.
+pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_ok(o: crate::lightning_invoice::SignedRawInvoice) -> CResult_SignedRawInvoiceParseErrorZ {
+ CResult_SignedRawInvoiceParseErrorZ {
+ contents: CResult_SignedRawInvoiceParseErrorZPtr {
+ result: Box::into_raw(Box::new(o)),
+ },
+ result_ok: true,
}
}
-#[repr(C)]
-/// A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
-/// This corresponds to std::vector in C++
-pub struct CVec_EventZ {
- /// 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::util::events::Event,
- /// The number of elements pointed to by `data`.
- pub datalen: usize
-}
-impl CVec_EventZ {
- #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::Event> {
- 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::util::events::Event] {
- unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
+#[no_mangle]
+/// Creates a new CResult_SignedRawInvoiceParseErrorZ in the error state.
+pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_err(e: crate::lightning_invoice::ParseError) -> CResult_SignedRawInvoiceParseErrorZ {
+ CResult_SignedRawInvoiceParseErrorZ {
+ contents: CResult_SignedRawInvoiceParseErrorZPtr {
+ err: Box::into_raw(Box::new(e)),
+ },
+ result_ok: false,
}
}
-impl From<Vec<crate::lightning::util::events::Event>> for CVec_EventZ {
- fn from(v: Vec<crate::lightning::util::events::Event>) -> Self {
- let datalen = v.len();
- let data = Box::into_raw(v.into_boxed_slice());
- Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
- }
+/// Checks if the given object is currently in the success state
+#[no_mangle]
+pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_is_ok(o: &CResult_SignedRawInvoiceParseErrorZ) -> bool {
+ o.result_ok
}
#[no_mangle]
-/// Frees the buffer pointed to by `data` if `datalen` is non-0.
-pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
-impl Drop for CVec_EventZ {
+/// Frees any resources used by the CResult_SignedRawInvoiceParseErrorZ.
+pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_free(_res: CResult_SignedRawInvoiceParseErrorZ) { }
+impl Drop for CResult_SignedRawInvoiceParseErrorZ {
fn drop(&mut self) {
- if self.datalen == 0 { return; }
- unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
- }
-}
-impl Clone for CVec_EventZ {
- 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)]
-/// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
-/// This corresponds to std::vector in C++
-pub struct CVec_TransactionZ {
- /// 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::Transaction,
- /// The number of elements pointed to by `data`.
- pub datalen: usize
-}
-impl CVec_TransactionZ {
- #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
- 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::Transaction] {
- unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
- }
-}
-impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
- fn from(v: Vec<crate::c_types::Transaction>) -> Self {
- let datalen = v.len();
- let data = Box::into_raw(v.into_boxed_slice());
- Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
+ 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) };
+ }
+ }
}
}
-#[no_mangle]
-/// Frees the buffer pointed to by `data` if `datalen` is non-0.
-pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
-impl Drop for CVec_TransactionZ {
- fn drop(&mut self) {
- if self.datalen == 0 { return; }
- unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
+impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, crate::lightning_invoice::ParseError>> for CResult_SignedRawInvoiceParseErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, crate::lightning_invoice::ParseError>) -> Self {
+ let contents = if o.result_ok {
+ let result = unsafe { o.contents.result };
+ unsafe { o.contents.result = core::ptr::null_mut() };
+ CResult_SignedRawInvoiceParseErrorZPtr { result }
+ } else {
+ let err = unsafe { o.contents.err };
+ unsafe { o.contents.err = core::ptr::null_mut(); }
+ CResult_SignedRawInvoiceParseErrorZPtr { err }
+ };
+ Self {
+ contents,
+ result_ok: o.result_ok,
+ }
}
}
-impl Clone for CVec_TransactionZ {
+impl Clone for CResult_SignedRawInvoiceParseErrorZ {
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)
+ if self.result_ok {
+ Self { result_ok: true, contents: CResult_SignedRawInvoiceParseErrorZPtr {
+ result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawInvoice>::clone(unsafe { &*self.contents.result })))
+ } }
+ } else {
+ Self { result_ok: false, contents: CResult_SignedRawInvoiceParseErrorZPtr {
+ err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseError>::clone(unsafe { &*self.contents.err })))
+ } }
+ }
}
}
+#[no_mangle]
+/// Creates a new CResult_SignedRawInvoiceParseErrorZ which has the same data as `orig`
+/// but with all dynamically-allocated buffers duplicated in new buffers.
+pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_clone(orig: &CResult_SignedRawInvoiceParseErrorZ) -> CResult_SignedRawInvoiceParseErrorZ { Clone::clone(&orig) }
#[repr(C)]
-/// A tuple of 2 elements. See the individual fields for the types contained.
-pub struct C2Tuple_u32TxOutZ {
+/// A tuple of 3 elements. See the individual fields for the types contained.
+pub struct C3Tuple_RawInvoice_u832InvoiceSignatureZ {
/// The element at position 0
- pub a: u32,
+ pub a: crate::lightning_invoice::RawInvoice,
/// The element at position 1
- pub b: crate::c_types::TxOut,
+ pub b: crate::c_types::ThirtyTwoBytes,
+ /// The element at position 2
+ pub c: crate::lightning_invoice::InvoiceSignature,
}
-impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
- fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
+impl From<(crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)> for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
+ fn from (tup: (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)) -> Self {
Self {
a: tup.0,
b: tup.1,
+ c: tup.2,
}
}
}
-impl C2Tuple_u32TxOutZ {
- #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
- (self.a, self.b)
+impl C3Tuple_RawInvoice_u832InvoiceSignatureZ {
+ #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature) {
+ (self.a, self.b, self.c)
}
}
-impl Clone for C2Tuple_u32TxOutZ {
+impl Clone for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
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 C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) }
-/// Creates a new C2Tuple_u32TxOutZ from the contained elements.
+pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig: &C3Tuple_RawInvoice_u832InvoiceSignatureZ) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ { Clone::clone(&orig) }
+/// Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
#[no_mangle]
-pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
- C2Tuple_u32TxOutZ { a, b, }
+pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a: crate::lightning_invoice::RawInvoice, b: crate::c_types::ThirtyTwoBytes, c: crate::lightning_invoice::InvoiceSignature) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ {
+ C3Tuple_RawInvoice_u832InvoiceSignatureZ { a, b, c, }
}
#[no_mangle]
-/// Frees any resources used by the C2Tuple_u32TxOutZ.
-pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
+/// Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
+pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res: C3Tuple_RawInvoice_u832InvoiceSignatureZ) { }
#[repr(C)]
-/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
-/// This corresponds to std::vector in C++
-pub struct CVec_C2Tuple_u32TxOutZZ {
- /// 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::C2Tuple_u32TxOutZ,
- /// The number of elements pointed to by `data`.
- pub datalen: usize
-}
-impl CVec_C2Tuple_u32TxOutZZ {
- #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
- 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::C2Tuple_u32TxOutZ] {
- unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
- }
+/// The contents of CResult_PayeePubKeyErrorZ
+pub union CResult_PayeePubKeyErrorZPtr {
+ /// 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_invoice::PayeePubKey,
+ /// A pointer to the contents in the error state.
+ /// Reading from this pointer when `result_ok` is set is undefined.
+ pub err: *mut crate::c_types::Secp256k1Error,
}
-impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
- fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
- let datalen = v.len();
- let data = Box::into_raw(v.into_boxed_slice());
- Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
- }
+#[repr(C)]
+/// A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
+/// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
+/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
+pub struct CResult_PayeePubKeyErrorZ {
+ /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either
+ /// `err` or `result` depending on the state of `result_ok`.
+ pub contents: CResult_PayeePubKeyErrorZPtr,
+ /// Whether this CResult_PayeePubKeyErrorZ represents a success state.
+ pub result_ok: bool,
}
#[no_mangle]
-/// Frees the buffer pointed to by `data` if `datalen` is non-0.
-pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
-impl Drop for CVec_C2Tuple_u32TxOutZZ {
- fn drop(&mut self) {
- if self.datalen == 0 { return; }
- unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
+/// Creates a new CResult_PayeePubKeyErrorZ in the success state.
+pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ {
+ CResult_PayeePubKeyErrorZ {
+ contents: CResult_PayeePubKeyErrorZPtr {
+ result: Box::into_raw(Box::new(o)),
+ },
+ result_ok: true,
}
}
-impl Clone for CVec_C2Tuple_u32TxOutZZ {
- 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)
+#[no_mangle]
+/// Creates a new CResult_PayeePubKeyErrorZ in the error state.
+pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ {
+ CResult_PayeePubKeyErrorZ {
+ contents: CResult_PayeePubKeyErrorZPtr {
+ err: Box::into_raw(Box::new(e)),
+ },
+ result_ok: false,
}
}
-#[repr(C)]
-/// A tuple of 2 elements. See the individual fields for the types contained.
-pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
- /// The element at position 0
- pub a: crate::c_types::ThirtyTwoBytes,
- /// The element at position 1
- pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
+/// Checks if the given object is currently in the success state
+#[no_mangle]
+pub extern "C" fn CResult_PayeePubKeyErrorZ_is_ok(o: &CResult_PayeePubKeyErrorZ) -> bool {
+ o.result_ok
}
-impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
- fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
- Self {
- a: tup.0,
- b: tup.1,
+#[no_mangle]
+/// Frees any resources used by the CResult_PayeePubKeyErrorZ.
+pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { }
+impl Drop for CResult_PayeePubKeyErrorZ {
+ 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 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
- #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
- (self.a, self.b)
+impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeyErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
+ let contents = if o.result_ok {
+ let result = unsafe { o.contents.result };
+ unsafe { o.contents.result = core::ptr::null_mut() };
+ CResult_PayeePubKeyErrorZPtr { result }
+ } else {
+ let err = unsafe { o.contents.err };
+ unsafe { o.contents.err = core::ptr::null_mut(); }
+ CResult_PayeePubKeyErrorZPtr { err }
+ };
+ Self {
+ contents,
+ result_ok: o.result_ok,
+ }
}
}
-impl Clone for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
+impl Clone for CResult_PayeePubKeyErrorZ {
fn clone(&self) -> Self {
- Self {
- a: Clone::clone(&self.a),
- b: Clone::clone(&self.b),
+ if self.result_ok {
+ Self { result_ok: true, contents: CResult_PayeePubKeyErrorZPtr {
+ result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
+ } }
+ } else {
+ Self { result_ok: false, contents: CResult_PayeePubKeyErrorZPtr {
+ err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
+ } }
}
}
}
#[no_mangle]
-/// Creates a new tuple which has the same data as `orig`
+/// Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) }
-/// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
-#[no_mangle]
-pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
- C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
-}
-
-#[no_mangle]
-/// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
-pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
-#[repr(C)]
-/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
-/// This corresponds to std::vector in C++
-pub struct CVec_TransactionOutputsZ {
- /// 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::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
- /// The number of elements pointed to by `data`.
- pub datalen: usize
-}
-impl CVec_TransactionOutputsZ {
- #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
- 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::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
- unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
- }
-}
-impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
- fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> 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_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
-impl Drop for CVec_TransactionOutputsZ {
- fn drop(&mut self) {
- if self.datalen == 0 { return; }
- unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
- }
-}
-impl Clone for CVec_TransactionOutputsZ {
- 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)
- }
-}
+pub extern "C" fn CResult_PayeePubKeyErrorZ_clone(orig: &CResult_PayeePubKeyErrorZ) -> CResult_PayeePubKeyErrorZ { Clone::clone(&orig) }
#[repr(C)]
-/// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
+/// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
/// This corresponds to std::vector in C++
-pub struct CVec_BalanceZ {
+pub struct CVec_PrivateRouteZ {
/// 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::chain::channelmonitor::Balance,
+ pub data: *mut crate::lightning_invoice::PrivateRoute,
/// The number of elements pointed to by `data`.
pub datalen: usize
}
-impl CVec_BalanceZ {
- #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::Balance> {
+impl CVec_PrivateRouteZ {
+ #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
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::chain::channelmonitor::Balance] {
+ #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
}
}
-impl From<Vec<crate::lightning::chain::channelmonitor::Balance>> for CVec_BalanceZ {
- fn from(v: Vec<crate::lightning::chain::channelmonitor::Balance>) -> Self {
+impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
+ fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> 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_BalanceZ_free(_res: CVec_BalanceZ) { }
-impl Drop for CVec_BalanceZ {
+pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
+impl Drop for CVec_PrivateRouteZ {
fn drop(&mut self) {
if self.datalen == 0 { return; }
unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
}
}
-impl Clone for CVec_BalanceZ {
+impl Clone for CVec_PrivateRouteZ {
fn clone(&self) -> Self {
let mut res = Vec::new();
if self.datalen == 0 { return Self::from(res); }
}
}
#[repr(C)]
-/// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
-pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
+/// The contents of CResult_PositiveTimestampCreationErrorZ
+pub union CResult_PositiveTimestampCreationErrorZPtr {
/// A pointer to the contents in the success state.
/// Reading from this pointer when `result_ok` is not set is undefined.
- pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
+ pub result: *mut crate::lightning_invoice::PositiveTimestamp,
/// 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,
+ pub err: *mut crate::lightning_invoice::CreationError,
}
#[repr(C)]
-/// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
-/// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
+/// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
+/// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
- /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
+pub struct CResult_PositiveTimestampCreationErrorZ {
+ /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
- /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
+ pub contents: CResult_PositiveTimestampCreationErrorZPtr,
+ /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
-pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
- CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
- contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
+/// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
+pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
+ CResult_PositiveTimestampCreationErrorZ {
+ contents: CResult_PositiveTimestampCreationErrorZPtr {
result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
-pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
- CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
- contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
+/// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
+pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
+ CResult_PositiveTimestampCreationErrorZ {
+ contents: CResult_PositiveTimestampCreationErrorZPtr {
err: Box::into_raw(Box::new(e)),
},
result_ok: false,
}
/// Checks if the given object is currently in the success state
#[no_mangle]
-pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) -> bool {
+pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_is_ok(o: &CResult_PositiveTimestampCreationErrorZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
-pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
-impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
+/// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
+pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
+impl Drop for CResult_PositiveTimestampCreationErrorZ {
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::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
let contents = if o.result_ok {
let result = unsafe { o.contents.result };
unsafe { o.contents.result = core::ptr::null_mut() };
- CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
+ CResult_PositiveTimestampCreationErrorZPtr { result }
} else {
let err = unsafe { o.contents.err };
unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
+ CResult_PositiveTimestampCreationErrorZPtr { err }
};
Self {
contents,
}
}
}
+impl Clone for CResult_PositiveTimestampCreationErrorZ {
+ fn clone(&self) -> Self {
+ if self.result_ok {
+ Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
+ result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
+ } }
+ } else {
+ Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
+ err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
+ } }
+ }
+ }
+}
+#[no_mangle]
+/// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
+/// but with all dynamically-allocated buffers duplicated in new buffers.
+pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) }
#[repr(C)]
-/// The contents of CResult_NoneLightningErrorZ
-pub union CResult_NoneLightningErrorZPtr {
+/// The contents of CResult_NoneSemanticErrorZ
+pub union CResult_NoneSemanticErrorZPtr {
/// 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::ln::msgs::LightningError,
+ pub err: *mut crate::lightning_invoice::SemanticError,
}
#[repr(C)]
-/// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
-/// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
+/// A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
+/// containing a () on success and a crate::lightning_invoice::SemanticError on failure.
/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult_NoneLightningErrorZ {
- /// The contents of this CResult_NoneLightningErrorZ, accessible via either
+pub struct CResult_NoneSemanticErrorZ {
+ /// The contents of this CResult_NoneSemanticErrorZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_NoneLightningErrorZPtr,
- /// Whether this CResult_NoneLightningErrorZ represents a success state.
+ pub contents: CResult_NoneSemanticErrorZPtr,
+ /// Whether this CResult_NoneSemanticErrorZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_NoneLightningErrorZ in the success state.
-pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
- CResult_NoneLightningErrorZ {
- contents: CResult_NoneLightningErrorZPtr {
+/// Creates a new CResult_NoneSemanticErrorZ in the success state.
+pub extern "C" fn CResult_NoneSemanticErrorZ_ok() -> CResult_NoneSemanticErrorZ {
+ CResult_NoneSemanticErrorZ {
+ contents: CResult_NoneSemanticErrorZPtr {
result: core::ptr::null_mut(),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_NoneLightningErrorZ in the error state.
-pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
- CResult_NoneLightningErrorZ {
- contents: CResult_NoneLightningErrorZPtr {
+/// Creates a new CResult_NoneSemanticErrorZ in the error state.
+pub extern "C" fn CResult_NoneSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_NoneSemanticErrorZ {
+ CResult_NoneSemanticErrorZ {
+ contents: CResult_NoneSemanticErrorZPtr {
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_NoneLightningErrorZ_is_ok(o: &CResult_NoneLightningErrorZ) -> bool {
+pub extern "C" fn CResult_NoneSemanticErrorZ_is_ok(o: &CResult_NoneSemanticErrorZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_NoneLightningErrorZ.
-pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
-impl Drop for CResult_NoneLightningErrorZ {
+/// Frees any resources used by the CResult_NoneSemanticErrorZ.
+pub extern "C" fn CResult_NoneSemanticErrorZ_free(_res: CResult_NoneSemanticErrorZ) { }
+impl Drop for CResult_NoneSemanticErrorZ {
fn drop(&mut self) {
if self.result_ok {
} else {
}
}
}
-impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
+impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>> for CResult_NoneSemanticErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>) -> Self {
let contents = if o.result_ok {
let _ = unsafe { Box::from_raw(o.contents.result) };
o.contents.result = core::ptr::null_mut();
- CResult_NoneLightningErrorZPtr { result: core::ptr::null_mut() }
+ CResult_NoneSemanticErrorZPtr { result: core::ptr::null_mut() }
} else {
let err = unsafe { o.contents.err };
unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_NoneLightningErrorZPtr { err }
+ CResult_NoneSemanticErrorZPtr { err }
};
Self {
contents,
}
}
}
-impl Clone for CResult_NoneLightningErrorZ {
+impl Clone for CResult_NoneSemanticErrorZ {
fn clone(&self) -> Self {
if self.result_ok {
- Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
+ Self { result_ok: true, contents: CResult_NoneSemanticErrorZPtr {
result: core::ptr::null_mut()
} }
} else {
- Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
- err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
+ Self { result_ok: false, contents: CResult_NoneSemanticErrorZPtr {
+ err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
} }
}
}
}
#[no_mangle]
-/// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
+/// Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) }
+pub extern "C" fn CResult_NoneSemanticErrorZ_clone(orig: &CResult_NoneSemanticErrorZ) -> CResult_NoneSemanticErrorZ { Clone::clone(&orig) }
#[repr(C)]
-/// A tuple of 2 elements. See the individual fields for the types contained.
-pub struct C2Tuple_PublicKeyTypeZ {
- /// The element at position 0
- pub a: crate::c_types::PublicKey,
- /// The element at position 1
- pub b: crate::lightning::ln::wire::Type,
+/// The contents of CResult_InvoiceSemanticErrorZ
+pub union CResult_InvoiceSemanticErrorZPtr {
+ /// 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_invoice::Invoice,
+ /// 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_invoice::SemanticError,
}
-impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ {
- fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self {
- Self {
- a: tup.0,
- b: tup.1,
- }
- }
+#[repr(C)]
+/// A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
+/// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
+/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
+pub struct CResult_InvoiceSemanticErrorZ {
+ /// The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
+ /// `err` or `result` depending on the state of `result_ok`.
+ pub contents: CResult_InvoiceSemanticErrorZPtr,
+ /// Whether this CResult_InvoiceSemanticErrorZ represents a success state.
+ pub result_ok: bool,
}
-impl C2Tuple_PublicKeyTypeZ {
- #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) {
- (self.a, self.b)
+#[no_mangle]
+/// Creates a new CResult_InvoiceSemanticErrorZ in the success state.
+pub extern "C" fn CResult_InvoiceSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSemanticErrorZ {
+ CResult_InvoiceSemanticErrorZ {
+ contents: CResult_InvoiceSemanticErrorZPtr {
+ result: Box::into_raw(Box::new(o)),
+ },
+ result_ok: true,
}
}
-/// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
#[no_mangle]
-pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ {
- C2Tuple_PublicKeyTypeZ { a, b, }
+/// Creates a new CResult_InvoiceSemanticErrorZ in the error state.
+pub extern "C" fn CResult_InvoiceSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_InvoiceSemanticErrorZ {
+ CResult_InvoiceSemanticErrorZ {
+ contents: CResult_InvoiceSemanticErrorZPtr {
+ err: Box::into_raw(Box::new(e)),
+ },
+ result_ok: false,
+ }
}
-
+/// Checks if the given object is currently in the success state
#[no_mangle]
-/// Frees any resources used by the C2Tuple_PublicKeyTypeZ.
-pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { }
-#[repr(C)]
-/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
-/// This corresponds to std::vector in C++
-pub struct CVec_C2Tuple_PublicKeyTypeZZ {
- /// 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::C2Tuple_PublicKeyTypeZ,
- /// The number of elements pointed to by `data`.
- pub datalen: usize
+pub extern "C" fn CResult_InvoiceSemanticErrorZ_is_ok(o: &CResult_InvoiceSemanticErrorZ) -> bool {
+ o.result_ok
}
-impl CVec_C2Tuple_PublicKeyTypeZZ {
- #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ> {
- 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::C2Tuple_PublicKeyTypeZ] {
- unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
+#[no_mangle]
+/// Frees any resources used by the CResult_InvoiceSemanticErrorZ.
+pub extern "C" fn CResult_InvoiceSemanticErrorZ_free(_res: CResult_InvoiceSemanticErrorZ) { }
+impl Drop for CResult_InvoiceSemanticErrorZ {
+ 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<Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>> for CVec_C2Tuple_PublicKeyTypeZZ {
- fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>) -> Self {
- let datalen = v.len();
- let data = Box::into_raw(v.into_boxed_slice());
- Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
+impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>> for CResult_InvoiceSemanticErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>) -> Self {
+ let contents = if o.result_ok {
+ let result = unsafe { o.contents.result };
+ unsafe { o.contents.result = core::ptr::null_mut() };
+ CResult_InvoiceSemanticErrorZPtr { result }
+ } else {
+ let err = unsafe { o.contents.err };
+ unsafe { o.contents.err = core::ptr::null_mut(); }
+ CResult_InvoiceSemanticErrorZPtr { err }
+ };
+ Self {
+ contents,
+ result_ok: o.result_ok,
+ }
}
}
-#[no_mangle]
-/// Frees the buffer pointed to by `data` if `datalen` is non-0.
-pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { }
-impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
- fn drop(&mut self) {
- if self.datalen == 0 { return; }
- unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
+impl Clone for CResult_InvoiceSemanticErrorZ {
+ fn clone(&self) -> Self {
+ if self.result_ok {
+ Self { result_ok: true, contents: CResult_InvoiceSemanticErrorZPtr {
+ result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
+ } }
+ } else {
+ Self { result_ok: false, contents: CResult_InvoiceSemanticErrorZPtr {
+ err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
+ } }
+ }
}
}
+#[no_mangle]
+/// Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
+/// but with all dynamically-allocated buffers duplicated in new buffers.
+pub extern "C" fn CResult_InvoiceSemanticErrorZ_clone(orig: &CResult_InvoiceSemanticErrorZ) -> CResult_InvoiceSemanticErrorZ { Clone::clone(&orig) }
#[repr(C)]
-/// The contents of CResult_boolLightningErrorZ
-pub union CResult_boolLightningErrorZPtr {
+/// The contents of CResult_DescriptionCreationErrorZ
+pub union CResult_DescriptionCreationErrorZPtr {
/// A pointer to the contents in the success state.
/// Reading from this pointer when `result_ok` is not set is undefined.
- pub result: *mut bool,
+ pub result: *mut crate::lightning_invoice::Description,
/// 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::LightningError,
+ pub err: *mut crate::lightning_invoice::CreationError,
}
#[repr(C)]
-/// A CResult_boolLightningErrorZ represents the result of a fallible operation,
-/// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
+/// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
+/// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult_boolLightningErrorZ {
- /// The contents of this CResult_boolLightningErrorZ, accessible via either
+pub struct CResult_DescriptionCreationErrorZ {
+ /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_boolLightningErrorZPtr,
- /// Whether this CResult_boolLightningErrorZ represents a success state.
+ pub contents: CResult_DescriptionCreationErrorZPtr,
+ /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_boolLightningErrorZ in the success state.
-pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
- CResult_boolLightningErrorZ {
- contents: CResult_boolLightningErrorZPtr {
+/// Creates a new CResult_DescriptionCreationErrorZ in the success state.
+pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
+ CResult_DescriptionCreationErrorZ {
+ contents: CResult_DescriptionCreationErrorZPtr {
result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_boolLightningErrorZ in the error state.
-pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
- CResult_boolLightningErrorZ {
- contents: CResult_boolLightningErrorZPtr {
+/// Creates a new CResult_DescriptionCreationErrorZ in the error state.
+pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
+ CResult_DescriptionCreationErrorZ {
+ contents: CResult_DescriptionCreationErrorZPtr {
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_boolLightningErrorZ_is_ok(o: &CResult_boolLightningErrorZ) -> bool {
+pub extern "C" fn CResult_DescriptionCreationErrorZ_is_ok(o: &CResult_DescriptionCreationErrorZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_boolLightningErrorZ.
-pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
-impl Drop for CResult_boolLightningErrorZ {
+/// Frees any resources used by the CResult_DescriptionCreationErrorZ.
+pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
+impl Drop for CResult_DescriptionCreationErrorZ {
fn drop(&mut self) {
if self.result_ok {
if unsafe { !(self.contents.result as *mut ()).is_null() } {
}
}
}
-impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
let contents = if o.result_ok {
let result = unsafe { o.contents.result };
unsafe { o.contents.result = core::ptr::null_mut() };
- CResult_boolLightningErrorZPtr { result }
+ CResult_DescriptionCreationErrorZPtr { result }
} else {
let err = unsafe { o.contents.err };
unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_boolLightningErrorZPtr { err }
+ CResult_DescriptionCreationErrorZPtr { err }
};
Self {
contents,
}
}
}
-impl Clone for CResult_boolLightningErrorZ {
+impl Clone for CResult_DescriptionCreationErrorZ {
fn clone(&self) -> Self {
if self.result_ok {
- Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
- result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
+ Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
+ result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
} }
} else {
- Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
- err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
+ Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
+ err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
} }
}
}
}
#[no_mangle]
-/// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
+/// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) }
+pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) }
#[repr(C)]
-/// A tuple of 3 elements. See the individual fields for the types contained.
-pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
- /// The element at position 0
- pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
- /// The element at position 1
- pub b: crate::lightning::ln::msgs::ChannelUpdate,
- /// The element at position 2
- pub c: crate::lightning::ln::msgs::ChannelUpdate,
+/// The contents of CResult_PrivateRouteCreationErrorZ
+pub union CResult_PrivateRouteCreationErrorZPtr {
+ /// 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_invoice::PrivateRoute,
+ /// 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_invoice::CreationError,
}
-impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
- fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
- Self {
- a: tup.0,
- b: tup.1,
- c: tup.2,
- }
- }
+#[repr(C)]
+/// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
+/// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
+/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
+pub struct CResult_PrivateRouteCreationErrorZ {
+ /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
+ /// `err` or `result` depending on the state of `result_ok`.
+ pub contents: CResult_PrivateRouteCreationErrorZPtr,
+ /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
+ pub result_ok: bool,
}
-impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
- #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
- (self.a, self.b, self.c)
+#[no_mangle]
+/// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
+pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
+ CResult_PrivateRouteCreationErrorZ {
+ contents: CResult_PrivateRouteCreationErrorZPtr {
+ result: Box::into_raw(Box::new(o)),
+ },
+ result_ok: true,
}
}
-impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
- 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 CResult_PrivateRouteCreationErrorZ in the error state.
+pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
+ CResult_PrivateRouteCreationErrorZ {
+ contents: CResult_PrivateRouteCreationErrorZPtr {
+ err: Box::into_raw(Box::new(e)),
+ },
+ result_ok: false,
}
}
+/// Checks if the given object is currently in the success state
#[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_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) }
-/// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
-#[no_mangle]
-pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a: crate::lightning::ln::msgs::ChannelAnnouncement, b: crate::lightning::ln::msgs::ChannelUpdate, c: crate::lightning::ln::msgs::ChannelUpdate) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
- C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
+pub extern "C" fn CResult_PrivateRouteCreationErrorZ_is_ok(o: &CResult_PrivateRouteCreationErrorZ) -> bool {
+ o.result_ok
}
-
#[no_mangle]
-/// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
-pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
-#[repr(C)]
-/// A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
-/// This corresponds to std::vector in C++
-pub struct CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
- /// 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_ChannelAnnouncementChannelUpdateChannelUpdateZ,
- /// The number of elements pointed to by `data`.
- pub datalen: usize
-}
-impl CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
- #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ> {
- 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_ChannelAnnouncementChannelUpdateChannelUpdateZ] {
- unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
- }
-}
-impl From<Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>> for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
- fn from(v: Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>) -> Self {
- let datalen = v.len();
- let data = Box::into_raw(v.into_boxed_slice());
- Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
+/// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
+pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
+impl Drop for CResult_PrivateRouteCreationErrorZ {
+ 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) };
+ }
+ }
}
}
-#[no_mangle]
-/// Frees the buffer pointed to by `data` if `datalen` is non-0.
-pub extern "C" fn CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
-impl Drop for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
- fn drop(&mut self) {
- if self.datalen == 0 { return; }
- unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
+impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
+ let contents = if o.result_ok {
+ let result = unsafe { o.contents.result };
+ unsafe { o.contents.result = core::ptr::null_mut() };
+ CResult_PrivateRouteCreationErrorZPtr { result }
+ } else {
+ let err = unsafe { o.contents.err };
+ unsafe { o.contents.err = core::ptr::null_mut(); }
+ CResult_PrivateRouteCreationErrorZPtr { err }
+ };
+ Self {
+ contents,
+ result_ok: o.result_ok,
+ }
}
}
-impl Clone for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
+impl Clone for CResult_PrivateRouteCreationErrorZ {
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)
+ if self.result_ok {
+ Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
+ result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
+ } }
+ } else {
+ Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
+ err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
+ } }
+ }
}
}
+#[no_mangle]
+/// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
+/// but with all dynamically-allocated buffers duplicated in new buffers.
+pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) }
#[repr(C)]
-/// A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
-/// This corresponds to std::vector in C++
-pub struct CVec_NodeAnnouncementZ {
- /// 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::ln::msgs::NodeAnnouncement,
- /// The number of elements pointed to by `data`.
- pub datalen: usize
-}
-impl CVec_NodeAnnouncementZ {
- #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NodeAnnouncement> {
- 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::ln::msgs::NodeAnnouncement] {
- unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
- }
+/// The contents of CResult_StringErrorZ
+pub union CResult_StringErrorZPtr {
+ /// 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::Str,
+ /// A pointer to the contents in the error state.
+ /// Reading from this pointer when `result_ok` is set is undefined.
+ pub err: *mut crate::c_types::Secp256k1Error,
}
-impl From<Vec<crate::lightning::ln::msgs::NodeAnnouncement>> for CVec_NodeAnnouncementZ {
- fn from(v: Vec<crate::lightning::ln::msgs::NodeAnnouncement>) -> Self {
- let datalen = v.len();
- let data = Box::into_raw(v.into_boxed_slice());
- Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
- }
+#[repr(C)]
+/// A CResult_StringErrorZ represents the result of a fallible operation,
+/// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
+/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
+pub struct CResult_StringErrorZ {
+ /// The contents of this CResult_StringErrorZ, accessible via either
+ /// `err` or `result` depending on the state of `result_ok`.
+ pub contents: CResult_StringErrorZPtr,
+ /// Whether this CResult_StringErrorZ represents a success state.
+ pub result_ok: bool,
}
#[no_mangle]
-/// Frees the buffer pointed to by `data` if `datalen` is non-0.
-pub extern "C" fn CVec_NodeAnnouncementZ_free(_res: CVec_NodeAnnouncementZ) { }
-impl Drop for CVec_NodeAnnouncementZ {
- fn drop(&mut self) {
- if self.datalen == 0 { return; }
- unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
- }
-}
-impl Clone for CVec_NodeAnnouncementZ {
- 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)
+/// Creates a new CResult_StringErrorZ in the success state.
+pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::Str) -> CResult_StringErrorZ {
+ CResult_StringErrorZ {
+ contents: CResult_StringErrorZPtr {
+ result: Box::into_raw(Box::new(o)),
+ },
+ result_ok: true,
}
}
-#[repr(C)]
-/// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
-/// This corresponds to std::vector in C++
-pub struct CVec_PublicKeyZ {
- /// 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::PublicKey,
- /// The number of elements pointed to by `data`.
- pub datalen: usize
-}
-impl CVec_PublicKeyZ {
- #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
- 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::PublicKey] {
- unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
+#[no_mangle]
+/// Creates a new CResult_StringErrorZ in the error state.
+pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ {
+ CResult_StringErrorZ {
+ contents: CResult_StringErrorZPtr {
+ err: Box::into_raw(Box::new(e)),
+ },
+ result_ok: false,
}
}
-impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
- fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
- let datalen = v.len();
- let data = Box::into_raw(v.into_boxed_slice());
- Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
- }
+/// Checks if the given object is currently in the success state
+#[no_mangle]
+pub extern "C" fn CResult_StringErrorZ_is_ok(o: &CResult_StringErrorZ) -> bool {
+ o.result_ok
}
#[no_mangle]
-/// Frees the buffer pointed to by `data` if `datalen` is non-0.
-pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
-impl Drop for CVec_PublicKeyZ {
+/// Frees any resources used by the CResult_StringErrorZ.
+pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { }
+impl Drop for CResult_StringErrorZ {
fn drop(&mut self) {
- if self.datalen == 0 { return; }
- unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
+ 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 Clone for CVec_PublicKeyZ {
- 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)
+impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StringErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
+ let contents = if o.result_ok {
+ let result = unsafe { o.contents.result };
+ unsafe { o.contents.result = core::ptr::null_mut() };
+ CResult_StringErrorZPtr { result }
+ } else {
+ let err = unsafe { o.contents.err };
+ unsafe { o.contents.err = core::ptr::null_mut(); }
+ CResult_StringErrorZPtr { err }
+ };
+ Self {
+ contents,
+ result_ok: o.result_ok,
+ }
}
}
-#[repr(C)]
-#[derive(Clone)]
-/// An enum which can either contain a crate::lightning::ln::msgs::NetAddress or not
-pub enum COption_NetAddressZ {
- /// When we're in this state, this COption_NetAddressZ contains a crate::lightning::ln::msgs::NetAddress
- Some(crate::lightning::ln::msgs::NetAddress),
- /// When we're in this state, this COption_NetAddressZ contains nothing
- None
-}
-impl COption_NetAddressZ {
- #[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::ln::msgs::NetAddress {
- if let Self::Some(v) = self { v } else { unreachable!() }
+impl Clone for CResult_StringErrorZ {
+ fn clone(&self) -> Self {
+ if self.result_ok {
+ Self { result_ok: true, contents: CResult_StringErrorZPtr {
+ result: Box::into_raw(Box::new(<crate::c_types::Str>::clone(unsafe { &*self.contents.result })))
+ } }
+ } else {
+ Self { result_ok: false, contents: CResult_StringErrorZPtr {
+ err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
+ } }
+ }
}
}
#[no_mangle]
-/// Constructs a new COption_NetAddressZ containing a crate::lightning::ln::msgs::NetAddress
-pub extern "C" fn COption_NetAddressZ_some(o: crate::lightning::ln::msgs::NetAddress) -> COption_NetAddressZ {
- COption_NetAddressZ::Some(o)
-}
-#[no_mangle]
-/// Constructs a new COption_NetAddressZ containing nothing
-pub extern "C" fn COption_NetAddressZ_none() -> COption_NetAddressZ {
- COption_NetAddressZ::None
-}
-#[no_mangle]
-/// Frees any resources associated with the crate::lightning::ln::msgs::NetAddress, if we are in the Some state
-pub extern "C" fn COption_NetAddressZ_free(_res: COption_NetAddressZ) { }
-#[no_mangle]
-/// Creates a new COption_NetAddressZ which has the same data as `orig`
+/// Creates a new CResult_StringErrorZ which has the same data as `orig`
/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn COption_NetAddressZ_clone(orig: &COption_NetAddressZ) -> COption_NetAddressZ { Clone::clone(&orig) }
+pub extern "C" fn CResult_StringErrorZ_clone(orig: &CResult_StringErrorZ) -> CResult_StringErrorZ { Clone::clone(&orig) }
#[repr(C)]
-/// The contents of CResult_CVec_u8ZPeerHandleErrorZ
-pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
+/// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
+pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
/// 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::CVec_u8Z,
+ pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
/// 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::peer_handler::PeerHandleError,
+ pub err: *mut crate::lightning::ln::msgs::DecodeError,
}
#[repr(C)]
-/// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
-/// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
+/// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
+/// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult_CVec_u8ZPeerHandleErrorZ {
- /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
+pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
+ /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
- /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
+ pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
+ /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
-pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
- CResult_CVec_u8ZPeerHandleErrorZ {
- contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
+/// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
+pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
+ CResult_ChannelMonitorUpdateDecodeErrorZ {
+ contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
-pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
- CResult_CVec_u8ZPeerHandleErrorZ {
- contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
+/// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
+pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
+ CResult_ChannelMonitorUpdateDecodeErrorZ {
+ contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
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_CVec_u8ZPeerHandleErrorZ_is_ok(o: &CResult_CVec_u8ZPeerHandleErrorZ) -> bool {
+pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
-pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
-impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
+/// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
+pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
+impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
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::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, 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_CVec_u8ZPeerHandleErrorZPtr { result }
+ CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
} else {
let err = unsafe { o.contents.err };
unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_CVec_u8ZPeerHandleErrorZPtr { err }
+ CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
};
Self {
contents,
}
}
}
-impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
+impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
fn clone(&self) -> Self {
if self.result_ok {
- Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
- result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
+ Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
+ result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
} }
} else {
- Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
- err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
+ Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
+ err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
} }
}
}
}
#[no_mangle]
-/// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
+/// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
+pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) }
#[repr(C)]
-/// The contents of CResult_NonePeerHandleErrorZ
-pub union CResult_NonePeerHandleErrorZPtr {
- /// Note that this value is always NULL, as there are no contents in the OK variant
- pub result: *mut core::ffi::c_void,
+#[derive(Clone)]
+/// An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
+pub enum COption_MonitorEventZ {
+ /// When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
+ Some(crate::lightning::chain::channelmonitor::MonitorEvent),
+ /// When we're in this state, this COption_MonitorEventZ contains nothing
+ None
+}
+impl COption_MonitorEventZ {
+ #[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::chain::channelmonitor::MonitorEvent {
+ if let Self::Some(v) = self { v } else { unreachable!() }
+ }
+}
+#[no_mangle]
+/// Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
+pub extern "C" fn COption_MonitorEventZ_some(o: crate::lightning::chain::channelmonitor::MonitorEvent) -> COption_MonitorEventZ {
+ COption_MonitorEventZ::Some(o)
+}
+#[no_mangle]
+/// Constructs a new COption_MonitorEventZ containing nothing
+pub extern "C" fn COption_MonitorEventZ_none() -> COption_MonitorEventZ {
+ COption_MonitorEventZ::None
+}
+#[no_mangle]
+/// Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
+pub extern "C" fn COption_MonitorEventZ_free(_res: COption_MonitorEventZ) { }
+#[no_mangle]
+/// Creates a new COption_MonitorEventZ which has the same data as `orig`
+/// but with all dynamically-allocated buffers duplicated in new buffers.
+pub extern "C" fn COption_MonitorEventZ_clone(orig: &COption_MonitorEventZ) -> COption_MonitorEventZ { Clone::clone(&orig) }
+#[repr(C)]
+/// The contents of CResult_COption_MonitorEventZDecodeErrorZ
+pub union CResult_COption_MonitorEventZDecodeErrorZPtr {
+ /// 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_MonitorEventZ,
/// 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::peer_handler::PeerHandleError,
+ pub err: *mut crate::lightning::ln::msgs::DecodeError,
}
#[repr(C)]
-/// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
-/// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
+/// A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
+/// containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult_NonePeerHandleErrorZ {
- /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
+pub struct CResult_COption_MonitorEventZDecodeErrorZ {
+ /// The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_NonePeerHandleErrorZPtr,
- /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
+ pub contents: CResult_COption_MonitorEventZDecodeErrorZPtr,
+ /// Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_NonePeerHandleErrorZ in the success state.
-pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
- CResult_NonePeerHandleErrorZ {
- contents: CResult_NonePeerHandleErrorZPtr {
- result: core::ptr::null_mut(),
+/// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
+pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_MonitorEventZ) -> CResult_COption_MonitorEventZDecodeErrorZ {
+ CResult_COption_MonitorEventZDecodeErrorZ {
+ contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
+ result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_NonePeerHandleErrorZ in the error state.
-pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
- CResult_NonePeerHandleErrorZ {
- contents: CResult_NonePeerHandleErrorZPtr {
+/// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
+pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_MonitorEventZDecodeErrorZ {
+ CResult_COption_MonitorEventZDecodeErrorZ {
+ contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
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_NonePeerHandleErrorZ_is_ok(o: &CResult_NonePeerHandleErrorZ) -> bool {
+pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o: &CResult_COption_MonitorEventZDecodeErrorZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_NonePeerHandleErrorZ.
-pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
-impl Drop for CResult_NonePeerHandleErrorZ {
+/// Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
+pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_free(_res: CResult_COption_MonitorEventZDecodeErrorZ) { }
+impl Drop for CResult_COption_MonitorEventZDecodeErrorZ {
fn drop(&mut self) {
if self.result_ok {
+ if unsafe { !(self.contents.result as *mut ()).is_null() } {
+ let _ = unsafe { Box::from_raw(self.contents.result) };
+ }
} else {
if unsafe { !(self.contents.err as *mut ()).is_null() } {
let _ = unsafe { Box::from_raw(self.contents.err) };
}
}
}
-impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_MonitorEventZDecodeErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
let contents = if o.result_ok {
- let _ = unsafe { Box::from_raw(o.contents.result) };
- o.contents.result = core::ptr::null_mut();
- CResult_NonePeerHandleErrorZPtr { result: core::ptr::null_mut() }
+ let result = unsafe { o.contents.result };
+ unsafe { o.contents.result = core::ptr::null_mut() };
+ CResult_COption_MonitorEventZDecodeErrorZPtr { result }
} else {
let err = unsafe { o.contents.err };
unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_NonePeerHandleErrorZPtr { err }
+ CResult_COption_MonitorEventZDecodeErrorZPtr { err }
};
Self {
contents,
}
}
}
-impl Clone for CResult_NonePeerHandleErrorZ {
+impl Clone for CResult_COption_MonitorEventZDecodeErrorZ {
fn clone(&self) -> Self {
if self.result_ok {
- Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
- result: core::ptr::null_mut()
+ Self { result_ok: true, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
+ result: Box::into_raw(Box::new(<crate::c_types::derived::COption_MonitorEventZ>::clone(unsafe { &*self.contents.result })))
} }
} else {
- Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
- err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
+ Self { result_ok: false, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
+ err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
} }
}
}
}
#[no_mangle]
-/// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
+/// Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
+pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_clone(orig: &CResult_COption_MonitorEventZDecodeErrorZ) -> CResult_COption_MonitorEventZDecodeErrorZ { Clone::clone(&orig) }
#[repr(C)]
-/// The contents of CResult_boolPeerHandleErrorZ
-pub union CResult_boolPeerHandleErrorZPtr {
+/// The contents of CResult_HTLCUpdateDecodeErrorZ
+pub union CResult_HTLCUpdateDecodeErrorZPtr {
/// A pointer to the contents in the success state.
/// Reading from this pointer when `result_ok` is not set is undefined.
- pub result: *mut bool,
+ pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
/// 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::peer_handler::PeerHandleError,
+ pub err: *mut crate::lightning::ln::msgs::DecodeError,
}
#[repr(C)]
-/// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
-/// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
+/// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
+/// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult_boolPeerHandleErrorZ {
- /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
+pub struct CResult_HTLCUpdateDecodeErrorZ {
+ /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_boolPeerHandleErrorZPtr,
- /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
+ pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
+ /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_boolPeerHandleErrorZ in the success state.
-pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
- CResult_boolPeerHandleErrorZ {
- contents: CResult_boolPeerHandleErrorZPtr {
+/// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
+pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
+ CResult_HTLCUpdateDecodeErrorZ {
+ contents: CResult_HTLCUpdateDecodeErrorZPtr {
result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_boolPeerHandleErrorZ in the error state.
-pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
- CResult_boolPeerHandleErrorZ {
- contents: CResult_boolPeerHandleErrorZPtr {
+/// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
+pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
+ CResult_HTLCUpdateDecodeErrorZ {
+ contents: CResult_HTLCUpdateDecodeErrorZPtr {
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_boolPeerHandleErrorZ_is_ok(o: &CResult_boolPeerHandleErrorZ) -> bool {
+pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_is_ok(o: &CResult_HTLCUpdateDecodeErrorZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_boolPeerHandleErrorZ.
-pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
-impl Drop for CResult_boolPeerHandleErrorZ {
+/// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
+pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
+impl Drop for CResult_HTLCUpdateDecodeErrorZ {
fn drop(&mut self) {
if self.result_ok {
if unsafe { !(self.contents.result as *mut ()).is_null() } {
}
}
}
-impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, 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_boolPeerHandleErrorZPtr { result }
+ CResult_HTLCUpdateDecodeErrorZPtr { result }
} else {
let err = unsafe { o.contents.err };
unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_boolPeerHandleErrorZPtr { err }
+ CResult_HTLCUpdateDecodeErrorZPtr { err }
};
Self {
contents,
}
}
}
-impl Clone for CResult_boolPeerHandleErrorZ {
+impl Clone for CResult_HTLCUpdateDecodeErrorZ {
fn clone(&self) -> Self {
if self.result_ok {
- Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
- result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
+ Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
+ result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
} }
} else {
- Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
- err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
+ Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
+ err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
} }
}
}
}
#[no_mangle]
-/// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
+/// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
+/// but with all dynamically-allocated buffers duplicated in new buffers.
+pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) }
+#[repr(C)]
+/// A tuple of 2 elements. See the individual fields for the types contained.
+pub struct C2Tuple_OutPointScriptZ {
+ /// The element at position 0
+ pub a: crate::lightning::chain::transaction::OutPoint,
+ /// The element at position 1
+ pub b: crate::c_types::derived::CVec_u8Z,
+}
+impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
+ fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
+ Self {
+ a: tup.0,
+ b: tup.1,
+ }
+ }
+}
+impl C2Tuple_OutPointScriptZ {
+ #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
+ (self.a, self.b)
+ }
+}
+impl Clone for C2Tuple_OutPointScriptZ {
+ fn clone(&self) -> Self {
+ Self {
+ a: Clone::clone(&self.a),
+ b: Clone::clone(&self.b),
+ }
+ }
+}
+#[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 C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { Clone::clone(&orig) }
+/// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
+#[no_mangle]
+pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
+ C2Tuple_OutPointScriptZ { a, b, }
+}
+
+#[no_mangle]
+/// Frees any resources used by the C2Tuple_OutPointScriptZ.
+pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
+#[repr(C)]
+/// A tuple of 2 elements. See the individual fields for the types contained.
+pub struct C2Tuple_u32ScriptZ {
+ /// The element at position 0
+ pub a: u32,
+ /// The element at position 1
+ pub b: crate::c_types::derived::CVec_u8Z,
+}
+impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
+ fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
+ Self {
+ a: tup.0,
+ b: tup.1,
+ }
+ }
+}
+impl C2Tuple_u32ScriptZ {
+ #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
+ (self.a, self.b)
+ }
+}
+impl Clone for C2Tuple_u32ScriptZ {
+ fn clone(&self) -> Self {
+ Self {
+ a: Clone::clone(&self.a),
+ b: Clone::clone(&self.b),
+ }
+ }
+}
+#[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 C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { Clone::clone(&orig) }
+/// Creates a new C2Tuple_u32ScriptZ from the contained elements.
+#[no_mangle]
+pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
+ C2Tuple_u32ScriptZ { a, b, }
+}
+
+#[no_mangle]
+/// Frees any resources used by the C2Tuple_u32ScriptZ.
+pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
+#[repr(C)]
+/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
+/// This corresponds to std::vector in C++
+pub struct CVec_C2Tuple_u32ScriptZZ {
+ /// 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::C2Tuple_u32ScriptZ,
+ /// The number of elements pointed to by `data`.
+ pub datalen: usize
+}
+impl CVec_C2Tuple_u32ScriptZZ {
+ #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
+ 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::C2Tuple_u32ScriptZ] {
+ unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
+ }
+}
+impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
+ fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> 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_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
+impl Drop for CVec_C2Tuple_u32ScriptZZ {
+ fn drop(&mut self) {
+ if self.datalen == 0 { return; }
+ unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
+ }
+}
+impl Clone for CVec_C2Tuple_u32ScriptZZ {
+ 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)]
+/// A tuple of 2 elements. See the individual fields for the types contained.
+pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
+ /// The element at position 0
+ pub a: crate::c_types::ThirtyTwoBytes,
+ /// The element at position 1
+ pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
+}
+impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
+ fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
+ Self {
+ a: tup.0,
+ b: tup.1,
+ }
+ }
+}
+impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
+ #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
+ (self.a, self.b)
+ }
+}
+impl Clone for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
+ fn clone(&self) -> Self {
+ Self {
+ a: Clone::clone(&self.a),
+ b: Clone::clone(&self.b),
+ }
+ }
+}
+#[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_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
-#[repr(C)]
-/// The contents of CResult_NodeIdDecodeErrorZ
-pub union CResult_NodeIdDecodeErrorZPtr {
- /// A pointer to the contents in the success state.
- /// Reading from this pointer when `result_ok` is not set is undefined.
- pub result: *mut crate::lightning::routing::network_graph::NodeId,
- /// 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,
+pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { Clone::clone(&orig) }
+/// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
+#[no_mangle]
+pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
+ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
}
+
+#[no_mangle]
+/// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
+pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
#[repr(C)]
-/// A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
-/// containing a crate::lightning::routing::network_graph::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
-/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult_NodeIdDecodeErrorZ {
- /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
- /// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_NodeIdDecodeErrorZPtr,
- /// Whether this CResult_NodeIdDecodeErrorZ represents a success state.
- pub result_ok: bool,
+/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
+/// This corresponds to std::vector in C++
+pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
+ /// 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::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
+ /// The number of elements pointed to by `data`.
+ pub datalen: usize
}
-#[no_mangle]
-/// Creates a new CResult_NodeIdDecodeErrorZ in the success state.
-pub extern "C" fn CResult_NodeIdDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeId) -> CResult_NodeIdDecodeErrorZ {
- CResult_NodeIdDecodeErrorZ {
- contents: CResult_NodeIdDecodeErrorZPtr {
- result: Box::into_raw(Box::new(o)),
- },
- result_ok: true,
+impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
+ #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
+ 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
}
-}
-#[no_mangle]
-/// Creates a new CResult_NodeIdDecodeErrorZ in the error state.
-pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeIdDecodeErrorZ {
- CResult_NodeIdDecodeErrorZ {
- contents: CResult_NodeIdDecodeErrorZPtr {
- err: Box::into_raw(Box::new(e)),
- },
- result_ok: false,
+ #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
+ unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
}
}
-/// Checks if the given object is currently in the success state
-#[no_mangle]
-pub extern "C" fn CResult_NodeIdDecodeErrorZ_is_ok(o: &CResult_NodeIdDecodeErrorZ) -> bool {
- o.result_ok
+impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
+ fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> 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 any resources used by the CResult_NodeIdDecodeErrorZ.
-pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { }
-impl Drop for CResult_NodeIdDecodeErrorZ {
+/// Frees the buffer pointed to by `data` if `datalen` is non-0.
+pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
+impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
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::routing::network_graph::NodeId, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeIdDecodeErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeId, 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_NodeIdDecodeErrorZPtr { result }
- } else {
- let err = unsafe { o.contents.err };
- unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_NodeIdDecodeErrorZPtr { err }
- };
- Self {
- contents,
- result_ok: o.result_ok,
- }
+ if self.datalen == 0 { return; }
+ unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
}
}
-impl Clone for CResult_NodeIdDecodeErrorZ {
+impl Clone for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
fn clone(&self) -> Self {
- if self.result_ok {
- Self { result_ok: true, contents: CResult_NodeIdDecodeErrorZPtr {
- result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeId>::clone(unsafe { &*self.contents.result })))
- } }
- } else {
- Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr {
- err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
- } }
- }
+ 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)
}
}
-#[no_mangle]
-/// Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
-/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) }
#[repr(C)]
-/// The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
-pub union CResult_COption_NetworkUpdateZDecodeErrorZPtr {
- /// 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_NetworkUpdateZ,
- /// 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,
+/// A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
+/// This corresponds to std::vector in C++
+pub struct CVec_EventZ {
+ /// 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::util::events::Event,
+ /// The number of elements pointed to by `data`.
+ pub datalen: usize
}
-#[repr(C)]
-/// A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
-/// containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
-/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult_COption_NetworkUpdateZDecodeErrorZ {
- /// The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
- /// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr,
- /// Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
- pub result_ok: bool,
+impl CVec_EventZ {
+ #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::Event> {
+ 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::util::events::Event] {
+ unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
+ }
}
-#[no_mangle]
-/// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
-pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o: crate::c_types::derived::COption_NetworkUpdateZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
- CResult_COption_NetworkUpdateZDecodeErrorZ {
- contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
- result: Box::into_raw(Box::new(o)),
- },
- result_ok: true,
+impl From<Vec<crate::lightning::util::events::Event>> for CVec_EventZ {
+ fn from(v: Vec<crate::lightning::util::events::Event>) -> Self {
+ let datalen = v.len();
+ let data = Box::into_raw(v.into_boxed_slice());
+ Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
}
}
#[no_mangle]
-/// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
-pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
- CResult_COption_NetworkUpdateZDecodeErrorZ {
- contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
- err: Box::into_raw(Box::new(e)),
- },
- result_ok: false,
+/// Frees the buffer pointed to by `data` if `datalen` is non-0.
+pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
+impl Drop for CVec_EventZ {
+ fn drop(&mut self) {
+ if self.datalen == 0 { return; }
+ unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
}
}
-/// Checks if the given object is currently in the success state
-#[no_mangle]
-pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> bool {
- o.result_ok
+impl Clone for CVec_EventZ {
+ 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)]
+/// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
+/// This corresponds to std::vector in C++
+pub struct CVec_TransactionZ {
+ /// 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::Transaction,
+ /// The number of elements pointed to by `data`.
+ pub datalen: usize
+}
+impl CVec_TransactionZ {
+ #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
+ 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::Transaction] {
+ unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
+ }
+}
+impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
+ fn from(v: Vec<crate::c_types::Transaction>) -> 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 any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
-pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res: CResult_COption_NetworkUpdateZDecodeErrorZ) { }
-impl Drop for CResult_COption_NetworkUpdateZDecodeErrorZ {
+/// Frees the buffer pointed to by `data` if `datalen` is non-0.
+pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
+impl Drop for CVec_TransactionZ {
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) };
- }
- }
+ if self.datalen == 0 { return; }
+ unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
+ }
+}
+impl Clone for CVec_TransactionZ {
+ 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)
}
}
-impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_NetworkUpdateZDecodeErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, 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_NetworkUpdateZDecodeErrorZPtr { result }
- } else {
- let err = unsafe { o.contents.err };
- unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_COption_NetworkUpdateZDecodeErrorZPtr { err }
- };
+#[repr(C)]
+/// A tuple of 2 elements. See the individual fields for the types contained.
+pub struct C2Tuple_u32TxOutZ {
+ /// The element at position 0
+ pub a: u32,
+ /// The element at position 1
+ pub b: crate::c_types::TxOut,
+}
+impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
+ fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
Self {
- contents,
- result_ok: o.result_ok,
+ a: tup.0,
+ b: tup.1,
}
}
}
-impl Clone for CResult_COption_NetworkUpdateZDecodeErrorZ {
+impl C2Tuple_u32TxOutZ {
+ #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
+ (self.a, self.b)
+ }
+}
+impl Clone for C2Tuple_u32TxOutZ {
fn clone(&self) -> Self {
- if self.result_ok {
- Self { result_ok: true, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
- result: Box::into_raw(Box::new(<crate::c_types::derived::COption_NetworkUpdateZ>::clone(unsafe { &*self.contents.result })))
- } }
- } else {
- Self { result_ok: false, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
- err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
- } }
+ Self {
+ a: Clone::clone(&self.a),
+ b: Clone::clone(&self.b),
}
}
}
#[no_mangle]
-/// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
+/// 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_NetworkUpdateZDecodeErrorZ_clone(orig: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ { Clone::clone(&orig) }
+pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) }
+/// Creates a new C2Tuple_u32TxOutZ from the contained elements.
+#[no_mangle]
+pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
+ C2Tuple_u32TxOutZ { a, b, }
+}
+
+#[no_mangle]
+/// Frees any resources used by the C2Tuple_u32TxOutZ.
+pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
#[repr(C)]
-/// An enum which can either contain a crate::lightning::chain::Access or not
-pub enum COption_AccessZ {
- /// When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
- Some(crate::lightning::chain::Access),
- /// When we're in this state, this COption_AccessZ contains nothing
- None
+/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
+/// This corresponds to std::vector in C++
+pub struct CVec_C2Tuple_u32TxOutZZ {
+ /// 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::C2Tuple_u32TxOutZ,
+ /// The number of elements pointed to by `data`.
+ pub datalen: usize
}
-impl COption_AccessZ {
- #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
- if let Self::None = self { false } else { true }
+impl CVec_C2Tuple_u32TxOutZZ {
+ #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
+ 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 is_none(&self) -> bool {
- !self.is_some()
+ #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
+ unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
}
- #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Access {
- if let Self::Some(v) = self { v } else { unreachable!() }
+}
+impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
+ fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
+ let datalen = v.len();
+ let data = Box::into_raw(v.into_boxed_slice());
+ Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
}
}
#[no_mangle]
-/// Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
-pub extern "C" fn COption_AccessZ_some(o: crate::lightning::chain::Access) -> COption_AccessZ {
- COption_AccessZ::Some(o)
+/// Frees the buffer pointed to by `data` if `datalen` is non-0.
+pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
+impl Drop for CVec_C2Tuple_u32TxOutZZ {
+ fn drop(&mut self) {
+ if self.datalen == 0 { return; }
+ unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
+ }
}
-#[no_mangle]
-/// Constructs a new COption_AccessZ containing nothing
-pub extern "C" fn COption_AccessZ_none() -> COption_AccessZ {
- COption_AccessZ::None
+impl Clone for CVec_C2Tuple_u32TxOutZZ {
+ 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)
+ }
}
-#[no_mangle]
-/// Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
-pub extern "C" fn COption_AccessZ_free(_res: COption_AccessZ) { }
#[repr(C)]
-/// The contents of CResult_ChannelUpdateInfoDecodeErrorZ
-pub union CResult_ChannelUpdateInfoDecodeErrorZPtr {
- /// A pointer to the contents in the success state.
- /// Reading from this pointer when `result_ok` is not set is undefined.
- pub result: *mut crate::lightning::routing::network_graph::ChannelUpdateInfo,
- /// 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,
+/// A tuple of 2 elements. See the individual fields for the types contained.
+pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
+ /// The element at position 0
+ pub a: crate::c_types::ThirtyTwoBytes,
+ /// The element at position 1
+ pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
}
-#[repr(C)]
-/// A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
-/// containing a crate::lightning::routing::network_graph::ChannelUpdateInfo 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_ChannelUpdateInfoDecodeErrorZ {
- /// The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
- /// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_ChannelUpdateInfoDecodeErrorZPtr,
- /// Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
- pub result_ok: bool,
+impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
+ fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
+ Self {
+ a: tup.0,
+ b: tup.1,
+ }
+ }
}
-#[no_mangle]
-/// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
-pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::ChannelUpdateInfo) -> CResult_ChannelUpdateInfoDecodeErrorZ {
- CResult_ChannelUpdateInfoDecodeErrorZ {
- contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
- result: Box::into_raw(Box::new(o)),
- },
- result_ok: true,
+impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
+ #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
+ (self.a, self.b)
}
}
-#[no_mangle]
-/// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
-pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateInfoDecodeErrorZ {
- CResult_ChannelUpdateInfoDecodeErrorZ {
- contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
- err: Box::into_raw(Box::new(e)),
- },
- result_ok: false,
+impl Clone for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
+ fn clone(&self) -> Self {
+ Self {
+ a: Clone::clone(&self.a),
+ b: Clone::clone(&self.b),
+ }
}
}
-/// Checks if the given object is currently in the success state
#[no_mangle]
-pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateInfoDecodeErrorZ) -> bool {
- o.result_ok
+/// 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 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) }
+/// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
+#[no_mangle]
+pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
+ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
}
+
#[no_mangle]
-/// Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
-pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_free(_res: CResult_ChannelUpdateInfoDecodeErrorZ) { }
-impl Drop for CResult_ChannelUpdateInfoDecodeErrorZ {
+/// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
+pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
+#[repr(C)]
+/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
+/// This corresponds to std::vector in C++
+pub struct CVec_TransactionOutputsZ {
+ /// 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::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
+ /// The number of elements pointed to by `data`.
+ pub datalen: usize
+}
+impl CVec_TransactionOutputsZ {
+ #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
+ 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::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
+ unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
+ }
+}
+impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
+ fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> 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_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
+impl Drop for CVec_TransactionOutputsZ {
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) };
- }
- }
+ if self.datalen == 0 { return; }
+ unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
+ }
+}
+impl Clone for CVec_TransactionOutputsZ {
+ 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)]
+/// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
+/// This corresponds to std::vector in C++
+pub struct CVec_BalanceZ {
+ /// 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::chain::channelmonitor::Balance,
+ /// The number of elements pointed to by `data`.
+ pub datalen: usize
+}
+impl CVec_BalanceZ {
+ #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::Balance> {
+ 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::chain::channelmonitor::Balance] {
+ unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
}
}
-impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateInfoDecodeErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelUpdateInfo, 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_ChannelUpdateInfoDecodeErrorZPtr { result }
- } else {
- let err = unsafe { o.contents.err };
- unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_ChannelUpdateInfoDecodeErrorZPtr { err }
- };
- Self {
- contents,
- result_ok: o.result_ok,
- }
+impl From<Vec<crate::lightning::chain::channelmonitor::Balance>> for CVec_BalanceZ {
+ fn from(v: Vec<crate::lightning::chain::channelmonitor::Balance>) -> Self {
+ let datalen = v.len();
+ let data = Box::into_raw(v.into_boxed_slice());
+ Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
}
}
-impl Clone for CResult_ChannelUpdateInfoDecodeErrorZ {
+#[no_mangle]
+/// Frees the buffer pointed to by `data` if `datalen` is non-0.
+pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { }
+impl Drop for CVec_BalanceZ {
+ fn drop(&mut self) {
+ if self.datalen == 0 { return; }
+ unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
+ }
+}
+impl Clone for CVec_BalanceZ {
fn clone(&self) -> Self {
- if self.result_ok {
- Self { result_ok: true, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
- result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::ChannelUpdateInfo>::clone(unsafe { &*self.contents.result })))
- } }
- } else {
- Self { result_ok: false, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
- err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
- } }
- }
+ 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)
}
}
-#[no_mangle]
-/// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
-/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig: &CResult_ChannelUpdateInfoDecodeErrorZ) -> CResult_ChannelUpdateInfoDecodeErrorZ { Clone::clone(&orig) }
#[repr(C)]
-/// The contents of CResult_ChannelInfoDecodeErrorZ
-pub union CResult_ChannelInfoDecodeErrorZPtr {
+/// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
+pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
/// A pointer to the contents in the success state.
/// Reading from this pointer when `result_ok` is not set is undefined.
- pub result: *mut crate::lightning::routing::network_graph::ChannelInfo,
+ pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
/// 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_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
-/// containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
+/// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
+/// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ 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_ChannelInfoDecodeErrorZ {
- /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
+pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
+ /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_ChannelInfoDecodeErrorZPtr,
- /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
+ pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
+ /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
-pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
- CResult_ChannelInfoDecodeErrorZ {
- contents: CResult_ChannelInfoDecodeErrorZPtr {
+/// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
+pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
+ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
+ contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
-pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
- CResult_ChannelInfoDecodeErrorZ {
- contents: CResult_ChannelInfoDecodeErrorZPtr {
+/// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
+pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
+ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
+ contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
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_ChannelInfoDecodeErrorZ_is_ok(o: &CResult_ChannelInfoDecodeErrorZ) -> bool {
+pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
-pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
-impl Drop for CResult_ChannelInfoDecodeErrorZ {
+/// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
+pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
+impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
fn drop(&mut self) {
if self.result_ok {
if unsafe { !(self.contents.result as *mut ()).is_null() } {
}
}
}
-impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, 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_ChannelInfoDecodeErrorZPtr { result }
+ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
} else {
let err = unsafe { o.contents.err };
unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_ChannelInfoDecodeErrorZPtr { err }
+ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
};
Self {
contents,
}
}
}
-impl Clone for CResult_ChannelInfoDecodeErrorZ {
- fn clone(&self) -> Self {
- if self.result_ok {
- Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
- result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::ChannelInfo>::clone(unsafe { &*self.contents.result })))
- } }
- } else {
- Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
- err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
- } }
+#[repr(C)]
+/// A tuple of 2 elements. See the individual fields for the types contained.
+pub struct C2Tuple_PublicKeyTypeZ {
+ /// The element at position 0
+ pub a: crate::c_types::PublicKey,
+ /// The element at position 1
+ pub b: crate::lightning::ln::wire::Type,
+}
+impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ {
+ fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self {
+ Self {
+ a: tup.0,
+ b: tup.1,
}
}
}
+impl C2Tuple_PublicKeyTypeZ {
+ #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) {
+ (self.a, self.b)
+ }
+}
+/// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
#[no_mangle]
-/// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
+pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ {
+ C2Tuple_PublicKeyTypeZ { a, b, }
+}
+
+#[no_mangle]
+/// Frees any resources used by the C2Tuple_PublicKeyTypeZ.
+pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { }
+#[repr(C)]
+/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
+/// This corresponds to std::vector in C++
+pub struct CVec_C2Tuple_PublicKeyTypeZZ {
+ /// 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::C2Tuple_PublicKeyTypeZ,
+ /// The number of elements pointed to by `data`.
+ pub datalen: usize
+}
+impl CVec_C2Tuple_PublicKeyTypeZZ {
+ #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ> {
+ 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::C2Tuple_PublicKeyTypeZ] {
+ unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
+ }
+}
+impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>> for CVec_C2Tuple_PublicKeyTypeZZ {
+ fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>) -> 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_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { }
+impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
+ fn drop(&mut self) {
+ if self.datalen == 0 { return; }
+ unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
+ }
+}
+#[repr(C)]
+#[derive(Clone)]
+/// An enum which can either contain a crate::lightning::ln::msgs::NetAddress or not
+pub enum COption_NetAddressZ {
+ /// When we're in this state, this COption_NetAddressZ contains a crate::lightning::ln::msgs::NetAddress
+ Some(crate::lightning::ln::msgs::NetAddress),
+ /// When we're in this state, this COption_NetAddressZ contains nothing
+ None
+}
+impl COption_NetAddressZ {
+ #[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::ln::msgs::NetAddress {
+ if let Self::Some(v) = self { v } else { unreachable!() }
+ }
+}
+#[no_mangle]
+/// Constructs a new COption_NetAddressZ containing a crate::lightning::ln::msgs::NetAddress
+pub extern "C" fn COption_NetAddressZ_some(o: crate::lightning::ln::msgs::NetAddress) -> COption_NetAddressZ {
+ COption_NetAddressZ::Some(o)
+}
+#[no_mangle]
+/// Constructs a new COption_NetAddressZ containing nothing
+pub extern "C" fn COption_NetAddressZ_none() -> COption_NetAddressZ {
+ COption_NetAddressZ::None
+}
+#[no_mangle]
+/// Frees any resources associated with the crate::lightning::ln::msgs::NetAddress, if we are in the Some state
+pub extern "C" fn COption_NetAddressZ_free(_res: COption_NetAddressZ) { }
+#[no_mangle]
+/// Creates a new COption_NetAddressZ which has the same data as `orig`
/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) }
+pub extern "C" fn COption_NetAddressZ_clone(orig: &COption_NetAddressZ) -> COption_NetAddressZ { Clone::clone(&orig) }
#[repr(C)]
-/// The contents of CResult_RoutingFeesDecodeErrorZ
-pub union CResult_RoutingFeesDecodeErrorZPtr {
+/// The contents of CResult_CVec_u8ZPeerHandleErrorZ
+pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
/// A pointer to the contents in the success state.
/// Reading from this pointer when `result_ok` is not set is undefined.
- pub result: *mut crate::lightning::routing::network_graph::RoutingFees,
+ pub result: *mut crate::c_types::derived::CVec_u8Z,
/// 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,
+ pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
}
#[repr(C)]
-/// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
-/// containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
+/// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
+/// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult_RoutingFeesDecodeErrorZ {
- /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
+pub struct CResult_CVec_u8ZPeerHandleErrorZ {
+ /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_RoutingFeesDecodeErrorZPtr,
- /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
+ pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
+ /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
-pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
- CResult_RoutingFeesDecodeErrorZ {
- contents: CResult_RoutingFeesDecodeErrorZPtr {
+/// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
+pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
+ CResult_CVec_u8ZPeerHandleErrorZ {
+ contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
-pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
- CResult_RoutingFeesDecodeErrorZ {
- contents: CResult_RoutingFeesDecodeErrorZPtr {
+/// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
+pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
+ CResult_CVec_u8ZPeerHandleErrorZ {
+ contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
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_RoutingFeesDecodeErrorZ_is_ok(o: &CResult_RoutingFeesDecodeErrorZ) -> bool {
+pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o: &CResult_CVec_u8ZPeerHandleErrorZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
-pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
-impl Drop for CResult_RoutingFeesDecodeErrorZ {
+/// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
+pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
+impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
fn drop(&mut self) {
if self.result_ok {
if unsafe { !(self.contents.result as *mut ()).is_null() } {
}
}
}
-impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
let contents = if o.result_ok {
let result = unsafe { o.contents.result };
unsafe { o.contents.result = core::ptr::null_mut() };
- CResult_RoutingFeesDecodeErrorZPtr { result }
+ CResult_CVec_u8ZPeerHandleErrorZPtr { result }
} else {
let err = unsafe { o.contents.err };
unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_RoutingFeesDecodeErrorZPtr { err }
+ CResult_CVec_u8ZPeerHandleErrorZPtr { err }
};
Self {
contents,
}
}
}
-impl Clone for CResult_RoutingFeesDecodeErrorZ {
+impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
fn clone(&self) -> Self {
if self.result_ok {
- Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
- result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::RoutingFees>::clone(unsafe { &*self.contents.result })))
+ Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
+ result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
} }
} else {
- Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
- err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
+ Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
+ err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
} }
}
}
}
#[no_mangle]
-/// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
+/// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) }
+pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
#[repr(C)]
-/// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
-pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
- /// A pointer to the contents in the success state.
- /// Reading from this pointer when `result_ok` is not set is undefined.
- pub result: *mut crate::lightning::routing::network_graph::NodeAnnouncementInfo,
+/// The contents of CResult_NonePeerHandleErrorZ
+pub union CResult_NonePeerHandleErrorZPtr {
+ /// 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::ln::msgs::DecodeError,
+ pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
}
#[repr(C)]
-/// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
-/// containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
+/// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
+/// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
- /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
+pub struct CResult_NonePeerHandleErrorZ {
+ /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
- /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
+ pub contents: CResult_NonePeerHandleErrorZPtr,
+ /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
-pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
- CResult_NodeAnnouncementInfoDecodeErrorZ {
- contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
- result: Box::into_raw(Box::new(o)),
+/// Creates a new CResult_NonePeerHandleErrorZ in the success state.
+pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
+ CResult_NonePeerHandleErrorZ {
+ contents: CResult_NonePeerHandleErrorZPtr {
+ result: core::ptr::null_mut(),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
-pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
- CResult_NodeAnnouncementInfoDecodeErrorZ {
- contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
+/// Creates a new CResult_NonePeerHandleErrorZ in the error state.
+pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
+ CResult_NonePeerHandleErrorZ {
+ contents: CResult_NonePeerHandleErrorZPtr {
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_NodeAnnouncementInfoDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> bool {
+pub extern "C" fn CResult_NonePeerHandleErrorZ_is_ok(o: &CResult_NonePeerHandleErrorZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
-pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
-impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
+/// Frees any resources used by the CResult_NonePeerHandleErrorZ.
+pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
+impl Drop for CResult_NonePeerHandleErrorZ {
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::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
+impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
let contents = if o.result_ok {
- let result = unsafe { o.contents.result };
- unsafe { o.contents.result = core::ptr::null_mut() };
- CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
+ let _ = unsafe { Box::from_raw(o.contents.result) };
+ o.contents.result = core::ptr::null_mut();
+ CResult_NonePeerHandleErrorZPtr { result: core::ptr::null_mut() }
} else {
let err = unsafe { o.contents.err };
unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
+ CResult_NonePeerHandleErrorZPtr { err }
};
Self {
contents,
}
}
}
-impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
+impl Clone for CResult_NonePeerHandleErrorZ {
fn clone(&self) -> Self {
if self.result_ok {
- Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
- result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
+ Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
+ result: core::ptr::null_mut()
} }
} else {
- Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
- err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
+ Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
+ err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
} }
}
}
}
#[no_mangle]
-/// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
+/// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) }
-#[repr(C)]
-/// A dynamically-allocated array of u64s of arbitrary size.
-/// This corresponds to std::vector in C++
-pub struct CVec_u64Z {
- /// The elements in the array.
- /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
- pub data: *mut u64,
- /// The number of elements pointed to by `data`.
- pub datalen: usize
-}
-impl CVec_u64Z {
- #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
- 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) -> &[u64] {
- unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
- }
-}
-impl From<Vec<u64>> for CVec_u64Z {
- fn from(v: Vec<u64>) -> 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_u64Z_free(_res: CVec_u64Z) { }
-impl Drop for CVec_u64Z {
- fn drop(&mut self) {
- if self.datalen == 0 { return; }
- unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
- }
-}
-impl Clone for CVec_u64Z {
- 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)
- }
-}
+pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
#[repr(C)]
-/// The contents of CResult_NodeInfoDecodeErrorZ
-pub union CResult_NodeInfoDecodeErrorZPtr {
+/// The contents of CResult_boolPeerHandleErrorZ
+pub union CResult_boolPeerHandleErrorZPtr {
/// A pointer to the contents in the success state.
/// Reading from this pointer when `result_ok` is not set is undefined.
- pub result: *mut crate::lightning::routing::network_graph::NodeInfo,
+ pub result: *mut bool,
/// 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,
+ pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
}
#[repr(C)]
-/// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
-/// containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
+/// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
+/// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult_NodeInfoDecodeErrorZ {
- /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
+pub struct CResult_boolPeerHandleErrorZ {
+ /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_NodeInfoDecodeErrorZPtr,
- /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
+ pub contents: CResult_boolPeerHandleErrorZPtr,
+ /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
-pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
- CResult_NodeInfoDecodeErrorZ {
- contents: CResult_NodeInfoDecodeErrorZPtr {
+/// Creates a new CResult_boolPeerHandleErrorZ in the success state.
+pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
+ CResult_boolPeerHandleErrorZ {
+ contents: CResult_boolPeerHandleErrorZPtr {
result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
-pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
- CResult_NodeInfoDecodeErrorZ {
- contents: CResult_NodeInfoDecodeErrorZPtr {
+/// Creates a new CResult_boolPeerHandleErrorZ in the error state.
+pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
+ CResult_boolPeerHandleErrorZ {
+ contents: CResult_boolPeerHandleErrorZPtr {
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_NodeInfoDecodeErrorZ_is_ok(o: &CResult_NodeInfoDecodeErrorZ) -> bool {
+pub extern "C" fn CResult_boolPeerHandleErrorZ_is_ok(o: &CResult_boolPeerHandleErrorZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
-pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
-impl Drop for CResult_NodeInfoDecodeErrorZ {
+/// Frees any resources used by the CResult_boolPeerHandleErrorZ.
+pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
+impl Drop for CResult_boolPeerHandleErrorZ {
fn drop(&mut self) {
if self.result_ok {
if unsafe { !(self.contents.result as *mut ()).is_null() } {
}
}
}
-impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
+impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
let contents = if o.result_ok {
let result = unsafe { o.contents.result };
unsafe { o.contents.result = core::ptr::null_mut() };
- CResult_NodeInfoDecodeErrorZPtr { result }
+ CResult_boolPeerHandleErrorZPtr { result }
} else {
let err = unsafe { o.contents.err };
unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_NodeInfoDecodeErrorZPtr { err }
+ CResult_boolPeerHandleErrorZPtr { err }
};
Self {
contents,
}
}
}
-impl Clone for CResult_NodeInfoDecodeErrorZ {
+impl Clone for CResult_boolPeerHandleErrorZ {
fn clone(&self) -> Self {
if self.result_ok {
- Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
- result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeInfo>::clone(unsafe { &*self.contents.result })))
+ Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
+ result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
} }
} else {
- Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
- err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
+ Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
+ err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
} }
}
}
}
#[no_mangle]
-/// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
+/// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) }
+pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
#[repr(C)]
-/// The contents of CResult_NetworkGraphDecodeErrorZ
-pub union CResult_NetworkGraphDecodeErrorZPtr {
+/// The contents of CResult_u32GraphSyncErrorZ
+pub union CResult_u32GraphSyncErrorZPtr {
/// A pointer to the contents in the success state.
/// Reading from this pointer when `result_ok` is not set is undefined.
- pub result: *mut crate::lightning::routing::network_graph::NetworkGraph,
+ pub result: *mut u32,
/// 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,
+ pub err: *mut crate::lightning_rapid_gossip_sync::error::GraphSyncError,
}
#[repr(C)]
-/// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
-/// containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
+/// A CResult_u32GraphSyncErrorZ represents the result of a fallible operation,
+/// containing a u32 on success and a crate::lightning_rapid_gossip_sync::error::GraphSyncError on failure.
/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult_NetworkGraphDecodeErrorZ {
- /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
+pub struct CResult_u32GraphSyncErrorZ {
+ /// The contents of this CResult_u32GraphSyncErrorZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_NetworkGraphDecodeErrorZPtr,
- /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
+ pub contents: CResult_u32GraphSyncErrorZPtr,
+ /// Whether this CResult_u32GraphSyncErrorZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
-pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
- CResult_NetworkGraphDecodeErrorZ {
- contents: CResult_NetworkGraphDecodeErrorZPtr {
+/// Creates a new CResult_u32GraphSyncErrorZ in the success state.
+pub extern "C" fn CResult_u32GraphSyncErrorZ_ok(o: u32) -> CResult_u32GraphSyncErrorZ {
+ CResult_u32GraphSyncErrorZ {
+ contents: CResult_u32GraphSyncErrorZPtr {
result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
-pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
- CResult_NetworkGraphDecodeErrorZ {
- contents: CResult_NetworkGraphDecodeErrorZPtr {
+/// Creates a new CResult_u32GraphSyncErrorZ in the error state.
+pub extern "C" fn CResult_u32GraphSyncErrorZ_err(e: crate::lightning_rapid_gossip_sync::error::GraphSyncError) -> CResult_u32GraphSyncErrorZ {
+ CResult_u32GraphSyncErrorZ {
+ contents: CResult_u32GraphSyncErrorZPtr {
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_NetworkGraphDecodeErrorZ_is_ok(o: &CResult_NetworkGraphDecodeErrorZ) -> bool {
+pub extern "C" fn CResult_u32GraphSyncErrorZ_is_ok(o: &CResult_u32GraphSyncErrorZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
-pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
-impl Drop for CResult_NetworkGraphDecodeErrorZ {
+/// Frees any resources used by the CResult_u32GraphSyncErrorZ.
+pub extern "C" fn CResult_u32GraphSyncErrorZ_free(_res: CResult_u32GraphSyncErrorZ) { }
+impl Drop for CResult_u32GraphSyncErrorZ {
fn drop(&mut self) {
if self.result_ok {
if unsafe { !(self.contents.result as *mut ()).is_null() } {
}
}
}
-impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
+impl From<crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::error::GraphSyncError>> for CResult_u32GraphSyncErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::error::GraphSyncError>) -> Self {
let contents = if o.result_ok {
let result = unsafe { o.contents.result };
unsafe { o.contents.result = core::ptr::null_mut() };
- CResult_NetworkGraphDecodeErrorZPtr { result }
+ CResult_u32GraphSyncErrorZPtr { result }
} else {
let err = unsafe { o.contents.err };
unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_NetworkGraphDecodeErrorZPtr { err }
+ CResult_u32GraphSyncErrorZPtr { err }
};
Self {
contents,
}
}
}
-impl Clone for CResult_NetworkGraphDecodeErrorZ {
- fn clone(&self) -> Self {
- if self.result_ok {
- Self { result_ok: true, contents: CResult_NetworkGraphDecodeErrorZPtr {
- result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NetworkGraph>::clone(unsafe { &*self.contents.result })))
- } }
- } else {
- Self { result_ok: false, contents: CResult_NetworkGraphDecodeErrorZPtr {
- err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
- } }
- }
- }
-}
-#[no_mangle]
-/// Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
-/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_clone(orig: &CResult_NetworkGraphDecodeErrorZ) -> CResult_NetworkGraphDecodeErrorZ { Clone::clone(&orig) }
-#[repr(C)]
-#[derive(Clone)]
-/// An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
-pub enum COption_CVec_NetAddressZZ {
- /// When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
- Some(crate::c_types::derived::CVec_NetAddressZ),
- /// When we're in this state, this COption_CVec_NetAddressZZ contains nothing
- None
-}
-impl COption_CVec_NetAddressZZ {
- #[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::derived::CVec_NetAddressZ {
- if let Self::Some(v) = self { v } else { unreachable!() }
- }
-}
-#[no_mangle]
-/// Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
-pub extern "C" fn COption_CVec_NetAddressZZ_some(o: crate::c_types::derived::CVec_NetAddressZ) -> COption_CVec_NetAddressZZ {
- COption_CVec_NetAddressZZ::Some(o)
-}
-#[no_mangle]
-/// Constructs a new COption_CVec_NetAddressZZ containing nothing
-pub extern "C" fn COption_CVec_NetAddressZZ_none() -> COption_CVec_NetAddressZZ {
- COption_CVec_NetAddressZZ::None
-}
-#[no_mangle]
-/// Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
-pub extern "C" fn COption_CVec_NetAddressZZ_free(_res: COption_CVec_NetAddressZZ) { }
-#[no_mangle]
-/// Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
-/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn COption_CVec_NetAddressZZ_clone(orig: &COption_CVec_NetAddressZZ) -> COption_CVec_NetAddressZZ { Clone::clone(&orig) }
#[repr(C)]
/// The contents of CResult_NetAddressDecodeErrorZ
pub union CResult_NetAddressDecodeErrorZPtr {
/// but with all dynamically-allocated buffers duplicated in new buffers.
pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
#[repr(C)]
-/// The contents of CResult_FundingLockedDecodeErrorZ
-pub union CResult_FundingLockedDecodeErrorZPtr {
+/// The contents of CResult_ChannelReadyDecodeErrorZ
+pub union CResult_ChannelReadyDecodeErrorZPtr {
/// A pointer to the contents in the success state.
/// Reading from this pointer when `result_ok` is not set is undefined.
- pub result: *mut crate::lightning::ln::msgs::FundingLocked,
+ pub result: *mut crate::lightning::ln::msgs::ChannelReady,
/// 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_FundingLockedDecodeErrorZ represents the result of a fallible operation,
-/// containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
+/// A CResult_ChannelReadyDecodeErrorZ represents the result of a fallible operation,
+/// containing a crate::lightning::ln::msgs::ChannelReady 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_FundingLockedDecodeErrorZ {
- /// The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
+pub struct CResult_ChannelReadyDecodeErrorZ {
+ /// The contents of this CResult_ChannelReadyDecodeErrorZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_FundingLockedDecodeErrorZPtr,
- /// Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
+ pub contents: CResult_ChannelReadyDecodeErrorZPtr,
+ /// Whether this CResult_ChannelReadyDecodeErrorZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
-pub extern "C" fn CResult_FundingLockedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingLocked) -> CResult_FundingLockedDecodeErrorZ {
- CResult_FundingLockedDecodeErrorZ {
- contents: CResult_FundingLockedDecodeErrorZPtr {
+/// Creates a new CResult_ChannelReadyDecodeErrorZ in the success state.
+pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReady) -> CResult_ChannelReadyDecodeErrorZ {
+ CResult_ChannelReadyDecodeErrorZ {
+ contents: CResult_ChannelReadyDecodeErrorZPtr {
result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
-pub extern "C" fn CResult_FundingLockedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingLockedDecodeErrorZ {
- CResult_FundingLockedDecodeErrorZ {
- contents: CResult_FundingLockedDecodeErrorZPtr {
+/// Creates a new CResult_ChannelReadyDecodeErrorZ in the error state.
+pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReadyDecodeErrorZ {
+ CResult_ChannelReadyDecodeErrorZ {
+ contents: CResult_ChannelReadyDecodeErrorZPtr {
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_FundingLockedDecodeErrorZ_is_ok(o: &CResult_FundingLockedDecodeErrorZ) -> bool {
+pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_is_ok(o: &CResult_ChannelReadyDecodeErrorZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
-pub extern "C" fn CResult_FundingLockedDecodeErrorZ_free(_res: CResult_FundingLockedDecodeErrorZ) { }
-impl Drop for CResult_FundingLockedDecodeErrorZ {
+/// Frees any resources used by the CResult_ChannelReadyDecodeErrorZ.
+pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_free(_res: CResult_ChannelReadyDecodeErrorZ) { }
+impl Drop for CResult_ChannelReadyDecodeErrorZ {
fn drop(&mut self) {
if self.result_ok {
if unsafe { !(self.contents.result as *mut ()).is_null() } {
}
}
}
-impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingLockedDecodeErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReadyDecodeErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, 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_FundingLockedDecodeErrorZPtr { result }
+ CResult_ChannelReadyDecodeErrorZPtr { result }
} else {
let err = unsafe { o.contents.err };
unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_FundingLockedDecodeErrorZPtr { err }
+ CResult_ChannelReadyDecodeErrorZPtr { err }
};
Self {
contents,
}
}
}
-impl Clone for CResult_FundingLockedDecodeErrorZ {
+impl Clone for CResult_ChannelReadyDecodeErrorZ {
fn clone(&self) -> Self {
if self.result_ok {
- Self { result_ok: true, contents: CResult_FundingLockedDecodeErrorZPtr {
- result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingLocked>::clone(unsafe { &*self.contents.result })))
+ Self { result_ok: true, contents: CResult_ChannelReadyDecodeErrorZPtr {
+ result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReady>::clone(unsafe { &*self.contents.result })))
} }
} else {
- Self { result_ok: false, contents: CResult_FundingLockedDecodeErrorZPtr {
+ Self { result_ok: false, contents: CResult_ChannelReadyDecodeErrorZPtr {
err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
} }
}
}
}
#[no_mangle]
-/// Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
+/// Creates a new CResult_ChannelReadyDecodeErrorZ which has the same data as `orig`
/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_FundingLockedDecodeErrorZ_clone(orig: &CResult_FundingLockedDecodeErrorZ) -> CResult_FundingLockedDecodeErrorZ { Clone::clone(&orig) }
+pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_clone(orig: &CResult_ChannelReadyDecodeErrorZ) -> CResult_ChannelReadyDecodeErrorZ { Clone::clone(&orig) }
#[repr(C)]
/// The contents of CResult_InitDecodeErrorZ
pub union CResult_InitDecodeErrorZPtr {
pub mod lightning_persister;
pub mod lightning_background_processor;
pub mod lightning_invoice;
+pub mod lightning_rapid_gossip_sync;
}
/// An enum that represents the speed at which we want a transaction to confirm used for feerate
/// estimation.
-#[must_use]
#[derive(Clone)]
+#[must_use]
#[repr(C)]
pub enum ConfirmationTarget {
/// We are happy with this transaction confirming slowly when feerate drops some.
/// We'd like this transaction to confirm in the next few blocks.
HighPriority,
}
-use lightning::chain::chaininterface::ConfirmationTarget as nativeConfirmationTarget;
+use lightning::chain::chaininterface::ConfirmationTarget as ConfirmationTargetImport;
+pub(crate) type nativeConfirmationTarget = ConfirmationTargetImport;
+
impl ConfirmationTarget {
#[allow(unused)]
pub(crate) fn to_native(&self) -> nativeConfirmationTarget {
crate::lightning::chain::Listen {
this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void },
free: None,
+ filtered_block_connected: ChainMonitor_Listen_filtered_block_connected,
block_connected: ChainMonitor_Listen_block_connected,
block_disconnected: ChainMonitor_Listen_block_disconnected,
}
}
+extern "C" fn ChainMonitor_Listen_filtered_block_connected(this_arg: *const c_void, header: *const [u8; 80], mut txdata: crate::c_types::derived::CVec_C2Tuple_usizeTransactionZZ, mut height: u32) {
+ let mut local_txdata = Vec::new(); for mut item in txdata.into_rust().drain(..) { local_txdata.push( { let (mut orig_txdata_0_0, mut orig_txdata_0_1) = item.to_rust(); let mut local_txdata_0 = (orig_txdata_0_0, orig_txdata_0_1.into_bitcoin()); local_txdata_0 }); };
+ <nativeChainMonitor as lightning::chain::Listen<>>::filtered_block_connected(unsafe { &mut *(this_arg as *mut nativeChainMonitor) }, &::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), &local_txdata.iter().map(|(a, b)| (*a, b)).collect::<Vec<_>>()[..], height)
+}
extern "C" fn ChainMonitor_Listen_block_connected(this_arg: *const c_void, mut block: crate::c_types::u8slice, mut height: u32) {
<nativeChainMonitor as lightning::chain::Listen<>>::block_connected(unsafe { &mut *(this_arg as *mut nativeChainMonitor) }, &::bitcoin::consensus::encode::deserialize(block.to_slice()).unwrap(), height)
}
local_ret
}
#[must_use]
-extern "C" fn ChainMonitor_Watch_release_pending_monitor_events(this_arg: *const c_void) -> crate::c_types::derived::CVec_MonitorEventZ {
+extern "C" fn ChainMonitor_Watch_release_pending_monitor_events(this_arg: *const c_void) -> crate::c_types::derived::CVec_C2Tuple_OutPointCVec_MonitorEventZZZ {
let mut ret = <nativeChainMonitor as lightning::chain::Watch<_>>::release_pending_monitor_events(unsafe { &mut *(this_arg as *mut nativeChainMonitor) }, );
- let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning::chain::channelmonitor::MonitorEvent::native_into(item) }); };
+ 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) = item; 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::lightning::chain::channelmonitor::MonitorEvent::native_into(item) }); }; let mut local_ret_0 = (crate::lightning::chain::transaction::OutPoint { inner: ObjOps::heap_alloc(orig_ret_0_0), is_owned: true }, local_orig_ret_0_1.into()).into(); local_ret_0 }); };
local_ret.into()
}
local_res
}
/// An event to be processed by the ChannelManager.
-#[must_use]
#[derive(Clone)]
+#[must_use]
#[repr(C)]
pub enum MonitorEvent {
/// A monitor event containing an HTLCUpdate.
- HTLCEvent(crate::lightning::chain::channelmonitor::HTLCUpdate),
+ HTLCEvent(
+ crate::lightning::chain::channelmonitor::HTLCUpdate),
/// A monitor event that the Channel's commitment transaction was confirmed.
- CommitmentTxConfirmed(crate::lightning::chain::transaction::OutPoint),
+ CommitmentTxConfirmed(
+ crate::lightning::chain::transaction::OutPoint),
/// Indicates a [`ChannelMonitor`] update has completed. See
/// [`ChannelMonitorUpdateErr::TemporaryFailure`] for more information on how this is used.
///
/// [`ChannelMonitorUpdateErr::PermanentFailure`] for more information on how this is used.
///
/// [`ChannelMonitorUpdateErr::PermanentFailure`]: super::ChannelMonitorUpdateErr::PermanentFailure
- UpdateFailed(crate::lightning::chain::transaction::OutPoint),
+ UpdateFailed(
+ crate::lightning::chain::transaction::OutPoint),
}
-use lightning::chain::channelmonitor::MonitorEvent as nativeMonitorEvent;
+use lightning::chain::channelmonitor::MonitorEvent as MonitorEventImport;
+pub(crate) type nativeMonitorEvent = MonitorEventImport;
+
impl MonitorEvent {
#[allow(unused)]
pub(crate) fn to_native(&self) -> nativeMonitorEvent {
///
/// See [`ChannelMonitor::get_claimable_balances`] for more details on when these will or will not
/// be provided.
-#[must_use]
#[derive(Clone)]
+#[must_use]
#[repr(C)]
pub enum Balance {
/// The channel is not yet closed (or the commitment or closing transaction has not yet
claimable_height: u32,
},
}
-use lightning::chain::channelmonitor::Balance as nativeBalance;
+use lightning::chain::channelmonitor::Balance as BalanceImport;
+pub(crate) type nativeBalance = BalanceImport;
+
impl Balance {
#[allow(unused)]
pub(crate) fn to_native(&self) -> nativeBalance {
/// spend on-chain. The information needed to do this is provided in this enum, including the
/// outpoint describing which txid and output index is available, the full output which exists at
/// that txid/index, and any keys or other information required to sign.
-#[must_use]
#[derive(Clone)]
+#[must_use]
#[repr(C)]
pub enum SpendableOutputDescriptor {
/// An output to a script which was provided via KeysInterface directly, either from
/// regenerated by passing the revocation_pubkey (derived as above), our delayed_payment pubkey
/// (derived as above), and the to_self_delay contained here to
/// chan_utils::get_revokeable_redeemscript.
- DelayedPaymentOutput(crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor),
+ DelayedPaymentOutput(
+ crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor),
/// An output to a P2WPKH, spendable exclusively by our payment key (ie the private key which
/// corresponds to the public key in Sign::pubkeys().payment_point).
/// The witness in the spending input, is, thus, simply:
///
/// These are generally the result of our counterparty having broadcast the current state,
/// allowing us to claim the non-HTLC-encumbered outputs immediately.
- StaticPaymentOutput(crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor),
+ StaticPaymentOutput(
+ crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor),
}
-use lightning::chain::keysinterface::SpendableOutputDescriptor as nativeSpendableOutputDescriptor;
+use lightning::chain::keysinterface::SpendableOutputDescriptor as SpendableOutputDescriptorImport;
+pub(crate) type nativeSpendableOutputDescriptor = SpendableOutputDescriptorImport;
+
impl SpendableOutputDescriptor {
#[allow(unused)]
pub(crate) fn to_native(&self) -> nativeSpendableOutputDescriptor {
use lightning::chain::keysinterface::BaseSign as rustBaseSign;
impl rustBaseSign for BaseSign {
- fn get_per_commitment_point(&self, mut idx: u64, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1<bitcoin::secp256k1::All>) -> bitcoin::secp256k1::key::PublicKey {
+ fn get_per_commitment_point(&self, mut idx: u64, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1<bitcoin::secp256k1::All>) -> bitcoin::secp256k1::PublicKey {
let mut ret = (self.get_per_commitment_point)(self.this_arg, idx);
ret.into_rust()
}
let mut ret = (self.channel_keys_id)(self.this_arg);
ret.data
}
- fn sign_counterparty_commitment(&self, mut commitment_tx: &lightning::ln::chan_utils::CommitmentTransaction, mut preimages: Vec<lightning::ln::PaymentPreimage>, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1<bitcoin::secp256k1::All>) -> Result<(bitcoin::secp256k1::Signature, Vec<bitcoin::secp256k1::Signature>), ()> {
+ fn sign_counterparty_commitment(&self, mut commitment_tx: &lightning::ln::chan_utils::CommitmentTransaction, mut preimages: Vec<lightning::ln::PaymentPreimage>, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1<bitcoin::secp256k1::All>) -> Result<(bitcoin::secp256k1::ecdsa::Signature, Vec<bitcoin::secp256k1::ecdsa::Signature>), ()> {
let mut local_preimages = Vec::new(); for mut item in preimages.drain(..) { local_preimages.push( { crate::c_types::ThirtyTwoBytes { data: item.0 } }); };
let mut ret = (self.sign_counterparty_commitment)(self.this_arg, &crate::lightning::ln::chan_utils::CommitmentTransaction { inner: unsafe { ObjOps::nonnull_ptr_to_inner((commitment_tx as *const lightning::ln::chan_utils::CommitmentTransaction<>) as *mut _) }, is_owned: false }, local_preimages.into());
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)) })*/ })};
local_ret
}
- fn validate_counterparty_revocation(&self, mut idx: u64, mut secret: &bitcoin::secp256k1::key::SecretKey) -> Result<(), ()> {
+ fn validate_counterparty_revocation(&self, mut idx: u64, mut secret: &bitcoin::secp256k1::SecretKey) -> Result<(), ()> {
let mut ret = (self.validate_counterparty_revocation)(self.this_arg, idx, secret.as_ref());
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::Signature, Vec<bitcoin::secp256k1::Signature>), ()> {
+ 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)) })*/ })};
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::key::SecretKey, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1<bitcoin::secp256k1::All>) -> Result<bitcoin::secp256k1::Signature, ()> {
+ 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 ret = (self.sign_justice_revoked_output)(self.this_arg, crate::c_types::Transaction::from_bitcoin(justice_tx), input, amount, per_commitment_key.as_ref());
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_htlc(&self, mut justice_tx: &bitcoin::blockdata::transaction::Transaction, mut input: usize, mut amount: u64, mut per_commitment_key: &bitcoin::secp256k1::key::SecretKey, mut htlc: &lightning::ln::chan_utils::HTLCOutputInCommitment, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1<bitcoin::secp256k1::All>) -> Result<bitcoin::secp256k1::Signature, ()> {
+ fn sign_justice_revoked_htlc(&self, mut justice_tx: &bitcoin::blockdata::transaction::Transaction, mut input: usize, mut amount: u64, mut per_commitment_key: &bitcoin::secp256k1::SecretKey, mut htlc: &lightning::ln::chan_utils::HTLCOutputInCommitment, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1<bitcoin::secp256k1::All>) -> Result<bitcoin::secp256k1::ecdsa::Signature, ()> {
let mut ret = (self.sign_justice_revoked_htlc)(self.this_arg, crate::c_types::Transaction::from_bitcoin(justice_tx), input, amount, per_commitment_key.as_ref(), &crate::lightning::ln::chan_utils::HTLCOutputInCommitment { inner: unsafe { ObjOps::nonnull_ptr_to_inner((htlc as *const lightning::ln::chan_utils::HTLCOutputInCommitment<>) 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_counterparty_htlc_transaction(&self, mut htlc_tx: &bitcoin::blockdata::transaction::Transaction, mut input: usize, mut amount: u64, mut per_commitment_point: &bitcoin::secp256k1::key::PublicKey, mut htlc: &lightning::ln::chan_utils::HTLCOutputInCommitment, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1<bitcoin::secp256k1::All>) -> Result<bitcoin::secp256k1::Signature, ()> {
+ fn sign_counterparty_htlc_transaction(&self, mut htlc_tx: &bitcoin::blockdata::transaction::Transaction, mut input: usize, mut amount: u64, mut per_commitment_point: &bitcoin::secp256k1::PublicKey, mut htlc: &lightning::ln::chan_utils::HTLCOutputInCommitment, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1<bitcoin::secp256k1::All>) -> Result<bitcoin::secp256k1::ecdsa::Signature, ()> {
let mut ret = (self.sign_counterparty_htlc_transaction)(self.this_arg, crate::c_types::Transaction::from_bitcoin(htlc_tx), input, amount, crate::c_types::PublicKey::from_rust(&per_commitment_point), &crate::lightning::ln::chan_utils::HTLCOutputInCommitment { inner: unsafe { ObjOps::nonnull_ptr_to_inner((htlc as *const lightning::ln::chan_utils::HTLCOutputInCommitment<>) 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_closing_transaction(&self, mut closing_tx: &lightning::ln::chan_utils::ClosingTransaction, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1<bitcoin::secp256k1::All>) -> Result<bitcoin::secp256k1::Signature, ()> {
+ fn sign_closing_transaction(&self, mut closing_tx: &lightning::ln::chan_utils::ClosingTransaction, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1<bitcoin::secp256k1::All>) -> Result<bitcoin::secp256k1::ecdsa::Signature, ()> {
let mut ret = (self.sign_closing_transaction)(self.this_arg, &crate::lightning::ln::chan_utils::ClosingTransaction { inner: unsafe { ObjOps::nonnull_ptr_to_inner((closing_tx as *const lightning::ln::chan_utils::ClosingTransaction<>) 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_channel_announcement(&self, mut msg: &lightning::ln::msgs::UnsignedChannelAnnouncement, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1<bitcoin::secp256k1::All>) -> Result<(bitcoin::secp256k1::Signature, bitcoin::secp256k1::Signature), ()> {
+ fn sign_channel_announcement(&self, mut msg: &lightning::ln::msgs::UnsignedChannelAnnouncement, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1<bitcoin::secp256k1::All>) -> Result<(bitcoin::secp256k1::ecdsa::Signature, bitcoin::secp256k1::ecdsa::Signature), ()> {
let mut ret = (self.sign_channel_announcement)(self.this_arg, &crate::lightning::ln::msgs::UnsignedChannelAnnouncement { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::UnsignedChannelAnnouncement<>) 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_ret_0 = (orig_ret_0_0.into_rust(), orig_ret_0_1.into_rust()); local_ret_0 }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })};
local_ret
}
}
impl lightning::chain::keysinterface::BaseSign for Sign {
- fn get_per_commitment_point(&self, mut idx: u64, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1<bitcoin::secp256k1::All>) -> bitcoin::secp256k1::key::PublicKey {
+ fn get_per_commitment_point(&self, mut idx: u64, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1<bitcoin::secp256k1::All>) -> bitcoin::secp256k1::PublicKey {
let mut ret = (self.BaseSign.get_per_commitment_point)(self.BaseSign.this_arg, idx);
ret.into_rust()
}
let mut ret = (self.BaseSign.channel_keys_id)(self.BaseSign.this_arg);
ret.data
}
- fn sign_counterparty_commitment(&self, mut commitment_tx: &lightning::ln::chan_utils::CommitmentTransaction, mut preimages: Vec<lightning::ln::PaymentPreimage>, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1<bitcoin::secp256k1::All>) -> Result<(bitcoin::secp256k1::Signature, Vec<bitcoin::secp256k1::Signature>), ()> {
+ fn sign_counterparty_commitment(&self, mut commitment_tx: &lightning::ln::chan_utils::CommitmentTransaction, mut preimages: Vec<lightning::ln::PaymentPreimage>, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1<bitcoin::secp256k1::All>) -> Result<(bitcoin::secp256k1::ecdsa::Signature, Vec<bitcoin::secp256k1::ecdsa::Signature>), ()> {
let mut local_preimages = Vec::new(); for mut item in preimages.drain(..) { local_preimages.push( { crate::c_types::ThirtyTwoBytes { data: item.0 } }); };
let mut ret = (self.BaseSign.sign_counterparty_commitment)(self.BaseSign.this_arg, &crate::lightning::ln::chan_utils::CommitmentTransaction { inner: unsafe { ObjOps::nonnull_ptr_to_inner((commitment_tx as *const lightning::ln::chan_utils::CommitmentTransaction<>) as *mut _) }, is_owned: false }, local_preimages.into());
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)) })*/ })};
local_ret
}
- fn validate_counterparty_revocation(&self, mut idx: u64, mut secret: &bitcoin::secp256k1::key::SecretKey) -> Result<(), ()> {
+ fn validate_counterparty_revocation(&self, mut idx: u64, mut secret: &bitcoin::secp256k1::SecretKey) -> Result<(), ()> {
let mut ret = (self.BaseSign.validate_counterparty_revocation)(self.BaseSign.this_arg, idx, secret.as_ref());
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::Signature, Vec<bitcoin::secp256k1::Signature>), ()> {
+ 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.BaseSign.sign_holder_commitment_and_htlcs)(self.BaseSign.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)) })*/ })};
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::key::SecretKey, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1<bitcoin::secp256k1::All>) -> Result<bitcoin::secp256k1::Signature, ()> {
+ 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 ret = (self.BaseSign.sign_justice_revoked_output)(self.BaseSign.this_arg, crate::c_types::Transaction::from_bitcoin(justice_tx), input, amount, per_commitment_key.as_ref());
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_htlc(&self, mut justice_tx: &bitcoin::blockdata::transaction::Transaction, mut input: usize, mut amount: u64, mut per_commitment_key: &bitcoin::secp256k1::key::SecretKey, mut htlc: &lightning::ln::chan_utils::HTLCOutputInCommitment, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1<bitcoin::secp256k1::All>) -> Result<bitcoin::secp256k1::Signature, ()> {
+ fn sign_justice_revoked_htlc(&self, mut justice_tx: &bitcoin::blockdata::transaction::Transaction, mut input: usize, mut amount: u64, mut per_commitment_key: &bitcoin::secp256k1::SecretKey, mut htlc: &lightning::ln::chan_utils::HTLCOutputInCommitment, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1<bitcoin::secp256k1::All>) -> Result<bitcoin::secp256k1::ecdsa::Signature, ()> {
let mut ret = (self.BaseSign.sign_justice_revoked_htlc)(self.BaseSign.this_arg, crate::c_types::Transaction::from_bitcoin(justice_tx), input, amount, per_commitment_key.as_ref(), &crate::lightning::ln::chan_utils::HTLCOutputInCommitment { inner: unsafe { ObjOps::nonnull_ptr_to_inner((htlc as *const lightning::ln::chan_utils::HTLCOutputInCommitment<>) 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_counterparty_htlc_transaction(&self, mut htlc_tx: &bitcoin::blockdata::transaction::Transaction, mut input: usize, mut amount: u64, mut per_commitment_point: &bitcoin::secp256k1::key::PublicKey, mut htlc: &lightning::ln::chan_utils::HTLCOutputInCommitment, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1<bitcoin::secp256k1::All>) -> Result<bitcoin::secp256k1::Signature, ()> {
+ fn sign_counterparty_htlc_transaction(&self, mut htlc_tx: &bitcoin::blockdata::transaction::Transaction, mut input: usize, mut amount: u64, mut per_commitment_point: &bitcoin::secp256k1::PublicKey, mut htlc: &lightning::ln::chan_utils::HTLCOutputInCommitment, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1<bitcoin::secp256k1::All>) -> Result<bitcoin::secp256k1::ecdsa::Signature, ()> {
let mut ret = (self.BaseSign.sign_counterparty_htlc_transaction)(self.BaseSign.this_arg, crate::c_types::Transaction::from_bitcoin(htlc_tx), input, amount, crate::c_types::PublicKey::from_rust(&per_commitment_point), &crate::lightning::ln::chan_utils::HTLCOutputInCommitment { inner: unsafe { ObjOps::nonnull_ptr_to_inner((htlc as *const lightning::ln::chan_utils::HTLCOutputInCommitment<>) 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_closing_transaction(&self, mut closing_tx: &lightning::ln::chan_utils::ClosingTransaction, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1<bitcoin::secp256k1::All>) -> Result<bitcoin::secp256k1::Signature, ()> {
+ fn sign_closing_transaction(&self, mut closing_tx: &lightning::ln::chan_utils::ClosingTransaction, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1<bitcoin::secp256k1::All>) -> Result<bitcoin::secp256k1::ecdsa::Signature, ()> {
let mut ret = (self.BaseSign.sign_closing_transaction)(self.BaseSign.this_arg, &crate::lightning::ln::chan_utils::ClosingTransaction { inner: unsafe { ObjOps::nonnull_ptr_to_inner((closing_tx as *const lightning::ln::chan_utils::ClosingTransaction<>) 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_channel_announcement(&self, mut msg: &lightning::ln::msgs::UnsignedChannelAnnouncement, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1<bitcoin::secp256k1::All>) -> Result<(bitcoin::secp256k1::Signature, bitcoin::secp256k1::Signature), ()> {
+ fn sign_channel_announcement(&self, mut msg: &lightning::ln::msgs::UnsignedChannelAnnouncement, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1<bitcoin::secp256k1::All>) -> Result<(bitcoin::secp256k1::ecdsa::Signature, bitcoin::secp256k1::ecdsa::Signature), ()> {
let mut ret = (self.BaseSign.sign_channel_announcement)(self.BaseSign.this_arg, &crate::lightning::ln::msgs::UnsignedChannelAnnouncement { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::UnsignedChannelAnnouncement<>) 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_ret_0 = (orig_ret_0_0.into_rust(), orig_ret_0_1.into_rust()); local_ret_0 }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })};
local_ret
}
/// Specifies the recipient of an invoice, to indicate to [`KeysInterface::sign_invoice`] what node
/// secret key should be used to sign the invoice.
-#[must_use]
#[derive(Clone)]
+#[must_use]
#[repr(C)]
pub enum Recipient {
/// The invoice should be signed with the local node secret key.
/// [phantom node payment]: PhantomKeysManager
PhantomNode,
}
-use lightning::chain::keysinterface::Recipient as nativeRecipient;
+use lightning::chain::keysinterface::Recipient as RecipientImport;
+pub(crate) type nativeRecipient = RecipientImport;
+
impl Recipient {
#[allow(unused)]
pub(crate) fn to_native(&self) -> nativeRecipient {
use lightning::chain::keysinterface::KeysInterface as rustKeysInterface;
impl rustKeysInterface for KeysInterface {
type Signer = crate::lightning::chain::keysinterface::Sign;
- fn get_node_secret(&self, mut recipient: lightning::chain::keysinterface::Recipient) -> Result<bitcoin::secp256k1::key::SecretKey, ()> {
+ fn get_node_secret(&self, mut recipient: lightning::chain::keysinterface::Recipient) -> Result<bitcoin::secp256k1::SecretKey, ()> {
let mut ret = (self.get_node_secret)(self.this_arg, crate::lightning::chain::keysinterface::Recipient::native_into(recipient));
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
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((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).take_inner()) } })};
local_ret
}
- fn sign_invoice(&self, mut hrp_bytes: &[u8], mut invoice_data: &[bitcoin::bech32::u5], mut receipient: lightning::chain::keysinterface::Recipient) -> Result<bitcoin::secp256k1::recovery::RecoverableSignature, ()> {
+ fn sign_invoice(&self, mut hrp_bytes: &[u8], mut invoice_data: &[bitcoin::bech32::u5], mut receipient: lightning::chain::keysinterface::Recipient) -> Result<bitcoin::secp256k1::ecdsa::RecoverableSignature, ()> {
let mut local_hrp_bytes = crate::c_types::u8slice::from_slice(hrp_bytes);
let mut local_invoice_data_clone = Vec::new(); local_invoice_data_clone.extend_from_slice(invoice_data); let mut invoice_data = local_invoice_data_clone; let mut local_invoice_data = Vec::new(); for mut item in invoice_data.drain(..) { local_invoice_data.push( { item.into() }); };
let mut ret = (self.sign_invoice)(self.this_arg, local_hrp_bytes, local_invoice_data.into(), crate::lightning::chain::keysinterface::Recipient::native_into(receipient));
#[must_use]
#[no_mangle]
pub extern "C" fn InMemorySigner_new(mut node_secret: crate::c_types::SecretKey, mut funding_key: crate::c_types::SecretKey, mut revocation_base_key: crate::c_types::SecretKey, mut payment_key: crate::c_types::SecretKey, mut delayed_payment_base_key: crate::c_types::SecretKey, mut htlc_base_key: crate::c_types::SecretKey, mut commitment_seed: crate::c_types::ThirtyTwoBytes, mut channel_value_satoshis: u64, mut channel_keys_id: crate::c_types::ThirtyTwoBytes) -> crate::lightning::chain::keysinterface::InMemorySigner {
- let mut ret = lightning::chain::keysinterface::InMemorySigner::new(secp256k1::SECP256K1, node_secret.into_rust(), funding_key.into_rust(), revocation_base_key.into_rust(), payment_key.into_rust(), delayed_payment_base_key.into_rust(), htlc_base_key.into_rust(), commitment_seed.data, channel_value_satoshis, channel_keys_id.data);
+ let mut ret = lightning::chain::keysinterface::InMemorySigner::new(secp256k1::global::SECP256K1, node_secret.into_rust(), funding_key.into_rust(), revocation_base_key.into_rust(), payment_key.into_rust(), delayed_payment_base_key.into_rust(), htlc_base_key.into_rust(), commitment_seed.data, channel_value_satoshis, channel_keys_id.data);
crate::lightning::chain::keysinterface::InMemorySigner { inner: ObjOps::heap_alloc(ret), is_owned: true }
}
#[must_use]
#[no_mangle]
pub extern "C" fn InMemorySigner_sign_counterparty_payment_input(this_arg: &crate::lightning::chain::keysinterface::InMemorySigner, mut spend_tx: crate::c_types::Transaction, mut input_idx: usize, descriptor: &crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor) -> crate::c_types::derived::CResult_CVec_CVec_u8ZZNoneZ {
- let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.sign_counterparty_payment_input(&spend_tx.into_bitcoin(), input_idx, descriptor.get_native_ref(), secp256k1::SECP256K1);
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.sign_counterparty_payment_input(&spend_tx.into_bitcoin(), input_idx, descriptor.get_native_ref(), secp256k1::global::SECP256K1);
let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { let mut local_ret_0 = Vec::new(); for mut item in o.drain(..) { local_ret_0.push( { let mut local_ret_0_0 = Vec::new(); for mut item in item.drain(..) { local_ret_0_0.push( { item }); }; local_ret_0_0.into() }); }; local_ret_0.into() }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() };
local_ret
}
#[must_use]
#[no_mangle]
pub extern "C" fn InMemorySigner_sign_dynamic_p2wsh_input(this_arg: &crate::lightning::chain::keysinterface::InMemorySigner, mut spend_tx: crate::c_types::Transaction, mut input_idx: usize, descriptor: &crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor) -> crate::c_types::derived::CResult_CVec_CVec_u8ZZNoneZ {
- let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.sign_dynamic_p2wsh_input(&spend_tx.into_bitcoin(), input_idx, descriptor.get_native_ref(), secp256k1::SECP256K1);
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.sign_dynamic_p2wsh_input(&spend_tx.into_bitcoin(), input_idx, descriptor.get_native_ref(), secp256k1::global::SECP256K1);
let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { let mut local_ret_0 = Vec::new(); for mut item in o.drain(..) { local_ret_0.push( { let mut local_ret_0_0 = Vec::new(); for mut item in item.drain(..) { local_ret_0_0.push( { item }); }; local_ret_0_0.into() }); }; local_ret_0.into() }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() };
local_ret
}
#[must_use]
extern "C" fn InMemorySigner_BaseSign_get_per_commitment_point(this_arg: *const c_void, mut idx: u64) -> crate::c_types::PublicKey {
- let mut ret = <nativeInMemorySigner as lightning::chain::keysinterface::BaseSign<>>::get_per_commitment_point(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, idx, secp256k1::SECP256K1);
+ let mut ret = <nativeInMemorySigner as lightning::chain::keysinterface::BaseSign<>>::get_per_commitment_point(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, idx, secp256k1::global::SECP256K1);
crate::c_types::PublicKey::from_rust(&ret)
}
#[must_use]
#[must_use]
extern "C" fn InMemorySigner_BaseSign_sign_counterparty_commitment(this_arg: *const c_void, commitment_tx: &crate::lightning::ln::chan_utils::CommitmentTransaction, mut _preimages: crate::c_types::derived::CVec_PaymentPreimageZ) -> crate::c_types::derived::CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
let mut local__preimages = Vec::new(); for mut item in _preimages.into_rust().drain(..) { local__preimages.push( { ::lightning::ln::PaymentPreimage(item.data) }); };
- let mut ret = <nativeInMemorySigner as lightning::chain::keysinterface::BaseSign<>>::sign_counterparty_commitment(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, commitment_tx.get_native_ref(), local__preimages, secp256k1::SECP256K1);
+ let mut ret = <nativeInMemorySigner as lightning::chain::keysinterface::BaseSign<>>::sign_counterparty_commitment(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, commitment_tx.get_native_ref(), local__preimages, 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::Signature::from_rust(&item) }); }; let mut local_ret_0 = (crate::c_types::Signature::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() };
local_ret
}
#[must_use]
extern "C" fn InMemorySigner_BaseSign_validate_counterparty_revocation(this_arg: *const c_void, mut _idx: u64, _secret: *const [u8; 32]) -> crate::c_types::derived::CResult_NoneNoneZ {
- let mut ret = <nativeInMemorySigner as lightning::chain::keysinterface::BaseSign<>>::validate_counterparty_revocation(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, _idx, &::bitcoin::secp256k1::key::SecretKey::from_slice(&unsafe { *_secret}[..]).unwrap());
+ let mut ret = <nativeInMemorySigner as lightning::chain::keysinterface::BaseSign<>>::validate_counterparty_revocation(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, _idx, &::bitcoin::secp256k1::SecretKey::from_slice(&unsafe { *_secret}[..]).unwrap());
let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() };
local_ret
}
#[must_use]
extern "C" fn InMemorySigner_BaseSign_sign_holder_commitment_and_htlcs(this_arg: *const c_void, commitment_tx: &crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> crate::c_types::derived::CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
- let mut ret = <nativeInMemorySigner as lightning::chain::keysinterface::BaseSign<>>::sign_holder_commitment_and_htlcs(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, commitment_tx.get_native_ref(), secp256k1::SECP256K1);
+ let mut ret = <nativeInMemorySigner as lightning::chain::keysinterface::BaseSign<>>::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::Signature::from_rust(&item) }); }; let mut local_ret_0 = (crate::c_types::Signature::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() };
local_ret
}
#[must_use]
extern "C" fn InMemorySigner_BaseSign_sign_justice_revoked_output(this_arg: *const c_void, mut justice_tx: crate::c_types::Transaction, mut input: usize, mut amount: u64, per_commitment_key: *const [u8; 32]) -> crate::c_types::derived::CResult_SignatureNoneZ {
- let mut ret = <nativeInMemorySigner as lightning::chain::keysinterface::BaseSign<>>::sign_justice_revoked_output(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, &justice_tx.into_bitcoin(), input, amount, &::bitcoin::secp256k1::key::SecretKey::from_slice(&unsafe { *per_commitment_key}[..]).unwrap(), secp256k1::SECP256K1);
+ let mut ret = <nativeInMemorySigner as lightning::chain::keysinterface::BaseSign<>>::sign_justice_revoked_output(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, &justice_tx.into_bitcoin(), input, amount, &::bitcoin::secp256k1::SecretKey::from_slice(&unsafe { *per_commitment_key}[..]).unwrap(), secp256k1::global::SECP256K1);
let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::Signature::from_rust(&o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() };
local_ret
}
#[must_use]
extern "C" fn InMemorySigner_BaseSign_sign_justice_revoked_htlc(this_arg: *const c_void, mut justice_tx: crate::c_types::Transaction, mut input: usize, mut amount: u64, per_commitment_key: *const [u8; 32], htlc: &crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> crate::c_types::derived::CResult_SignatureNoneZ {
- let mut ret = <nativeInMemorySigner as lightning::chain::keysinterface::BaseSign<>>::sign_justice_revoked_htlc(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, &justice_tx.into_bitcoin(), input, amount, &::bitcoin::secp256k1::key::SecretKey::from_slice(&unsafe { *per_commitment_key}[..]).unwrap(), htlc.get_native_ref(), secp256k1::SECP256K1);
+ let mut ret = <nativeInMemorySigner as lightning::chain::keysinterface::BaseSign<>>::sign_justice_revoked_htlc(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, &justice_tx.into_bitcoin(), input, amount, &::bitcoin::secp256k1::SecretKey::from_slice(&unsafe { *per_commitment_key}[..]).unwrap(), htlc.get_native_ref(), secp256k1::global::SECP256K1);
let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::Signature::from_rust(&o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() };
local_ret
}
#[must_use]
extern "C" fn InMemorySigner_BaseSign_sign_counterparty_htlc_transaction(this_arg: *const c_void, mut htlc_tx: crate::c_types::Transaction, mut input: usize, mut amount: u64, mut per_commitment_point: crate::c_types::PublicKey, htlc: &crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> crate::c_types::derived::CResult_SignatureNoneZ {
- let mut ret = <nativeInMemorySigner as lightning::chain::keysinterface::BaseSign<>>::sign_counterparty_htlc_transaction(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, &htlc_tx.into_bitcoin(), input, amount, &per_commitment_point.into_rust(), htlc.get_native_ref(), secp256k1::SECP256K1);
+ let mut ret = <nativeInMemorySigner as lightning::chain::keysinterface::BaseSign<>>::sign_counterparty_htlc_transaction(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, &htlc_tx.into_bitcoin(), input, amount, &per_commitment_point.into_rust(), htlc.get_native_ref(), secp256k1::global::SECP256K1);
let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::Signature::from_rust(&o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() };
local_ret
}
#[must_use]
extern "C" fn InMemorySigner_BaseSign_sign_closing_transaction(this_arg: *const c_void, closing_tx: &crate::lightning::ln::chan_utils::ClosingTransaction) -> crate::c_types::derived::CResult_SignatureNoneZ {
- let mut ret = <nativeInMemorySigner as lightning::chain::keysinterface::BaseSign<>>::sign_closing_transaction(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, closing_tx.get_native_ref(), secp256k1::SECP256K1);
+ let mut ret = <nativeInMemorySigner as lightning::chain::keysinterface::BaseSign<>>::sign_closing_transaction(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, closing_tx.get_native_ref(), secp256k1::global::SECP256K1);
let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::Signature::from_rust(&o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() };
local_ret
}
#[must_use]
extern "C" fn InMemorySigner_BaseSign_sign_channel_announcement(this_arg: *const c_void, msg: &crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> crate::c_types::derived::CResult_C2Tuple_SignatureSignatureZNoneZ {
- let mut ret = <nativeInMemorySigner as lightning::chain::keysinterface::BaseSign<>>::sign_channel_announcement(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, msg.get_native_ref(), secp256k1::SECP256K1);
+ let mut ret = <nativeInMemorySigner as lightning::chain::keysinterface::BaseSign<>>::sign_channel_announcement(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, msg.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_ret_0 = (crate::c_types::Signature::from_rust(&orig_ret_0_0), crate::c_types::Signature::from_rust(&orig_ret_0_1)).into(); local_ret_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() };
local_ret
}
pub extern "C" fn KeysManager_spend_spendable_outputs(this_arg: &crate::lightning::chain::keysinterface::KeysManager, mut descriptors: crate::c_types::derived::CVec_SpendableOutputDescriptorZ, mut outputs: crate::c_types::derived::CVec_TxOutZ, mut change_destination_script: crate::c_types::derived::CVec_u8Z, mut feerate_sat_per_1000_weight: u32) -> crate::c_types::derived::CResult_TransactionNoneZ {
let mut local_descriptors = Vec::new(); for mut item in descriptors.into_rust().drain(..) { local_descriptors.push( { item.into_native() }); };
let mut local_outputs = Vec::new(); for mut item in outputs.into_rust().drain(..) { local_outputs.push( { item.into_rust() }); };
- let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.spend_spendable_outputs(&local_descriptors.iter().collect::<Vec<_>>()[..], local_outputs, ::bitcoin::blockdata::script::Script::from(change_destination_script.into_rust()), feerate_sat_per_1000_weight, secp256k1::SECP256K1);
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.spend_spendable_outputs(&local_descriptors.iter().collect::<Vec<_>>()[..], local_outputs, ::bitcoin::blockdata::script::Script::from(change_destination_script.into_rust()), feerate_sat_per_1000_weight, secp256k1::global::SECP256K1);
let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::Transaction::from_bitcoin(&o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() };
local_ret
}
local_ret
}
#[must_use]
-extern "C" fn KeysManager_KeysInterface_get_inbound_payment_key_material(this_arg: *const c_void) -> crate::c_types::ThirtyTwoBytes {
- let mut ret = <nativeKeysManager as lightning::chain::keysinterface::KeysInterface<>>::get_inbound_payment_key_material(unsafe { &mut *(this_arg as *mut nativeKeysManager) }, );
- crate::c_types::ThirtyTwoBytes { data: ret.0 }
-}
-#[must_use]
extern "C" fn KeysManager_KeysInterface_get_destination_script(this_arg: *const c_void) -> crate::c_types::derived::CVec_u8Z {
let mut ret = <nativeKeysManager as lightning::chain::keysinterface::KeysInterface<>>::get_destination_script(unsafe { &mut *(this_arg as *mut nativeKeysManager) }, );
ret.into_bytes().into()
let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::RecoverableSignature::from_rust(&o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() };
local_ret
}
+#[must_use]
+extern "C" fn KeysManager_KeysInterface_get_inbound_payment_key_material(this_arg: *const c_void) -> crate::c_types::ThirtyTwoBytes {
+ let mut ret = <nativeKeysManager as lightning::chain::keysinterface::KeysInterface<>>::get_inbound_payment_key_material(unsafe { &mut *(this_arg as *mut nativeKeysManager) }, );
+ crate::c_types::ThirtyTwoBytes { data: ret.0 }
+}
use lightning::chain::keysinterface::PhantomKeysManager as nativePhantomKeysManagerImport;
local_ret
}
#[must_use]
-extern "C" fn PhantomKeysManager_KeysInterface_get_inbound_payment_key_material(this_arg: *const c_void) -> crate::c_types::ThirtyTwoBytes {
- let mut ret = <nativePhantomKeysManager as lightning::chain::keysinterface::KeysInterface<>>::get_inbound_payment_key_material(unsafe { &mut *(this_arg as *mut nativePhantomKeysManager) }, );
- crate::c_types::ThirtyTwoBytes { data: ret.0 }
-}
-#[must_use]
extern "C" fn PhantomKeysManager_KeysInterface_get_destination_script(this_arg: *const c_void) -> crate::c_types::derived::CVec_u8Z {
let mut ret = <nativePhantomKeysManager as lightning::chain::keysinterface::KeysInterface<>>::get_destination_script(unsafe { &mut *(this_arg as *mut nativePhantomKeysManager) }, );
ret.into_bytes().into()
let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::RecoverableSignature::from_rust(&o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() };
local_ret
}
+#[must_use]
+extern "C" fn PhantomKeysManager_KeysInterface_get_inbound_payment_key_material(this_arg: *const c_void) -> crate::c_types::ThirtyTwoBytes {
+ let mut ret = <nativePhantomKeysManager as lightning::chain::keysinterface::KeysInterface<>>::get_inbound_payment_key_material(unsafe { &mut *(this_arg as *mut nativePhantomKeysManager) }, );
+ crate::c_types::ThirtyTwoBytes { data: ret.0 }
+}
/// Constructs a `PhantomKeysManager` given a 32-byte seed and an additional `cross_node_seed`
/// that is shared across all nodes that intend to participate in [phantom node payments] together.
pub extern "C" fn PhantomKeysManager_spend_spendable_outputs(this_arg: &crate::lightning::chain::keysinterface::PhantomKeysManager, mut descriptors: crate::c_types::derived::CVec_SpendableOutputDescriptorZ, mut outputs: crate::c_types::derived::CVec_TxOutZ, mut change_destination_script: crate::c_types::derived::CVec_u8Z, mut feerate_sat_per_1000_weight: u32) -> crate::c_types::derived::CResult_TransactionNoneZ {
let mut local_descriptors = Vec::new(); for mut item in descriptors.into_rust().drain(..) { local_descriptors.push( { item.into_native() }); };
let mut local_outputs = Vec::new(); for mut item in outputs.into_rust().drain(..) { local_outputs.push( { item.into_rust() }); };
- let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.spend_spendable_outputs(&local_descriptors.iter().collect::<Vec<_>>()[..], local_outputs, ::bitcoin::blockdata::script::Script::from(change_destination_script.into_rust()), feerate_sat_per_1000_weight, secp256k1::SECP256K1);
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.spend_spendable_outputs(&local_descriptors.iter().collect::<Vec<_>>()[..], local_outputs, ::bitcoin::blockdata::script::Script::from(change_destination_script.into_rust()), feerate_sat_per_1000_weight, secp256k1::global::SECP256K1);
let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::Transaction::from_bitcoin(&o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() };
local_ret
}
}
/// An error when accessing the chain via [`Access`].
-#[must_use]
#[derive(Clone)]
+#[must_use]
#[repr(C)]
pub enum AccessError {
/// The requested chain is unknown.
/// The requested transaction doesn't exist or hasn't confirmed.
UnknownTx,
}
-use lightning::chain::AccessError as nativeAccessError;
+use lightning::chain::AccessError as AccessErrorImport;
+pub(crate) type nativeAccessError = AccessErrorImport;
+
impl AccessError {
#[allow(unused)]
pub(crate) fn to_native(&self) -> nativeAccessError {
/// Returns an error if `genesis_hash` is for a different chain or if such a transaction output
/// is unknown.
///
- /// [`short_channel_id`]: https://github.com/lightningnetwork/lightning-rfc/blob/master/07-routing-gossip.md#definition-of-short_channel_id
+ /// [`short_channel_id`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#definition-of-short_channel_id
#[must_use]
pub get_utxo: extern "C" fn (this_arg: *const c_void, genesis_hash: *const [u8; 32], short_channel_id: u64) -> crate::c_types::derived::CResult_TxOutAccessErrorZ,
/// Frees any resources associated with this object given its this_arg pointer.
/// sourcing chain data using a block-oriented API should prefer this interface over [`Confirm`].
/// Such clients fetch the entire header chain whereas clients using [`Confirm`] only fetch headers
/// when needed.
+///
+/// By using [`Listen::filtered_block_connected`] this interface supports clients fetching the
+/// entire header chain and only blocks with matching transaction data using BIP 157 filters or
+/// other similar filtering.
#[repr(C)]
pub struct Listen {
/// 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,
+ /// Notifies the listener that a block was added at the given height, with the transaction data
+ /// possibly filtered.
+ pub filtered_block_connected: extern "C" fn (this_arg: *const c_void, header: *const [u8; 80], txdata: crate::c_types::derived::CVec_C2Tuple_usizeTransactionZZ, height: u32),
/// Notifies the listener that a block was added at the given height.
pub block_connected: extern "C" fn (this_arg: *const c_void, block: crate::c_types::u8slice, height: u32),
/// Notifies the listener that a block was removed at the given height.
pub(crate) extern "C" fn Listen_clone_fields(orig: &Listen) -> Listen {
Listen {
this_arg: orig.this_arg,
+ filtered_block_connected: Clone::clone(&orig.filtered_block_connected),
block_connected: Clone::clone(&orig.block_connected),
block_disconnected: Clone::clone(&orig.block_disconnected),
free: Clone::clone(&orig.free),
use lightning::chain::Listen as rustListen;
impl rustListen for Listen {
+ fn filtered_block_connected(&self, mut header: &bitcoin::blockdata::block::BlockHeader, mut txdata: &lightning::chain::transaction::TransactionData, mut height: u32) {
+ let mut local_header = { let mut s = [0u8; 80]; s[..].copy_from_slice(&::bitcoin::consensus::encode::serialize(header)); s };
+ let mut local_txdata = Vec::new(); for item in txdata.iter() { local_txdata.push( { let (mut orig_txdata_0_0, mut orig_txdata_0_1) = item; let mut local_txdata_0 = (orig_txdata_0_0, crate::c_types::Transaction::from_bitcoin(&orig_txdata_0_1)).into(); local_txdata_0 }); };
+ (self.filtered_block_connected)(self.this_arg, &local_header, local_txdata.into(), height)
+ }
fn block_connected(&self, mut block: &bitcoin::blockdata::block::Block, mut height: u32) {
let mut local_block = ::bitcoin::consensus::encode::serialize(block);
(self.block_connected)(self.this_arg, crate::c_types::u8slice::from_slice(&local_block), height)
}
}
/// An error enum representing a failure to persist a channel monitor update.
-#[must_use]
#[derive(Clone)]
+#[must_use]
#[repr(C)]
pub enum ChannelMonitorUpdateErr {
/// Used to indicate a temporary failure (eg connection to a watchtower or remote backup of
/// lagging behind on block processing.
PermanentFailure,
}
-use lightning::chain::ChannelMonitorUpdateErr as nativeChannelMonitorUpdateErr;
+use lightning::chain::ChannelMonitorUpdateErr as ChannelMonitorUpdateErrImport;
+pub(crate) type nativeChannelMonitorUpdateErr = ChannelMonitorUpdateErrImport;
+
impl ChannelMonitorUpdateErr {
#[allow(unused)]
pub(crate) fn to_native(&self) -> nativeChannelMonitorUpdateErr {
/// For details on asynchronous [`ChannelMonitor`] updating and returning
/// [`MonitorEvent::UpdateCompleted`] here, see [`ChannelMonitorUpdateErr::TemporaryFailure`].
#[must_use]
- pub release_pending_monitor_events: extern "C" fn (this_arg: *const c_void) -> crate::c_types::derived::CVec_MonitorEventZ,
+ pub release_pending_monitor_events: extern "C" fn (this_arg: *const c_void) -> crate::c_types::derived::CVec_C2Tuple_OutPointCVec_MonitorEventZZZ,
/// 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)>,
let mut local_ret = match ret.result_ok { true => Ok( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) })*/ }), false => Err( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).into_native() })};
local_ret
}
- fn release_pending_monitor_events(&self) -> Vec<lightning::chain::channelmonitor::MonitorEvent> {
+ fn release_pending_monitor_events(&self) -> Vec<(lightning::chain::transaction::OutPoint, Vec<lightning::chain::channelmonitor::MonitorEvent>)> {
let mut ret = (self.release_pending_monitor_events)(self.this_arg);
- let mut local_ret = Vec::new(); for mut item in ret.into_rust().drain(..) { local_ret.push( { item.into_native() }); };
+ 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) = item.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_native() }); }; let mut local_ret_0 = (*unsafe { Box::from_raw(orig_ret_0_0.take_inner()) }, local_orig_ret_0_1); local_ret_0 }); };
local_ret
}
}
pub(crate) type nativeCounterpartyCommitmentSecrets = nativeCounterpartyCommitmentSecretsImport;
/// Implements the per-commitment secret storage scheme from
-/// [BOLT 3](https://github.com/lightningnetwork/lightning-rfc/blob/dcbf8583976df087c79c3ce0b535311212e6812d/03-transactions.md#efficient-per-commitment-secret-storage).
+/// [BOLT 3](https://github.com/lightning/bolts/blob/dcbf8583976df087c79c3ce0b535311212e6812d/03-transactions.md#efficient-per-commitment-secret-storage).
///
/// Allows us to keep track of all of the revocation secrets of our counterparty in just 50*32 bytes
/// or so.
/// generated (ie our own).
#[no_mangle]
pub extern "C" fn derive_private_key(mut per_commitment_point: crate::c_types::PublicKey, base_secret: *const [u8; 32]) -> crate::c_types::derived::CResult_SecretKeyErrorZ {
- let mut ret = lightning::ln::chan_utils::derive_private_key(secp256k1::SECP256K1, &per_commitment_point.into_rust(), &::bitcoin::secp256k1::key::SecretKey::from_slice(&unsafe { *base_secret}[..]).unwrap());
+ let mut ret = lightning::ln::chan_utils::derive_private_key(secp256k1::global::SECP256K1, &per_commitment_point.into_rust(), &::bitcoin::secp256k1::SecretKey::from_slice(&unsafe { *base_secret}[..]).unwrap());
let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::SecretKey::from_rust(o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::c_types::Secp256k1Error::from_rust(e) }).into() };
local_ret
}
/// generated (ie our own).
#[no_mangle]
pub extern "C" fn derive_public_key(mut per_commitment_point: crate::c_types::PublicKey, mut base_point: crate::c_types::PublicKey) -> crate::c_types::derived::CResult_PublicKeyErrorZ {
- let mut ret = lightning::ln::chan_utils::derive_public_key(secp256k1::SECP256K1, &per_commitment_point.into_rust(), &base_point.into_rust());
+ let mut ret = lightning::ln::chan_utils::derive_public_key(secp256k1::global::SECP256K1, &per_commitment_point.into_rust(), &base_point.into_rust());
let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::PublicKey::from_rust(&o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::c_types::Secp256k1Error::from_rust(e) }).into() };
local_ret
}
/// generated (ie our own).
#[no_mangle]
pub extern "C" fn derive_private_revocation_key(per_commitment_secret: *const [u8; 32], countersignatory_revocation_base_secret: *const [u8; 32]) -> crate::c_types::derived::CResult_SecretKeyErrorZ {
- let mut ret = lightning::ln::chan_utils::derive_private_revocation_key(secp256k1::SECP256K1, &::bitcoin::secp256k1::key::SecretKey::from_slice(&unsafe { *per_commitment_secret}[..]).unwrap(), &::bitcoin::secp256k1::key::SecretKey::from_slice(&unsafe { *countersignatory_revocation_base_secret}[..]).unwrap());
+ let mut ret = lightning::ln::chan_utils::derive_private_revocation_key(secp256k1::global::SECP256K1, &::bitcoin::secp256k1::SecretKey::from_slice(&unsafe { *per_commitment_secret}[..]).unwrap(), &::bitcoin::secp256k1::SecretKey::from_slice(&unsafe { *countersignatory_revocation_base_secret}[..]).unwrap());
let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::SecretKey::from_rust(o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::c_types::Secp256k1Error::from_rust(e) }).into() };
local_ret
}
/// generated (ie our own).
#[no_mangle]
pub extern "C" fn derive_public_revocation_key(mut per_commitment_point: crate::c_types::PublicKey, mut countersignatory_revocation_base_point: crate::c_types::PublicKey) -> crate::c_types::derived::CResult_PublicKeyErrorZ {
- let mut ret = lightning::ln::chan_utils::derive_public_revocation_key(secp256k1::SECP256K1, &per_commitment_point.into_rust(), &countersignatory_revocation_base_point.into_rust());
+ let mut ret = lightning::ln::chan_utils::derive_public_revocation_key(secp256k1::global::SECP256K1, &per_commitment_point.into_rust(), &countersignatory_revocation_base_point.into_rust());
let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::PublicKey::from_rust(&o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::c_types::Secp256k1Error::from_rust(e) }).into() };
local_ret
}
#[must_use]
#[no_mangle]
pub extern "C" fn TxCreationKeys_derive_new(mut per_commitment_point: crate::c_types::PublicKey, mut broadcaster_delayed_payment_base: crate::c_types::PublicKey, mut broadcaster_htlc_base: crate::c_types::PublicKey, mut countersignatory_revocation_base: crate::c_types::PublicKey, mut countersignatory_htlc_base: crate::c_types::PublicKey) -> crate::c_types::derived::CResult_TxCreationKeysErrorZ {
- let mut ret = lightning::ln::chan_utils::TxCreationKeys::derive_new(secp256k1::SECP256K1, &per_commitment_point.into_rust(), &broadcaster_delayed_payment_base.into_rust(), &broadcaster_htlc_base.into_rust(), &countersignatory_revocation_base.into_rust(), &countersignatory_htlc_base.into_rust());
+ let mut ret = lightning::ln::chan_utils::TxCreationKeys::derive_new(secp256k1::global::SECP256K1, &per_commitment_point.into_rust(), &broadcaster_delayed_payment_base.into_rust(), &broadcaster_htlc_base.into_rust(), &countersignatory_revocation_base.into_rust(), &countersignatory_htlc_base.into_rust());
let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::chan_utils::TxCreationKeys { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::c_types::Secp256k1Error::from_rust(e) }).into() };
local_ret
}
#[must_use]
#[no_mangle]
pub extern "C" fn TxCreationKeys_from_channel_static_keys(mut per_commitment_point: crate::c_types::PublicKey, broadcaster_keys: &crate::lightning::ln::chan_utils::ChannelPublicKeys, countersignatory_keys: &crate::lightning::ln::chan_utils::ChannelPublicKeys) -> crate::c_types::derived::CResult_TxCreationKeysErrorZ {
- let mut ret = lightning::ln::chan_utils::TxCreationKeys::from_channel_static_keys(&per_commitment_point.into_rust(), broadcaster_keys.get_native_ref(), countersignatory_keys.get_native_ref(), secp256k1::SECP256K1);
+ let mut ret = lightning::ln::chan_utils::TxCreationKeys::from_channel_static_keys(&per_commitment_point.into_rust(), broadcaster_keys.get_native_ref(), countersignatory_keys.get_native_ref(), secp256k1::global::SECP256K1);
let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::chan_utils::TxCreationKeys { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::c_types::Secp256k1Error::from_rust(e) }).into() };
local_ret
}
#[must_use]
#[no_mangle]
pub extern "C" fn BuiltCommitmentTransaction_sign(this_arg: &crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, funding_key: *const [u8; 32], mut funding_redeemscript: crate::c_types::u8slice, mut channel_value_satoshis: u64) -> crate::c_types::Signature {
- let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.sign(&::bitcoin::secp256k1::key::SecretKey::from_slice(&unsafe { *funding_key}[..]).unwrap(), &::bitcoin::blockdata::script::Script::from(Vec::from(funding_redeemscript.to_slice())), channel_value_satoshis, secp256k1::SECP256K1);
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.sign(&::bitcoin::secp256k1::SecretKey::from_slice(&unsafe { *funding_key}[..]).unwrap(), &::bitcoin::blockdata::script::Script::from(Vec::from(funding_redeemscript.to_slice())), channel_value_satoshis, secp256k1::global::SECP256K1);
crate::c_types::Signature::from_rust(&ret)
}
#[must_use]
#[no_mangle]
pub extern "C" fn TrustedClosingTransaction_sign(this_arg: &crate::lightning::ln::chan_utils::TrustedClosingTransaction, funding_key: *const [u8; 32], mut funding_redeemscript: crate::c_types::u8slice, mut channel_value_satoshis: u64) -> crate::c_types::Signature {
- let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.sign(&::bitcoin::secp256k1::key::SecretKey::from_slice(&unsafe { *funding_key}[..]).unwrap(), &::bitcoin::blockdata::script::Script::from(Vec::from(funding_redeemscript.to_slice())), channel_value_satoshis, secp256k1::SECP256K1);
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.sign(&::bitcoin::secp256k1::SecretKey::from_slice(&unsafe { *funding_key}[..]).unwrap(), &::bitcoin::blockdata::script::Script::from(Vec::from(funding_redeemscript.to_slice())), channel_value_satoshis, secp256k1::global::SECP256K1);
crate::c_types::Signature::from_rust(&ret)
}
#[must_use]
#[no_mangle]
pub extern "C" fn CommitmentTransaction_verify(this_arg: &crate::lightning::ln::chan_utils::CommitmentTransaction, channel_parameters: &crate::lightning::ln::chan_utils::DirectedChannelTransactionParameters, broadcaster_keys: &crate::lightning::ln::chan_utils::ChannelPublicKeys, countersignatory_keys: &crate::lightning::ln::chan_utils::ChannelPublicKeys) -> crate::c_types::derived::CResult_TrustedCommitmentTransactionNoneZ {
- let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.verify(channel_parameters.get_native_ref(), broadcaster_keys.get_native_ref(), countersignatory_keys.get_native_ref(), secp256k1::SECP256K1);
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.verify(channel_parameters.get_native_ref(), broadcaster_keys.get_native_ref(), countersignatory_keys.get_native_ref(), secp256k1::global::SECP256K1);
let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::chan_utils::TrustedCommitmentTransaction { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() };
local_ret
}
///
/// The returned Vec has one entry for each HTLC, and in the same order.
///
-/// This function is only valid in the holder commitment context, it always uses SigHashType::All.
+/// This function is only valid in the holder commitment context, it always uses EcdsaSighashType::All.
#[must_use]
#[no_mangle]
pub extern "C" fn TrustedCommitmentTransaction_get_htlc_sigs(this_arg: &crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, htlc_base_key: *const [u8; 32], channel_parameters: &crate::lightning::ln::chan_utils::DirectedChannelTransactionParameters) -> crate::c_types::derived::CResult_CVec_SignatureZNoneZ {
- let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_htlc_sigs(&::bitcoin::secp256k1::key::SecretKey::from_slice(&unsafe { *htlc_base_key}[..]).unwrap(), channel_parameters.get_native_ref(), secp256k1::SECP256K1);
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_htlc_sigs(&::bitcoin::secp256k1::SecretKey::from_slice(&unsafe { *htlc_base_key}[..]).unwrap(), channel_parameters.get_native_ref(), secp256k1::global::SECP256K1);
let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { let mut local_ret_0 = Vec::new(); for mut item in o.drain(..) { local_ret_0.push( { crate::c_types::Signature::from_rust(&item) }); }; local_ret_0.into() }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() };
local_ret
}
//! responsible for tracking which channels are open, HTLCs are in flight and reestablishing those
//! upon reconnect to the relevant peer(s).
//!
-//! It does not manage routing logic (see routing::router::get_route for that) nor does it manage constructing
+//! It does not manage routing logic (see [`find_route`] for that) nor does it manage constructing
//! on-chain transactions (it only monitors the chain to watch for any force-closes that might
//! imply it needs to fail HTLCs/payments/channels it manages).
//!
+//! [`find_route`]: crate::routing::router::find_route
use alloc::str::FromStr;
use core::ffi::c_void;
#[cfg(feature="no-std")]
use alloc::{vec::Vec, boxed::Box};
-mod inbound_payment {
-
-use alloc::str::FromStr;
-use core::ffi::c_void;
-use core::convert::Infallible;
-use bitcoin::hashes::Hash;
-use crate::c_types::*;
-#[cfg(feature="no-std")]
-use alloc::{vec::Vec, boxed::Box};
-
-}
use lightning::ln::channelmanager::ChannelManager as nativeChannelManagerImport;
pub(crate) type nativeChannelManager = nativeChannelManagerImport<crate::lightning::chain::keysinterface::Sign, crate::lightning::chain::Watch, crate::lightning::chain::chaininterface::BroadcasterInterface, crate::lightning::chain::keysinterface::KeysInterface, crate::lightning::chain::chaininterface::FeeEstimator, crate::lightning::util::logger::Logger>;
let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_inner()) } }) };
unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.forwarding_info = local_val;
}
+/// The smallest value HTLC (in msat) the remote peer will accept, for this channel. This field
+/// is only `None` before we have received either the `OpenChannel` or `AcceptChannel` message
+/// from the remote peer, or for `ChannelCounterparty` objects serialized prior to LDK 0.0.107.
+#[no_mangle]
+pub extern "C" fn ChannelCounterparty_get_outbound_htlc_minimum_msat(this_ptr: &ChannelCounterparty) -> crate::c_types::derived::COption_u64Z {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().outbound_htlc_minimum_msat;
+ let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { inner_val.unwrap() }) };
+ local_inner_val
+}
+/// The smallest value HTLC (in msat) the remote peer will accept, for this channel. This field
+/// is only `None` before we have received either the `OpenChannel` or `AcceptChannel` message
+/// from the remote peer, or for `ChannelCounterparty` objects serialized prior to LDK 0.0.107.
+#[no_mangle]
+pub extern "C" fn ChannelCounterparty_set_outbound_htlc_minimum_msat(this_ptr: &mut ChannelCounterparty, mut val: crate::c_types::derived::COption_u64Z) {
+ let mut local_val = if val.is_some() { Some( { val.take() }) } else { None };
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.outbound_htlc_minimum_msat = local_val;
+}
+/// The largest value HTLC (in msat) the remote peer currently will accept, for this channel.
+#[no_mangle]
+pub extern "C" fn ChannelCounterparty_get_outbound_htlc_maximum_msat(this_ptr: &ChannelCounterparty) -> crate::c_types::derived::COption_u64Z {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().outbound_htlc_maximum_msat;
+ let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { inner_val.unwrap() }) };
+ local_inner_val
+}
+/// The largest value HTLC (in msat) the remote peer currently will accept, for this channel.
+#[no_mangle]
+pub extern "C" fn ChannelCounterparty_set_outbound_htlc_maximum_msat(this_ptr: &mut ChannelCounterparty, mut val: crate::c_types::derived::COption_u64Z) {
+ let mut local_val = if val.is_some() { Some( { val.take() }) } else { None };
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.outbound_htlc_maximum_msat = local_val;
+}
/// Constructs a new ChannelCounterparty given each field
#[must_use]
#[no_mangle]
-pub extern "C" fn ChannelCounterparty_new(mut node_id_arg: crate::c_types::PublicKey, mut features_arg: crate::lightning::ln::features::InitFeatures, mut unspendable_punishment_reserve_arg: u64, mut forwarding_info_arg: crate::lightning::ln::channelmanager::CounterpartyForwardingInfo) -> ChannelCounterparty {
+pub extern "C" fn ChannelCounterparty_new(mut node_id_arg: crate::c_types::PublicKey, mut features_arg: crate::lightning::ln::features::InitFeatures, mut unspendable_punishment_reserve_arg: u64, mut forwarding_info_arg: crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, mut outbound_htlc_minimum_msat_arg: crate::c_types::derived::COption_u64Z, mut outbound_htlc_maximum_msat_arg: crate::c_types::derived::COption_u64Z) -> ChannelCounterparty {
let mut local_forwarding_info_arg = if forwarding_info_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(forwarding_info_arg.take_inner()) } }) };
+ let mut local_outbound_htlc_minimum_msat_arg = if outbound_htlc_minimum_msat_arg.is_some() { Some( { outbound_htlc_minimum_msat_arg.take() }) } else { None };
+ let mut local_outbound_htlc_maximum_msat_arg = if outbound_htlc_maximum_msat_arg.is_some() { Some( { outbound_htlc_maximum_msat_arg.take() }) } else { None };
ChannelCounterparty { inner: ObjOps::heap_alloc(nativeChannelCounterparty {
node_id: node_id_arg.into_rust(),
features: *unsafe { Box::from_raw(features_arg.take_inner()) },
unspendable_punishment_reserve: unspendable_punishment_reserve_arg,
forwarding_info: local_forwarding_info_arg,
+ outbound_htlc_minimum_msat: local_outbound_htlc_minimum_msat_arg,
+ outbound_htlc_maximum_msat: local_outbound_htlc_maximum_msat_arg,
}), is_owned: true }
}
impl Clone for ChannelCounterparty {
/// Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound
/// payments instead of this. See [`get_inbound_payment_scid`].
///
+/// For channels with [`confirmations_required`] set to `Some(0)`, [`outbound_scid_alias`] may
+/// be used in place of this in outbound routes. See [`get_outbound_payment_scid`].
+///
/// [`inbound_scid_alias`]: Self::inbound_scid_alias
+/// [`outbound_scid_alias`]: Self::outbound_scid_alias
/// [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid
+/// [`get_outbound_payment_scid`]: Self::get_outbound_payment_scid
+/// [`confirmations_required`]: Self::confirmations_required
#[no_mangle]
pub extern "C" fn ChannelDetails_get_short_channel_id(this_ptr: &ChannelDetails) -> crate::c_types::derived::COption_u64Z {
let mut inner_val = &mut this_ptr.get_native_mut_ref().short_channel_id;
/// Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound
/// payments instead of this. See [`get_inbound_payment_scid`].
///
+/// For channels with [`confirmations_required`] set to `Some(0)`, [`outbound_scid_alias`] may
+/// be used in place of this in outbound routes. See [`get_outbound_payment_scid`].
+///
/// [`inbound_scid_alias`]: Self::inbound_scid_alias
+/// [`outbound_scid_alias`]: Self::outbound_scid_alias
/// [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid
+/// [`get_outbound_payment_scid`]: Self::get_outbound_payment_scid
+/// [`confirmations_required`]: Self::confirmations_required
#[no_mangle]
pub extern "C" fn ChannelDetails_set_short_channel_id(this_ptr: &mut ChannelDetails, mut val: crate::c_types::derived::COption_u64Z) {
let mut local_val = if val.is_some() { Some( { val.take() }) } else { None };
unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.short_channel_id = local_val;
}
+/// An optional [`short_channel_id`] alias for this channel, randomly generated by us and
+/// usable in place of [`short_channel_id`] to reference the channel in outbound routes when
+/// the channel has not yet been confirmed (as long as [`confirmations_required`] is
+/// `Some(0)`).
+///
+/// This will be `None` as long as the channel is not available for routing outbound payments.
+///
+/// [`short_channel_id`]: Self::short_channel_id
+/// [`confirmations_required`]: Self::confirmations_required
+#[no_mangle]
+pub extern "C" fn ChannelDetails_get_outbound_scid_alias(this_ptr: &ChannelDetails) -> crate::c_types::derived::COption_u64Z {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().outbound_scid_alias;
+ let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { inner_val.unwrap() }) };
+ local_inner_val
+}
+/// An optional [`short_channel_id`] alias for this channel, randomly generated by us and
+/// usable in place of [`short_channel_id`] to reference the channel in outbound routes when
+/// the channel has not yet been confirmed (as long as [`confirmations_required`] is
+/// `Some(0)`).
+///
+/// This will be `None` as long as the channel is not available for routing outbound payments.
+///
+/// [`short_channel_id`]: Self::short_channel_id
+/// [`confirmations_required`]: Self::confirmations_required
+#[no_mangle]
+pub extern "C" fn ChannelDetails_set_outbound_scid_alias(this_ptr: &mut ChannelDetails, mut val: crate::c_types::derived::COption_u64Z) {
+ let mut local_val = if val.is_some() { Some( { val.take() }) } else { None };
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.outbound_scid_alias = local_val;
+}
/// An optional [`short_channel_id`] alias for this channel, randomly generated by our
/// counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our
/// counterparty will recognize the alias provided here in place of the [`short_channel_id`]
pub extern "C" fn ChannelDetails_set_outbound_capacity_msat(this_ptr: &mut ChannelDetails, mut val: u64) {
unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.outbound_capacity_msat = val;
}
+/// The available outbound capacity for sending a single HTLC to the remote peer. This is
+/// similar to [`ChannelDetails::outbound_capacity_msat`] but it may be further restricted by
+/// the current state and per-HTLC limit(s). This is intended for use when routing, allowing us
+/// to use a limit as close as possible to the HTLC limit we can currently send.
+///
+/// See also [`ChannelDetails::balance_msat`] and [`ChannelDetails::outbound_capacity_msat`].
+#[no_mangle]
+pub extern "C" fn ChannelDetails_get_next_outbound_htlc_limit_msat(this_ptr: &ChannelDetails) -> u64 {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().next_outbound_htlc_limit_msat;
+ *inner_val
+}
+/// The available outbound capacity for sending a single HTLC to the remote peer. This is
+/// similar to [`ChannelDetails::outbound_capacity_msat`] but it may be further restricted by
+/// the current state and per-HTLC limit(s). This is intended for use when routing, allowing us
+/// to use a limit as close as possible to the HTLC limit we can currently send.
+///
+/// See also [`ChannelDetails::balance_msat`] and [`ChannelDetails::outbound_capacity_msat`].
+#[no_mangle]
+pub extern "C" fn ChannelDetails_set_next_outbound_htlc_limit_msat(this_ptr: &mut ChannelDetails, mut val: u64) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.next_outbound_htlc_limit_msat = val;
+}
/// The available inbound capacity for the remote peer to send HTLCs to us. This does not
/// include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
/// available for inclusion in new inbound HTLCs).
pub extern "C" fn ChannelDetails_set_is_outbound(this_ptr: &mut ChannelDetails, mut val: bool) {
unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.is_outbound = val;
}
-/// True if the channel is confirmed, funding_locked messages have been exchanged, and the
-/// channel is not currently being shut down. `funding_locked` message exchange implies the
+/// True if the channel is confirmed, channel_ready messages have been exchanged, and the
+/// channel is not currently being shut down. `channel_ready` message exchange implies the
/// required confirmation count has been reached (and we were connected to the peer at some
/// point after the funding transaction received enough confirmations). The required
/// confirmation count is provided in [`confirmations_required`].
///
/// [`confirmations_required`]: ChannelDetails::confirmations_required
#[no_mangle]
-pub extern "C" fn ChannelDetails_get_is_funding_locked(this_ptr: &ChannelDetails) -> bool {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().is_funding_locked;
+pub extern "C" fn ChannelDetails_get_is_channel_ready(this_ptr: &ChannelDetails) -> bool {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().is_channel_ready;
*inner_val
}
-/// True if the channel is confirmed, funding_locked messages have been exchanged, and the
-/// channel is not currently being shut down. `funding_locked` message exchange implies the
+/// True if the channel is confirmed, channel_ready messages have been exchanged, and the
+/// channel is not currently being shut down. `channel_ready` message exchange implies the
/// required confirmation count has been reached (and we were connected to the peer at some
/// point after the funding transaction received enough confirmations). The required
/// confirmation count is provided in [`confirmations_required`].
///
/// [`confirmations_required`]: ChannelDetails::confirmations_required
#[no_mangle]
-pub extern "C" fn ChannelDetails_set_is_funding_locked(this_ptr: &mut ChannelDetails, mut val: bool) {
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.is_funding_locked = val;
+pub extern "C" fn ChannelDetails_set_is_channel_ready(this_ptr: &mut ChannelDetails, mut val: bool) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.is_channel_ready = val;
}
-/// True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
+/// True if the channel is (a) confirmed and channel_ready messages have been exchanged, (b)
/// the peer is connected, and (c) the channel is not currently negotiating a shutdown.
///
-/// This is a strict superset of `is_funding_locked`.
+/// This is a strict superset of `is_channel_ready`.
#[no_mangle]
pub extern "C" fn ChannelDetails_get_is_usable(this_ptr: &ChannelDetails) -> bool {
let mut inner_val = &mut this_ptr.get_native_mut_ref().is_usable;
*inner_val
}
-/// True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
+/// True if the channel is (a) confirmed and channel_ready messages have been exchanged, (b)
/// the peer is connected, and (c) the channel is not currently negotiating a shutdown.
///
-/// This is a strict superset of `is_funding_locked`.
+/// This is a strict superset of `is_channel_ready`.
#[no_mangle]
pub extern "C" fn ChannelDetails_set_is_usable(this_ptr: &mut ChannelDetails, mut val: bool) {
unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.is_usable = val;
pub extern "C" fn ChannelDetails_set_is_public(this_ptr: &mut ChannelDetails, mut val: bool) {
unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.is_public = val;
}
+/// The smallest value HTLC (in msat) we will accept, for this channel. This field
+/// is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.107
+#[no_mangle]
+pub extern "C" fn ChannelDetails_get_inbound_htlc_minimum_msat(this_ptr: &ChannelDetails) -> crate::c_types::derived::COption_u64Z {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().inbound_htlc_minimum_msat;
+ let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { inner_val.unwrap() }) };
+ local_inner_val
+}
+/// The smallest value HTLC (in msat) we will accept, for this channel. This field
+/// is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.107
+#[no_mangle]
+pub extern "C" fn ChannelDetails_set_inbound_htlc_minimum_msat(this_ptr: &mut ChannelDetails, mut val: crate::c_types::derived::COption_u64Z) {
+ let mut local_val = if val.is_some() { Some( { val.take() }) } else { None };
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.inbound_htlc_minimum_msat = local_val;
+}
+/// The largest value HTLC (in msat) we currently will accept, for this channel.
+#[no_mangle]
+pub extern "C" fn ChannelDetails_get_inbound_htlc_maximum_msat(this_ptr: &ChannelDetails) -> crate::c_types::derived::COption_u64Z {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().inbound_htlc_maximum_msat;
+ let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { inner_val.unwrap() }) };
+ local_inner_val
+}
+/// The largest value HTLC (in msat) we currently will accept, for this channel.
+#[no_mangle]
+pub extern "C" fn ChannelDetails_set_inbound_htlc_maximum_msat(this_ptr: &mut ChannelDetails, mut val: crate::c_types::derived::COption_u64Z) {
+ let mut local_val = if val.is_some() { Some( { val.take() }) } else { None };
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.inbound_htlc_maximum_msat = local_val;
+}
/// Constructs a new ChannelDetails given each field
#[must_use]
#[no_mangle]
-pub extern "C" fn ChannelDetails_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut counterparty_arg: crate::lightning::ln::channelmanager::ChannelCounterparty, mut funding_txo_arg: crate::lightning::chain::transaction::OutPoint, mut channel_type_arg: crate::lightning::ln::features::ChannelTypeFeatures, mut short_channel_id_arg: crate::c_types::derived::COption_u64Z, mut inbound_scid_alias_arg: crate::c_types::derived::COption_u64Z, mut channel_value_satoshis_arg: u64, mut unspendable_punishment_reserve_arg: crate::c_types::derived::COption_u64Z, mut user_channel_id_arg: u64, mut balance_msat_arg: u64, mut outbound_capacity_msat_arg: u64, mut inbound_capacity_msat_arg: u64, mut confirmations_required_arg: crate::c_types::derived::COption_u32Z, mut force_close_spend_delay_arg: crate::c_types::derived::COption_u16Z, mut is_outbound_arg: bool, mut is_funding_locked_arg: bool, mut is_usable_arg: bool, mut is_public_arg: bool) -> ChannelDetails {
+pub extern "C" fn ChannelDetails_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut counterparty_arg: crate::lightning::ln::channelmanager::ChannelCounterparty, mut funding_txo_arg: crate::lightning::chain::transaction::OutPoint, mut channel_type_arg: crate::lightning::ln::features::ChannelTypeFeatures, mut short_channel_id_arg: crate::c_types::derived::COption_u64Z, mut outbound_scid_alias_arg: crate::c_types::derived::COption_u64Z, mut inbound_scid_alias_arg: crate::c_types::derived::COption_u64Z, mut channel_value_satoshis_arg: u64, mut unspendable_punishment_reserve_arg: crate::c_types::derived::COption_u64Z, mut user_channel_id_arg: u64, mut balance_msat_arg: u64, mut outbound_capacity_msat_arg: u64, mut next_outbound_htlc_limit_msat_arg: u64, mut inbound_capacity_msat_arg: u64, mut confirmations_required_arg: crate::c_types::derived::COption_u32Z, mut force_close_spend_delay_arg: crate::c_types::derived::COption_u16Z, mut is_outbound_arg: bool, mut is_channel_ready_arg: bool, mut is_usable_arg: bool, mut is_public_arg: bool, mut inbound_htlc_minimum_msat_arg: crate::c_types::derived::COption_u64Z, mut inbound_htlc_maximum_msat_arg: crate::c_types::derived::COption_u64Z) -> ChannelDetails {
let mut local_funding_txo_arg = if funding_txo_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(funding_txo_arg.take_inner()) } }) };
let mut local_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_short_channel_id_arg = if short_channel_id_arg.is_some() { Some( { short_channel_id_arg.take() }) } else { None };
+ let mut local_outbound_scid_alias_arg = if outbound_scid_alias_arg.is_some() { Some( { outbound_scid_alias_arg.take() }) } else { None };
let mut local_inbound_scid_alias_arg = if inbound_scid_alias_arg.is_some() { Some( { inbound_scid_alias_arg.take() }) } else { None };
let mut local_unspendable_punishment_reserve_arg = if unspendable_punishment_reserve_arg.is_some() { Some( { unspendable_punishment_reserve_arg.take() }) } else { None };
let mut local_confirmations_required_arg = if confirmations_required_arg.is_some() { Some( { confirmations_required_arg.take() }) } else { None };
let mut local_force_close_spend_delay_arg = if force_close_spend_delay_arg.is_some() { Some( { force_close_spend_delay_arg.take() }) } else { None };
+ let mut local_inbound_htlc_minimum_msat_arg = if inbound_htlc_minimum_msat_arg.is_some() { Some( { inbound_htlc_minimum_msat_arg.take() }) } else { None };
+ let mut local_inbound_htlc_maximum_msat_arg = if inbound_htlc_maximum_msat_arg.is_some() { Some( { inbound_htlc_maximum_msat_arg.take() }) } else { None };
ChannelDetails { inner: ObjOps::heap_alloc(nativeChannelDetails {
channel_id: channel_id_arg.data,
counterparty: *unsafe { Box::from_raw(counterparty_arg.take_inner()) },
funding_txo: local_funding_txo_arg,
channel_type: local_channel_type_arg,
short_channel_id: local_short_channel_id_arg,
+ outbound_scid_alias: local_outbound_scid_alias_arg,
inbound_scid_alias: local_inbound_scid_alias_arg,
channel_value_satoshis: channel_value_satoshis_arg,
unspendable_punishment_reserve: local_unspendable_punishment_reserve_arg,
user_channel_id: user_channel_id_arg,
balance_msat: balance_msat_arg,
outbound_capacity_msat: outbound_capacity_msat_arg,
+ next_outbound_htlc_limit_msat: next_outbound_htlc_limit_msat_arg,
inbound_capacity_msat: inbound_capacity_msat_arg,
confirmations_required: local_confirmations_required_arg,
force_close_spend_delay: local_force_close_spend_delay_arg,
is_outbound: is_outbound_arg,
- is_funding_locked: is_funding_locked_arg,
+ is_channel_ready: is_channel_ready_arg,
is_usable: is_usable_arg,
is_public: is_public_arg,
+ inbound_htlc_minimum_msat: local_inbound_htlc_minimum_msat_arg,
+ inbound_htlc_maximum_msat: local_inbound_htlc_maximum_msat_arg,
}), is_owned: true }
}
impl Clone for ChannelDetails {
local_ret
}
+/// Gets the current SCID which should be used to identify this channel for outbound payments.
+/// This should be used in [`Route`]s to describe the first hop or in other contexts where
+/// we're sending or forwarding a payment outbound over this channel.
+///
+/// This is either the [`ChannelDetails::short_channel_id`], if set, or the
+/// [`ChannelDetails::outbound_scid_alias`]. See those for more information.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn ChannelDetails_get_outbound_payment_scid(this_arg: &crate::lightning::ln::channelmanager::ChannelDetails) -> crate::c_types::derived::COption_u64Z {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_outbound_payment_scid();
+ let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { ret.unwrap() }) };
+ local_ret
+}
+
/// If a payment fails to send, it can be in one of several states. This enum is returned as the
/// Err() type describing which state the payment is in, see the description of individual enum
/// states for more.
-#[must_use]
#[derive(Clone)]
+#[must_use]
#[repr(C)]
pub enum PaymentSendFailure {
/// A parameter which was passed to send_payment was invalid, preventing us from attempting to
/// send the payment at all. No channel state has been changed or messages sent to peers, and
/// once you've changed the parameter at error, you can freely retry the payment in full.
- ParameterError(crate::lightning::util::errors::APIError),
+ ParameterError(
+ crate::lightning::util::errors::APIError),
/// A parameter in a single path which was passed to send_payment was invalid, preventing us
/// from attempting to send the payment at all. No channel state has been changed or messages
/// sent to peers, and once you've changed the parameter at error, you can freely retry the
///
/// The results here are ordered the same as the paths in the route object which was passed to
/// send_payment.
- PathParameterError(crate::c_types::derived::CVec_CResult_NoneAPIErrorZZ),
+ PathParameterError(
+ crate::c_types::derived::CVec_CResult_NoneAPIErrorZZ),
/// All paths which were attempted failed to send, with no channel state change taking place.
/// You can freely retry the payment in full (though you probably want to do so over different
/// paths than the ones selected).
- AllFailedRetrySafe(crate::c_types::derived::CVec_APIErrorZ),
+ AllFailedRetrySafe(
+ crate::c_types::derived::CVec_APIErrorZ),
/// Some paths which were attempted failed to send, though possibly not all. At least some
/// paths have irrevocably committed to the HTLC and retrying the payment in full would result
/// in over-/re-payment.
payment_id: crate::c_types::ThirtyTwoBytes,
},
}
-use lightning::ln::channelmanager::PaymentSendFailure as nativePaymentSendFailure;
+use lightning::ln::channelmanager::PaymentSendFailure as PaymentSendFailureImport;
+pub(crate) type nativePaymentSendFailure = PaymentSendFailureImport;
+
impl PaymentSendFailure {
#[allow(unused)]
pub(crate) fn to_native(&self) -> nativePaymentSendFailure {
///
/// Non-proportional fees are fixed according to our risk using the provided fee estimator.
///
-/// panics if channel_value_satoshis is >= `MAX_FUNDING_SATOSHIS`!
-///
/// Users need to notify the new ChannelManager when a new block is connected or
/// disconnected using its `block_connected` and `block_disconnected` methods, starting
/// from after `params.latest_hash`.
local_ret.into()
}
-/// Gets the list of usable channels, in random order. Useful as an argument to
-/// get_route to ensure non-announced channels are used.
+/// Gets the list of usable channels, in random order. Useful as an argument to [`find_route`]
+/// to ensure non-announced channels are used.
///
/// These are guaranteed to have their [`ChannelDetails::is_usable`] value set to true, see the
/// documentation for [`ChannelDetails::is_usable`] for more info on exactly what the criteria
/// are.
+///
+/// [`find_route`]: crate::routing::router::find_route
#[must_use]
#[no_mangle]
pub extern "C" fn ChannelManager_list_usable_channels(this_arg: &crate::lightning::ln::channelmanager::ChannelManager) -> crate::c_types::derived::CVec_ChannelDetailsZ {
/// [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
#[must_use]
#[no_mangle]
-pub extern "C" fn ChannelManager_close_channel(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, channel_id: *const [u8; 32]) -> crate::c_types::derived::CResult_NoneAPIErrorZ {
- let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.close_channel(unsafe { &*channel_id});
+pub extern "C" fn ChannelManager_close_channel(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, channel_id: *const [u8; 32], mut counterparty_node_id: crate::c_types::PublicKey) -> crate::c_types::derived::CResult_NoneAPIErrorZ {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.close_channel(unsafe { &*channel_id}, &counterparty_node_id.into_rust());
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::util::errors::APIError::native_into(e) }).into() };
local_ret
}
/// [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
#[must_use]
#[no_mangle]
-pub extern "C" fn ChannelManager_close_channel_with_target_feerate(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, channel_id: *const [u8; 32], mut target_feerate_sats_per_1000_weight: u32) -> crate::c_types::derived::CResult_NoneAPIErrorZ {
- let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.close_channel_with_target_feerate(unsafe { &*channel_id}, target_feerate_sats_per_1000_weight);
+pub extern "C" fn ChannelManager_close_channel_with_target_feerate(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, channel_id: *const [u8; 32], mut counterparty_node_id: crate::c_types::PublicKey, mut target_feerate_sats_per_1000_weight: u32) -> crate::c_types::derived::CResult_NoneAPIErrorZ {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.close_channel_with_target_feerate(unsafe { &*channel_id}, &counterparty_node_id.into_rust(), target_feerate_sats_per_1000_weight);
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::util::errors::APIError::native_into(e) }).into() };
local_ret
}
/// Force closes a channel, immediately broadcasting the latest local commitment transaction to
-/// the chain and rejecting new HTLCs on the given channel. Fails if channel_id is unknown to the manager.
+/// the chain and rejecting new HTLCs on the given channel. Fails if `channel_id` is unknown to
+/// the manager, or if the `counterparty_node_id` isn't the counterparty of the corresponding
+/// channel.
#[must_use]
#[no_mangle]
-pub extern "C" fn ChannelManager_force_close_channel(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, channel_id: *const [u8; 32]) -> crate::c_types::derived::CResult_NoneAPIErrorZ {
- let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.force_close_channel(unsafe { &*channel_id});
+pub extern "C" fn ChannelManager_force_close_channel(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, channel_id: *const [u8; 32], mut counterparty_node_id: crate::c_types::PublicKey) -> crate::c_types::derived::CResult_NoneAPIErrorZ {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.force_close_channel(unsafe { &*channel_id}, &counterparty_node_id.into_rust());
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::util::errors::APIError::native_into(e) }).into() };
local_ret
}
/// [`Event::ChannelClosed`]: crate::util::events::Event::ChannelClosed
#[must_use]
#[no_mangle]
-pub extern "C" fn ChannelManager_funding_transaction_generated(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, temporary_channel_id: *const [u8; 32], mut funding_transaction: crate::c_types::Transaction) -> crate::c_types::derived::CResult_NoneAPIErrorZ {
- let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.funding_transaction_generated(unsafe { &*temporary_channel_id}, funding_transaction.into_bitcoin());
+pub extern "C" fn ChannelManager_funding_transaction_generated(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, temporary_channel_id: *const [u8; 32], mut counterparty_node_id: crate::c_types::PublicKey, mut funding_transaction: crate::c_types::Transaction) -> crate::c_types::derived::CResult_NoneAPIErrorZ {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.funding_transaction_generated(unsafe { &*temporary_channel_id}, &counterparty_node_id.into_rust(), funding_transaction.into_bitcoin());
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::util::errors::APIError::native_into(e) }).into() };
local_ret
}
/// Indicates that the preimage for payment_hash is unknown or the received amount is incorrect
/// after a PaymentReceived event, failing the HTLC back to its origin and freeing resources
/// along the path (including in our own channel on which we received it).
-/// Returns false if no payment was found to fail backwards, true if the process of failing the
-/// HTLC backwards has been started.
-#[must_use]
+///
+/// Note that in some cases around unclean shutdown, it is possible the payment may have
+/// already been claimed by you via [`ChannelManager::claim_funds`] prior to you seeing (a
+/// second copy of) the [`events::Event::PaymentReceived`] event. Alternatively, the payment
+/// may have already been failed automatically by LDK if it was nearing its expiration time.
+///
+/// While LDK will never claim a payment automatically on your behalf (i.e. without you calling
+/// [`ChannelManager::claim_funds`]), you should still monitor for
+/// [`events::Event::PaymentClaimed`] events even for payments you intend to fail, especially on
+/// startup during which time claims that were in-progress at shutdown may be replayed.
#[no_mangle]
-pub extern "C" fn ChannelManager_fail_htlc_backwards(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, payment_hash: *const [u8; 32]) -> bool {
- let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.fail_htlc_backwards(&::lightning::ln::PaymentHash(unsafe { *payment_hash }));
- ret
+pub extern "C" fn ChannelManager_fail_htlc_backwards(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, payment_hash: *const [u8; 32]) {
+ unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.fail_htlc_backwards(&::lightning::ln::PaymentHash(unsafe { *payment_hash }))
}
/// Provides a payment preimage in response to [`Event::PaymentReceived`], generating any
/// [`MessageSendEvent`]s needed to claim the payment.
///
+/// Note that calling this method does *not* guarantee that the payment has been claimed. You
+/// *must* wait for an [`Event::PaymentClaimed`] event which upon a successful claim will be
+/// provided to your [`EventHandler`] when [`process_pending_events`] is next called.
+///
/// Note that if you did not set an `amount_msat` when calling [`create_inbound_payment`] or
/// [`create_inbound_payment_for_hash`] you must check that the amount in the `PaymentReceived`
/// event matches your expectation. If you fail to do so and call this method, you may provide
/// the sender \"proof-of-payment\" when they did not fulfill the full expected payment.
///
-/// Returns whether any HTLCs were claimed, and thus if any new [`MessageSendEvent`]s are now
-/// pending for processing via [`get_and_clear_pending_msg_events`].
-///
/// [`Event::PaymentReceived`]: crate::util::events::Event::PaymentReceived
+/// [`Event::PaymentClaimed`]: crate::util::events::Event::PaymentClaimed
+/// [`process_pending_events`]: EventsProvider::process_pending_events
/// [`create_inbound_payment`]: Self::create_inbound_payment
/// [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
/// [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events
-#[must_use]
#[no_mangle]
-pub extern "C" fn ChannelManager_claim_funds(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut payment_preimage: crate::c_types::ThirtyTwoBytes) -> bool {
- let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.claim_funds(::lightning::ln::PaymentPreimage(payment_preimage.data));
- ret
+pub extern "C" fn ChannelManager_claim_funds(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut payment_preimage: crate::c_types::ThirtyTwoBytes) {
+ unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.claim_funds(::lightning::ln::PaymentPreimage(payment_preimage.data))
}
/// Gets the node_id held by this ChannelManager
crate::c_types::PublicKey::from_rust(&ret)
}
-/// Called to accept a request to open a channel after [`Event::OpenChannelRequest`] has been
-/// triggered.
+/// Accepts a request to open a channel after a [`Event::OpenChannelRequest`].
///
-/// The `temporary_channel_id` parameter indicates which inbound channel should be accepted.
+/// The `temporary_channel_id` parameter indicates which inbound channel should be accepted,
+/// and the `counterparty_node_id` parameter is the id of the peer which has requested to open
+/// the channel.
///
-/// For inbound channels, the `user_channel_id` parameter will be provided back in
+/// The `user_channel_id` parameter will be provided back in
/// [`Event::ChannelClosed::user_channel_id`] to allow tracking of which events correspond
-/// with which `accept_inbound_channel` call.
+/// with which `accept_inbound_channel`/`accept_inbound_channel_from_trusted_peer_0conf` call.
+///
+/// Note that this method will return an error and reject the channel, if it requires support
+/// for zero confirmations. Instead, `accept_inbound_channel_from_trusted_peer_0conf` must be
+/// used to accept such channels.
///
/// [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest
/// [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id
#[must_use]
#[no_mangle]
-pub extern "C" fn ChannelManager_accept_inbound_channel(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, temporary_channel_id: *const [u8; 32], mut user_channel_id: u64) -> crate::c_types::derived::CResult_NoneAPIErrorZ {
- let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.accept_inbound_channel(unsafe { &*temporary_channel_id}, user_channel_id);
+pub extern "C" fn ChannelManager_accept_inbound_channel(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, temporary_channel_id: *const [u8; 32], mut counterparty_node_id: crate::c_types::PublicKey, mut user_channel_id: u64) -> crate::c_types::derived::CResult_NoneAPIErrorZ {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.accept_inbound_channel(unsafe { &*temporary_channel_id}, &counterparty_node_id.into_rust(), user_channel_id);
+ 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::util::errors::APIError::native_into(e) }).into() };
+ local_ret
+}
+
+/// Accepts a request to open a channel after a [`events::Event::OpenChannelRequest`], treating
+/// it as confirmed immediately.
+///
+/// The `user_channel_id` parameter will be provided back in
+/// [`Event::ChannelClosed::user_channel_id`] to allow tracking of which events correspond
+/// with which `accept_inbound_channel`/`accept_inbound_channel_from_trusted_peer_0conf` call.
+///
+/// Unlike [`ChannelManager::accept_inbound_channel`], this method accepts the incoming channel
+/// and (if the counterparty agrees), enables forwarding of payments immediately.
+///
+/// This fully trusts that the counterparty has honestly and correctly constructed the funding
+/// transaction and blindly assumes that it will eventually confirm.
+///
+/// If it does not confirm before we decide to close the channel, or if the funding transaction
+/// does not pay to the correct script the correct amount, *you will lose funds*.
+///
+/// [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest
+/// [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id
+#[must_use]
+#[no_mangle]
+pub extern "C" fn ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, temporary_channel_id: *const [u8; 32], mut counterparty_node_id: crate::c_types::PublicKey, mut user_channel_id: u64) -> crate::c_types::derived::CResult_NoneAPIErrorZ {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.accept_inbound_channel_from_trusted_peer_0conf(unsafe { &*temporary_channel_id}, &counterparty_node_id.into_rust(), user_channel_id);
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::util::errors::APIError::native_into(e) }).into() };
local_ret
}
crate::lightning::chain::Listen {
this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void },
free: None,
+ filtered_block_connected: ChannelManager_Listen_filtered_block_connected,
block_connected: ChannelManager_Listen_block_connected,
block_disconnected: ChannelManager_Listen_block_disconnected,
}
}
+extern "C" fn ChannelManager_Listen_filtered_block_connected(this_arg: *const c_void, header: *const [u8; 80], mut txdata: crate::c_types::derived::CVec_C2Tuple_usizeTransactionZZ, mut height: u32) {
+ let mut local_txdata = Vec::new(); for mut item in txdata.into_rust().drain(..) { local_txdata.push( { let (mut orig_txdata_0_0, mut orig_txdata_0_1) = item.to_rust(); let mut local_txdata_0 = (orig_txdata_0_0, orig_txdata_0_1.into_bitcoin()); local_txdata_0 }); };
+ <nativeChannelManager as lightning::chain::Listen<>>::filtered_block_connected(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), &local_txdata.iter().map(|(a, b)| (*a, b)).collect::<Vec<_>>()[..], height)
+}
extern "C" fn ChannelManager_Listen_block_connected(this_arg: *const c_void, mut block: crate::c_types::u8slice, mut height: u32) {
<nativeChannelManager as lightning::chain::Listen<>>::block_connected(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &::bitcoin::consensus::encode::deserialize(block.to_slice()).unwrap(), height)
}
let mut local_txdata = Vec::new(); for mut item in txdata.into_rust().drain(..) { local_txdata.push( { let (mut orig_txdata_0_0, mut orig_txdata_0_1) = item.to_rust(); let mut local_txdata_0 = (orig_txdata_0_0, orig_txdata_0_1.into_bitcoin()); local_txdata_0 }); };
<nativeChannelManager as lightning::chain::Confirm<>>::transactions_confirmed(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), &local_txdata.iter().map(|(a, b)| (*a, b)).collect::<Vec<_>>()[..], height)
}
+extern "C" fn ChannelManager_Confirm_transaction_unconfirmed(this_arg: *const c_void, txid: *const [u8; 32]) {
+ <nativeChannelManager as lightning::chain::Confirm<>>::transaction_unconfirmed(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &::bitcoin::hash_types::Txid::from_slice(&unsafe { &*txid }[..]).unwrap())
+}
extern "C" fn ChannelManager_Confirm_best_block_updated(this_arg: *const c_void, header: *const [u8; 80], mut height: u32) {
<nativeChannelManager as lightning::chain::Confirm<>>::best_block_updated(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), height)
}
let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::c_types::ThirtyTwoBytes { data: item.into_inner() } }); };
local_ret.into()
}
-extern "C" fn ChannelManager_Confirm_transaction_unconfirmed(this_arg: *const c_void, txid: *const [u8; 32]) {
- <nativeChannelManager as lightning::chain::Confirm<>>::transaction_unconfirmed(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &::bitcoin::hash_types::Txid::from_slice(&unsafe { &*txid }[..]).unwrap())
-}
/// Blocks until ChannelManager needs to be persisted or a timeout is reached. It returns a bool
/// indicating whether persistence is necessary. Only one listener on
handle_accept_channel: ChannelManager_ChannelMessageHandler_handle_accept_channel,
handle_funding_created: ChannelManager_ChannelMessageHandler_handle_funding_created,
handle_funding_signed: ChannelManager_ChannelMessageHandler_handle_funding_signed,
- handle_funding_locked: ChannelManager_ChannelMessageHandler_handle_funding_locked,
+ handle_channel_ready: ChannelManager_ChannelMessageHandler_handle_channel_ready,
handle_shutdown: ChannelManager_ChannelMessageHandler_handle_shutdown,
handle_closing_signed: ChannelManager_ChannelMessageHandler_handle_closing_signed,
handle_update_add_htlc: ChannelManager_ChannelMessageHandler_handle_update_add_htlc,
extern "C" fn ChannelManager_ChannelMessageHandler_handle_funding_signed(this_arg: *const c_void, mut counterparty_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::FundingSigned) {
<nativeChannelManager as lightning::ln::msgs::ChannelMessageHandler<>>::handle_funding_signed(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &counterparty_node_id.into_rust(), msg.get_native_ref())
}
-extern "C" fn ChannelManager_ChannelMessageHandler_handle_funding_locked(this_arg: *const c_void, mut counterparty_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::FundingLocked) {
- <nativeChannelManager as lightning::ln::msgs::ChannelMessageHandler<>>::handle_funding_locked(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &counterparty_node_id.into_rust(), msg.get_native_ref())
+extern "C" fn ChannelManager_ChannelMessageHandler_handle_channel_ready(this_arg: *const c_void, mut counterparty_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::ChannelReady) {
+ <nativeChannelManager as lightning::ln::msgs::ChannelMessageHandler<>>::handle_channel_ready(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &counterparty_node_id.into_rust(), msg.get_native_ref())
}
extern "C" fn ChannelManager_ChannelMessageHandler_handle_shutdown(this_arg: *const c_void, mut counterparty_node_id: crate::c_types::PublicKey, their_features: &crate::lightning::ln::features::InitFeatures, msg: &crate::lightning::ln::msgs::Shutdown) {
<nativeChannelManager as lightning::ln::msgs::ChannelMessageHandler<>>::handle_shutdown(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &counterparty_node_id.into_rust(), their_features.get_native_ref(), msg.get_native_ref())
extern "C" fn ChannelManager_ChannelMessageHandler_handle_announcement_signatures(this_arg: *const c_void, mut counterparty_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::AnnouncementSignatures) {
<nativeChannelManager as lightning::ln::msgs::ChannelMessageHandler<>>::handle_announcement_signatures(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &counterparty_node_id.into_rust(), msg.get_native_ref())
}
-extern "C" fn ChannelManager_ChannelMessageHandler_handle_channel_update(this_arg: *const c_void, mut counterparty_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::ChannelUpdate) {
- <nativeChannelManager as lightning::ln::msgs::ChannelMessageHandler<>>::handle_channel_update(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &counterparty_node_id.into_rust(), msg.get_native_ref())
-}
-extern "C" fn ChannelManager_ChannelMessageHandler_handle_channel_reestablish(this_arg: *const c_void, mut counterparty_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::ChannelReestablish) {
- <nativeChannelManager as lightning::ln::msgs::ChannelMessageHandler<>>::handle_channel_reestablish(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &counterparty_node_id.into_rust(), msg.get_native_ref())
-}
extern "C" fn ChannelManager_ChannelMessageHandler_peer_disconnected(this_arg: *const c_void, mut counterparty_node_id: crate::c_types::PublicKey, mut no_connection_possible: bool) {
<nativeChannelManager as lightning::ln::msgs::ChannelMessageHandler<>>::peer_disconnected(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &counterparty_node_id.into_rust(), no_connection_possible)
}
extern "C" fn ChannelManager_ChannelMessageHandler_peer_connected(this_arg: *const c_void, mut counterparty_node_id: crate::c_types::PublicKey, init_msg: &crate::lightning::ln::msgs::Init) {
<nativeChannelManager as lightning::ln::msgs::ChannelMessageHandler<>>::peer_connected(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &counterparty_node_id.into_rust(), init_msg.get_native_ref())
}
+extern "C" fn ChannelManager_ChannelMessageHandler_handle_channel_reestablish(this_arg: *const c_void, mut counterparty_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::ChannelReestablish) {
+ <nativeChannelManager as lightning::ln::msgs::ChannelMessageHandler<>>::handle_channel_reestablish(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &counterparty_node_id.into_rust(), msg.get_native_ref())
+}
+extern "C" fn ChannelManager_ChannelMessageHandler_handle_channel_update(this_arg: *const c_void, mut counterparty_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::ChannelUpdate) {
+ <nativeChannelManager as lightning::ln::msgs::ChannelMessageHandler<>>::handle_channel_update(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &counterparty_node_id.into_rust(), msg.get_native_ref())
+}
extern "C" fn ChannelManager_ChannelMessageHandler_handle_error(this_arg: *const c_void, mut counterparty_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::ErrorMessage) {
<nativeChannelManager as lightning::ln::msgs::ChannelMessageHandler<>>::handle_error(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &counterparty_node_id.into_rust(), msg.get_native_ref())
}
//! supports a feature if it advertises the feature (as either required or optional) to its peers.
//! And the implementation can interpret a feature if the feature is known to it.
//!
-//! [BOLT #9]: https://github.com/lightningnetwork/lightning-rfc/blob/master/09-features.md
+//! [BOLT #9]: https://github.com/lightning/bolts/blob/master/09-features.md
//! [messages]: crate::ln::msgs
use alloc::str::FromStr;
ret
}
+/// Set this feature as optional.
+#[no_mangle]
+pub extern "C" fn InitFeatures_set_wumbo_optional(this_arg: &mut crate::lightning::ln::features::InitFeatures) {
+ unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_wumbo_optional()
+}
+
+/// Set this feature as required.
+#[no_mangle]
+pub extern "C" fn InitFeatures_set_wumbo_required(this_arg: &mut crate::lightning::ln::features::InitFeatures) {
+ unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_wumbo_required()
+}
+
+/// Checks if this feature is supported.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn InitFeatures_supports_wumbo(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_wumbo();
+ ret
+}
+
+/// Set this feature as optional.
+#[no_mangle]
+pub extern "C" fn NodeFeatures_set_wumbo_optional(this_arg: &mut crate::lightning::ln::features::NodeFeatures) {
+ unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_wumbo_optional()
+}
+
+/// Set this feature as required.
+#[no_mangle]
+pub extern "C" fn NodeFeatures_set_wumbo_required(this_arg: &mut crate::lightning::ln::features::NodeFeatures) {
+ unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_wumbo_required()
+}
+
+/// Checks if this feature is supported.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn NodeFeatures_supports_wumbo(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_wumbo();
+ ret
+}
+
+/// Checks if this feature is required.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn InitFeatures_requires_wumbo(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_wumbo();
+ ret
+}
+
+/// Checks if this feature is required.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn NodeFeatures_requires_wumbo(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_wumbo();
+ ret
+}
+
/// Set this feature as optional.
#[no_mangle]
pub extern "C" fn InitFeatures_set_shutdown_any_segwit_optional(this_arg: &mut crate::lightning::ln::features::InitFeatures) {
ret
}
+/// Set this feature as optional.
+#[no_mangle]
+pub extern "C" fn InitFeatures_set_zero_conf_optional(this_arg: &mut crate::lightning::ln::features::InitFeatures) {
+ unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_zero_conf_optional()
+}
+
+/// Set this feature as required.
+#[no_mangle]
+pub extern "C" fn InitFeatures_set_zero_conf_required(this_arg: &mut crate::lightning::ln::features::InitFeatures) {
+ unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_zero_conf_required()
+}
+
+/// Checks if this feature is supported.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn InitFeatures_supports_zero_conf(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_zero_conf();
+ ret
+}
+
+/// Set this feature as optional.
+#[no_mangle]
+pub extern "C" fn NodeFeatures_set_zero_conf_optional(this_arg: &mut crate::lightning::ln::features::NodeFeatures) {
+ unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_zero_conf_optional()
+}
+
+/// Set this feature as required.
+#[no_mangle]
+pub extern "C" fn NodeFeatures_set_zero_conf_required(this_arg: &mut crate::lightning::ln::features::NodeFeatures) {
+ unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_zero_conf_required()
+}
+
+/// Checks if this feature is supported.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn NodeFeatures_supports_zero_conf(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_zero_conf();
+ ret
+}
+
+/// Set this feature as optional.
+#[no_mangle]
+pub extern "C" fn ChannelTypeFeatures_set_zero_conf_optional(this_arg: &mut crate::lightning::ln::features::ChannelTypeFeatures) {
+ unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeChannelTypeFeatures)) }.set_zero_conf_optional()
+}
+
+/// Set this feature as required.
+#[no_mangle]
+pub extern "C" fn ChannelTypeFeatures_set_zero_conf_required(this_arg: &mut crate::lightning::ln::features::ChannelTypeFeatures) {
+ unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeChannelTypeFeatures)) }.set_zero_conf_required()
+}
+
+/// Checks if this feature is supported.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn ChannelTypeFeatures_supports_zero_conf(this_arg: &crate::lightning::ln::features::ChannelTypeFeatures) -> bool {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_zero_conf();
+ ret
+}
+
+/// Checks if this feature is required.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn InitFeatures_requires_zero_conf(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_zero_conf();
+ ret
+}
+
+/// Checks if this feature is required.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn NodeFeatures_requires_zero_conf(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_zero_conf();
+ ret
+}
+
+/// Checks if this feature is required.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn ChannelTypeFeatures_requires_zero_conf(this_arg: &crate::lightning::ln::features::ChannelTypeFeatures) -> bool {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_zero_conf();
+ ret
+}
+
/// Set this feature as optional.
#[no_mangle]
pub extern "C" fn NodeFeatures_set_keysend_optional(this_arg: &mut crate::lightning::ln::features::NodeFeatures) {
--- /dev/null
+// This file is Copyright its original authors, visible in version control
+// history and in the source files from which this was generated.
+//
+// This file is licensed under the license available in the LICENSE or LICENSE.md
+// file in the root of this repository or, if no such file exists, the same
+// license as that which applies to the original source files from which this
+// source was automatically generated.
+
+//! Utilities to generate inbound payment information in service of invoice creation.
+
+use alloc::str::FromStr;
+use core::ffi::c_void;
+use core::convert::Infallible;
+use bitcoin::hashes::Hash;
+use crate::c_types::*;
+#[cfg(feature="no-std")]
+use alloc::{vec::Vec, boxed::Box};
+
+
+use lightning::ln::inbound_payment::ExpandedKey as nativeExpandedKeyImport;
+pub(crate) type nativeExpandedKey = nativeExpandedKeyImport;
+
+/// A set of keys that were HKDF-expanded from an initial call to
+/// [`KeysInterface::get_inbound_payment_key_material`].
+///
+/// [`KeysInterface::get_inbound_payment_key_material`]: crate::chain::keysinterface::KeysInterface::get_inbound_payment_key_material
+#[must_use]
+#[repr(C)]
+pub struct ExpandedKey {
+ /// 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 nativeExpandedKey,
+ /// 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 ExpandedKey {
+ fn drop(&mut self) {
+ if self.is_owned && !<*mut nativeExpandedKey>::is_null(self.inner) {
+ let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+ }
+ }
+}
+/// Frees any resources used by the ExpandedKey, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn ExpandedKey_free(this_obj: ExpandedKey) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn ExpandedKey_free_void(this_ptr: *mut c_void) {
+ unsafe { let _ = Box::from_raw(this_ptr as *mut nativeExpandedKey); }
+}
+#[allow(unused)]
+impl ExpandedKey {
+ pub(crate) fn get_native_ref(&self) -> &'static nativeExpandedKey {
+ unsafe { &*ObjOps::untweak_ptr(self.inner) }
+ }
+ pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeExpandedKey {
+ 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 nativeExpandedKey {
+ assert!(self.is_owned);
+ let ret = ObjOps::untweak_ptr(self.inner);
+ self.inner = core::ptr::null_mut();
+ ret
+ }
+}
+/// Create a new [`ExpandedKey`] for generating an inbound payment hash and secret.
+///
+/// It is recommended to cache this value and not regenerate it for each new inbound payment.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn ExpandedKey_new(key_material: *const [u8; 32]) -> crate::lightning::ln::inbound_payment::ExpandedKey {
+ let mut ret = lightning::ln::inbound_payment::ExpandedKey::new(&::lightning::chain::keysinterface::KeyMaterial( unsafe { *key_material }));
+ crate::lightning::ln::inbound_payment::ExpandedKey { inner: ObjOps::heap_alloc(ret), is_owned: true }
+}
+
+/// Equivalent to [`crate::ln::channelmanager::ChannelManager::create_inbound_payment`], but no
+/// `ChannelManager` is required. Useful for generating invoices for [phantom node payments] without
+/// a `ChannelManager`.
+///
+/// `keys` is generated by calling [`KeysInterface::get_inbound_payment_key_material`] and then
+/// calling [`ExpandedKey::new`] with its result. It is recommended to cache this value and not
+/// regenerate it for each new inbound payment.
+///
+/// `current_time` is a Unix timestamp representing the current time.
+///
+/// [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
+#[no_mangle]
+pub extern "C" fn create(keys: &crate::lightning::ln::inbound_payment::ExpandedKey, mut min_value_msat: crate::c_types::derived::COption_u64Z, mut invoice_expiry_delta_secs: u32, keys_manager: &crate::lightning::chain::keysinterface::KeysInterface, mut current_time: u64) -> crate::c_types::derived::CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
+ let mut local_min_value_msat = if min_value_msat.is_some() { Some( { min_value_msat.take() }) } else { None };
+ let mut ret = lightning::ln::inbound_payment::create::<crate::lightning::chain::keysinterface::Sign, crate::lightning::chain::keysinterface::KeysInterface>(keys.get_native_ref(), local_min_value_msat, invoice_expiry_delta_secs, keys_manager, current_time);
+ let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { let (mut orig_ret_0_0, mut orig_ret_0_1) = o; let mut local_ret_0 = (crate::c_types::ThirtyTwoBytes { data: orig_ret_0_0.0 }, crate::c_types::ThirtyTwoBytes { data: orig_ret_0_1.0 }).into(); local_ret_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() };
+ local_ret
+}
+
+/// Equivalent to [`crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash`],
+/// but no `ChannelManager` is required. Useful for generating invoices for [phantom node payments]
+/// without a `ChannelManager`.
+///
+/// See [`create`] for information on the `keys` and `current_time` parameters.
+///
+/// [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
+#[no_mangle]
+pub extern "C" fn create_from_hash(keys: &crate::lightning::ln::inbound_payment::ExpandedKey, mut min_value_msat: crate::c_types::derived::COption_u64Z, mut payment_hash: crate::c_types::ThirtyTwoBytes, mut invoice_expiry_delta_secs: u32, mut current_time: u64) -> crate::c_types::derived::CResult_PaymentSecretNoneZ {
+ let mut local_min_value_msat = if min_value_msat.is_some() { Some( { min_value_msat.take() }) } else { None };
+ let mut ret = lightning::ln::inbound_payment::create_from_hash(keys.get_native_ref(), local_min_value_msat, ::lightning::ln::PaymentHash(payment_hash.data), invoice_expiry_delta_secs, current_time);
+ let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::ThirtyTwoBytes { data: o.0 } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() };
+ local_ret
+}
+
//! High level lightning structs and impls live here.
//!
-//! You probably want to create a channelmanager::ChannelManager, and a routing::NetGraphMsgHandler first.
+//! You probably want to create a [`ChannelManager`], and a [`P2PGossipSync`] first.
//! Then, you probably want to pass them both on to a peer_handler::PeerManager and use that to
//! create/manage connections and call get_and_clear_pending_events after each action, handling
//! them appropriately.
//!
-//! When you want to open/close a channel or send a payment, call into your ChannelManager and when
-//! you want to learn things about the network topology (eg get a route for sending a payment),
-//! call into your NetGraphMsgHandler.
+//! When you want to open/close a channel or send a payment, call into your [`ChannelManager`] and
+//! when you want to learn things about the network topology (eg get a route for sending a payment),
+//! call into your [`P2PGossipSync`].
+//!
+//! [`ChannelManager`]: channelmanager::ChannelManager
+//! [`P2PGossipSync`]: crate::routing::gossip::P2PGossipSync
use alloc::str::FromStr;
use core::ffi::c_void;
use alloc::{vec::Vec, boxed::Box};
pub mod channelmanager;
+pub mod inbound_payment;
pub mod msgs;
pub mod peer_handler;
pub mod chan_utils;
orig.clone()
}
-use lightning::ln::msgs::FundingLocked as nativeFundingLockedImport;
-pub(crate) type nativeFundingLocked = nativeFundingLockedImport;
+use lightning::ln::msgs::ChannelReady as nativeChannelReadyImport;
+pub(crate) type nativeChannelReady = nativeChannelReadyImport;
-/// A funding_locked message to be sent or received from a peer
+/// A channel_ready message to be sent or received from a peer
#[must_use]
#[repr(C)]
-pub struct FundingLocked {
+pub struct ChannelReady {
/// 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 nativeFundingLocked,
+ pub inner: *mut nativeChannelReady,
/// 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
pub is_owned: bool,
}
-impl Drop for FundingLocked {
+impl Drop for ChannelReady {
fn drop(&mut self) {
- if self.is_owned && !<*mut nativeFundingLocked>::is_null(self.inner) {
+ if self.is_owned && !<*mut nativeChannelReady>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
}
}
}
-/// Frees any resources used by the FundingLocked, if is_owned is set and inner is non-NULL.
+/// Frees any resources used by the ChannelReady, if is_owned is set and inner is non-NULL.
#[no_mangle]
-pub extern "C" fn FundingLocked_free(this_obj: FundingLocked) { }
+pub extern "C" fn ChannelReady_free(this_obj: 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 FundingLocked_free_void(this_ptr: *mut c_void) {
- unsafe { let _ = Box::from_raw(this_ptr as *mut nativeFundingLocked); }
+pub(crate) extern "C" fn ChannelReady_free_void(this_ptr: *mut c_void) {
+ unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelReady); }
}
#[allow(unused)]
-impl FundingLocked {
- pub(crate) fn get_native_ref(&self) -> &'static nativeFundingLocked {
+impl ChannelReady {
+ pub(crate) fn get_native_ref(&self) -> &'static nativeChannelReady {
unsafe { &*ObjOps::untweak_ptr(self.inner) }
}
- pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeFundingLocked {
+ pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeChannelReady {
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 nativeFundingLocked {
+ pub(crate) fn take_inner(mut self) -> *mut nativeChannelReady {
assert!(self.is_owned);
let ret = ObjOps::untweak_ptr(self.inner);
self.inner = core::ptr::null_mut();
}
/// The channel ID
#[no_mangle]
-pub extern "C" fn FundingLocked_get_channel_id(this_ptr: &FundingLocked) -> *const [u8; 32] {
+pub extern "C" fn ChannelReady_get_channel_id(this_ptr: &ChannelReady) -> *const [u8; 32] {
let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id;
inner_val
}
/// The channel ID
#[no_mangle]
-pub extern "C" fn FundingLocked_set_channel_id(this_ptr: &mut FundingLocked, mut val: crate::c_types::ThirtyTwoBytes) {
+pub extern "C" fn ChannelReady_set_channel_id(this_ptr: &mut ChannelReady, mut val: crate::c_types::ThirtyTwoBytes) {
unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = val.data;
}
/// The per-commitment point of the second commitment transaction
#[no_mangle]
-pub extern "C" fn FundingLocked_get_next_per_commitment_point(this_ptr: &FundingLocked) -> crate::c_types::PublicKey {
+pub extern "C" fn ChannelReady_get_next_per_commitment_point(this_ptr: &ChannelReady) -> crate::c_types::PublicKey {
let mut inner_val = &mut this_ptr.get_native_mut_ref().next_per_commitment_point;
crate::c_types::PublicKey::from_rust(&inner_val)
}
/// The per-commitment point of the second commitment transaction
#[no_mangle]
-pub extern "C" fn FundingLocked_set_next_per_commitment_point(this_ptr: &mut FundingLocked, mut val: crate::c_types::PublicKey) {
+pub extern "C" fn ChannelReady_set_next_per_commitment_point(this_ptr: &mut ChannelReady, mut val: crate::c_types::PublicKey) {
unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.next_per_commitment_point = val.into_rust();
}
/// If set, provides a short_channel_id alias for this channel. The sender will accept payments
/// to be forwarded over this SCID and forward them to this messages' recipient.
#[no_mangle]
-pub extern "C" fn FundingLocked_get_short_channel_id_alias(this_ptr: &FundingLocked) -> crate::c_types::derived::COption_u64Z {
+pub extern "C" fn ChannelReady_get_short_channel_id_alias(this_ptr: &ChannelReady) -> crate::c_types::derived::COption_u64Z {
let mut inner_val = &mut this_ptr.get_native_mut_ref().short_channel_id_alias;
let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { inner_val.unwrap() }) };
local_inner_val
/// If set, provides a short_channel_id alias for this channel. The sender will accept payments
/// to be forwarded over this SCID and forward them to this messages' recipient.
#[no_mangle]
-pub extern "C" fn FundingLocked_set_short_channel_id_alias(this_ptr: &mut FundingLocked, mut val: crate::c_types::derived::COption_u64Z) {
+pub extern "C" fn ChannelReady_set_short_channel_id_alias(this_ptr: &mut ChannelReady, mut val: crate::c_types::derived::COption_u64Z) {
let mut local_val = if val.is_some() { Some( { val.take() }) } else { None };
unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.short_channel_id_alias = local_val;
}
-/// Constructs a new FundingLocked given each field
+/// Constructs a new ChannelReady given each field
#[must_use]
#[no_mangle]
-pub extern "C" fn FundingLocked_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut next_per_commitment_point_arg: crate::c_types::PublicKey, mut short_channel_id_alias_arg: crate::c_types::derived::COption_u64Z) -> FundingLocked {
+pub extern "C" fn ChannelReady_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut next_per_commitment_point_arg: crate::c_types::PublicKey, mut short_channel_id_alias_arg: crate::c_types::derived::COption_u64Z) -> ChannelReady {
let mut local_short_channel_id_alias_arg = if short_channel_id_alias_arg.is_some() { Some( { short_channel_id_alias_arg.take() }) } else { None };
- FundingLocked { inner: ObjOps::heap_alloc(nativeFundingLocked {
+ ChannelReady { inner: ObjOps::heap_alloc(nativeChannelReady {
channel_id: channel_id_arg.data,
next_per_commitment_point: next_per_commitment_point_arg.into_rust(),
short_channel_id_alias: local_short_channel_id_alias_arg,
}), is_owned: true }
}
-impl Clone for FundingLocked {
+impl Clone for ChannelReady {
fn clone(&self) -> Self {
Self {
- inner: if <*mut nativeFundingLocked>::is_null(self.inner) { core::ptr::null_mut() } else {
+ inner: if <*mut nativeChannelReady>::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 FundingLocked_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeFundingLocked)).clone() })) as *mut c_void
+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
}
#[no_mangle]
-/// Creates a copy of the FundingLocked
-pub extern "C" fn FundingLocked_clone(orig: &FundingLocked) -> FundingLocked {
+/// Creates a copy of the ChannelReady
+pub extern "C" fn ChannelReady_clone(orig: &ChannelReady) -> ChannelReady {
orig.clone()
}
orig.clone()
}
/// An address which can be used to connect to a remote peer
-#[must_use]
#[derive(Clone)]
+#[must_use]
#[repr(C)]
pub enum NetAddress {
/// An IPv4 address/port on which the peer is listening.
///
/// This field is deprecated and the Tor network generally no longer supports V2 Onion
/// addresses. Thus, the details are not parsed here.
- OnionV2(crate::c_types::TwelveBytes),
+ OnionV2(
+ crate::c_types::TwelveBytes),
/// A new-style Tor onion address/port on which the peer is listening.
/// To create the human-readable \"hostname\", concatenate ed25519_pubkey, checksum, and version,
/// wrap as base32 and append \".onion\".
port: u16,
},
}
-use lightning::ln::msgs::NetAddress as nativeNetAddress;
+use lightning::ln::msgs::NetAddress as NetAddressImport;
+pub(crate) type nativeNetAddress = NetAddressImport;
+
impl NetAddress {
#[allow(unused)]
pub(crate) fn to_native(&self) -> nativeNetAddress {
pub extern "C" fn UnsignedChannelUpdate_set_fee_proportional_millionths(this_ptr: &mut UnsignedChannelUpdate, mut val: u32) {
unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.fee_proportional_millionths = val;
}
+/// Excess data which was signed as a part of the message which we do not (yet) understand how
+/// to decode. This is stored to ensure forward-compatibility as new fields are added to the
+/// lightning gossip
+#[no_mangle]
+pub extern "C" fn UnsignedChannelUpdate_set_excess_data(this_ptr: &mut UnsignedChannelUpdate, mut val: crate::c_types::derived::CVec_u8Z) {
+ let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { item }); };
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.excess_data = local_val;
+}
impl Clone for UnsignedChannelUpdate {
fn clone(&self) -> Self {
Self {
orig.clone()
}
/// Used to put an error message in a LightningError
-#[must_use]
#[derive(Clone)]
+#[must_use]
#[repr(C)]
pub enum ErrorAction {
/// The peer took some action which made us think they were useless. Disconnect them.
IgnoreError,
/// The peer did something harmless that we weren't able to meaningfully process.
/// If the error is logged, log it at the given level.
- IgnoreAndLog(crate::lightning::util::logger::Level),
+ IgnoreAndLog(
+ crate::lightning::util::logger::Level),
/// The peer provided us with a gossip message which we'd already seen. In most cases this
/// should be ignored, but it may result in the message being forwarded if it is a duplicate of
/// our own channel announcements.
log_level: crate::lightning::util::logger::Level,
},
}
-use lightning::ln::msgs::ErrorAction as nativeErrorAction;
+use lightning::ln::msgs::ErrorAction as ErrorActionImport;
+pub(crate) type nativeErrorAction = ErrorActionImport;
+
impl ErrorAction {
#[allow(unused)]
pub(crate) fn to_native(&self) -> nativeErrorAction {
pub handle_funding_created: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::FundingCreated),
/// Handle an incoming funding_signed message from the given peer.
pub handle_funding_signed: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::FundingSigned),
- /// Handle an incoming funding_locked message from the given peer.
- pub handle_funding_locked: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::FundingLocked),
+ /// Handle an incoming channel_ready message from the given peer.
+ pub handle_channel_ready: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::ChannelReady),
/// Handle an incoming shutdown message from the given peer.
pub handle_shutdown: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, their_features: &crate::lightning::ln::features::InitFeatures, msg: &crate::lightning::ln::msgs::Shutdown),
/// Handle an incoming closing_signed message from the given peer.
handle_accept_channel: Clone::clone(&orig.handle_accept_channel),
handle_funding_created: Clone::clone(&orig.handle_funding_created),
handle_funding_signed: Clone::clone(&orig.handle_funding_signed),
- handle_funding_locked: Clone::clone(&orig.handle_funding_locked),
+ handle_channel_ready: Clone::clone(&orig.handle_channel_ready),
handle_shutdown: Clone::clone(&orig.handle_shutdown),
handle_closing_signed: Clone::clone(&orig.handle_closing_signed),
handle_update_add_htlc: Clone::clone(&orig.handle_update_add_htlc),
use lightning::ln::msgs::ChannelMessageHandler as rustChannelMessageHandler;
impl rustChannelMessageHandler for ChannelMessageHandler {
- fn handle_open_channel(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut their_features: lightning::ln::features::InitFeatures, mut msg: &lightning::ln::msgs::OpenChannel) {
+ fn handle_open_channel(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut their_features: lightning::ln::features::InitFeatures, mut msg: &lightning::ln::msgs::OpenChannel) {
(self.handle_open_channel)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), crate::lightning::ln::features::InitFeatures { inner: ObjOps::heap_alloc(their_features), is_owned: true }, &crate::lightning::ln::msgs::OpenChannel { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::OpenChannel<>) as *mut _) }, is_owned: false })
}
- fn handle_accept_channel(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut their_features: lightning::ln::features::InitFeatures, mut msg: &lightning::ln::msgs::AcceptChannel) {
+ fn handle_accept_channel(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut their_features: lightning::ln::features::InitFeatures, mut msg: &lightning::ln::msgs::AcceptChannel) {
(self.handle_accept_channel)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), crate::lightning::ln::features::InitFeatures { inner: ObjOps::heap_alloc(their_features), is_owned: true }, &crate::lightning::ln::msgs::AcceptChannel { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::AcceptChannel<>) as *mut _) }, is_owned: false })
}
- fn handle_funding_created(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::FundingCreated) {
+ fn handle_funding_created(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::FundingCreated) {
(self.handle_funding_created)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::FundingCreated { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::FundingCreated<>) as *mut _) }, is_owned: false })
}
- fn handle_funding_signed(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::FundingSigned) {
+ fn handle_funding_signed(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::FundingSigned) {
(self.handle_funding_signed)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::FundingSigned { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::FundingSigned<>) as *mut _) }, is_owned: false })
}
- fn handle_funding_locked(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::FundingLocked) {
- (self.handle_funding_locked)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::FundingLocked { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::FundingLocked<>) as *mut _) }, is_owned: false })
+ fn handle_channel_ready(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::ChannelReady) {
+ (self.handle_channel_ready)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::ChannelReady { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::ChannelReady<>) as *mut _) }, is_owned: false })
}
- fn handle_shutdown(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut their_features: &lightning::ln::features::InitFeatures, mut msg: &lightning::ln::msgs::Shutdown) {
+ fn handle_shutdown(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut their_features: &lightning::ln::features::InitFeatures, mut msg: &lightning::ln::msgs::Shutdown) {
(self.handle_shutdown)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::features::InitFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((their_features as *const lightning::ln::features::InitFeatures<>) as *mut _) }, is_owned: false }, &crate::lightning::ln::msgs::Shutdown { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::Shutdown<>) as *mut _) }, is_owned: false })
}
- fn handle_closing_signed(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::ClosingSigned) {
+ fn handle_closing_signed(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::ClosingSigned) {
(self.handle_closing_signed)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::ClosingSigned { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::ClosingSigned<>) as *mut _) }, is_owned: false })
}
- fn handle_update_add_htlc(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::UpdateAddHTLC) {
+ fn handle_update_add_htlc(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::UpdateAddHTLC) {
(self.handle_update_add_htlc)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::UpdateAddHTLC { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::UpdateAddHTLC<>) as *mut _) }, is_owned: false })
}
- fn handle_update_fulfill_htlc(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::UpdateFulfillHTLC) {
+ fn handle_update_fulfill_htlc(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::UpdateFulfillHTLC) {
(self.handle_update_fulfill_htlc)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::UpdateFulfillHTLC { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::UpdateFulfillHTLC<>) as *mut _) }, is_owned: false })
}
- fn handle_update_fail_htlc(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::UpdateFailHTLC) {
+ fn handle_update_fail_htlc(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::UpdateFailHTLC) {
(self.handle_update_fail_htlc)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::UpdateFailHTLC { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::UpdateFailHTLC<>) as *mut _) }, is_owned: false })
}
- fn handle_update_fail_malformed_htlc(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::UpdateFailMalformedHTLC) {
+ fn handle_update_fail_malformed_htlc(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::UpdateFailMalformedHTLC) {
(self.handle_update_fail_malformed_htlc)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::UpdateFailMalformedHTLC { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::UpdateFailMalformedHTLC<>) as *mut _) }, is_owned: false })
}
- fn handle_commitment_signed(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::CommitmentSigned) {
+ fn handle_commitment_signed(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::CommitmentSigned) {
(self.handle_commitment_signed)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::CommitmentSigned { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::CommitmentSigned<>) as *mut _) }, is_owned: false })
}
- fn handle_revoke_and_ack(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::RevokeAndACK) {
+ fn handle_revoke_and_ack(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::RevokeAndACK) {
(self.handle_revoke_and_ack)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::RevokeAndACK { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::RevokeAndACK<>) as *mut _) }, is_owned: false })
}
- fn handle_update_fee(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::UpdateFee) {
+ fn handle_update_fee(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::UpdateFee) {
(self.handle_update_fee)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::UpdateFee { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::UpdateFee<>) as *mut _) }, is_owned: false })
}
- fn handle_announcement_signatures(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::AnnouncementSignatures) {
+ fn handle_announcement_signatures(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::AnnouncementSignatures) {
(self.handle_announcement_signatures)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::AnnouncementSignatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::AnnouncementSignatures<>) as *mut _) }, is_owned: false })
}
- fn peer_disconnected(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut no_connection_possible: bool) {
+ fn peer_disconnected(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut no_connection_possible: bool) {
(self.peer_disconnected)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), no_connection_possible)
}
- fn peer_connected(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::Init) {
+ fn peer_connected(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::Init) {
(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((msg as *const lightning::ln::msgs::Init<>) as *mut _) }, is_owned: false })
}
- fn handle_channel_reestablish(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::ChannelReestablish) {
+ fn handle_channel_reestablish(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::ChannelReestablish) {
(self.handle_channel_reestablish)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::ChannelReestablish { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::ChannelReestablish<>) as *mut _) }, is_owned: false })
}
- fn handle_channel_update(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::ChannelUpdate) {
+ fn handle_channel_update(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::ChannelUpdate) {
(self.handle_channel_update)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::ChannelUpdate { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::ChannelUpdate<>) as *mut _) }, is_owned: false })
}
- fn handle_error(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::ErrorMessage) {
+ fn handle_error(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::ErrorMessage) {
(self.handle_error)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::ErrorMessage { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::ErrorMessage<>) as *mut _) }, is_owned: false })
}
}
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_1 = if orig_ret_0_1.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(orig_ret_0_1.take_inner()) } }) }; 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 = (*unsafe { Box::from_raw(orig_ret_0_0.take_inner()) }, local_orig_ret_0_1, local_orig_ret_0_2); local_ret_0 }); };
local_ret
}
- fn get_next_node_announcements(&self, mut starting_point: Option<&bitcoin::secp256k1::key::PublicKey>, mut batch_amount: u8) -> Vec<lightning::ln::msgs::NodeAnnouncement> {
+ fn get_next_node_announcements(&self, mut starting_point: Option<&bitcoin::secp256k1::PublicKey>, mut batch_amount: u8) -> Vec<lightning::ln::msgs::NodeAnnouncement> {
let mut local_starting_point = if starting_point.is_none() { crate::c_types::PublicKey::null() } else { { crate::c_types::PublicKey::from_rust(&(starting_point.unwrap())) } };
let mut ret = (self.get_next_node_announcements)(self.this_arg, local_starting_point, batch_amount);
let mut local_ret = Vec::new(); for mut item in ret.into_rust().drain(..) { local_ret.push( { *unsafe { Box::from_raw(item.take_inner()) } }); };
local_ret
}
- fn peer_connected(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut init: &lightning::ln::msgs::Init) {
+ fn peer_connected(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut init: &lightning::ln::msgs::Init) {
(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 })
}
- fn handle_reply_channel_range(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: lightning::ln::msgs::ReplyChannelRange) -> Result<(), lightning::ln::msgs::LightningError> {
+ fn handle_reply_channel_range(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: lightning::ln::msgs::ReplyChannelRange) -> Result<(), lightning::ln::msgs::LightningError> {
let mut ret = (self.handle_reply_channel_range)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), crate::lightning::ln::msgs::ReplyChannelRange { inner: ObjOps::heap_alloc(msg), is_owned: true });
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((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).take_inner()) } })};
local_ret
}
- fn handle_reply_short_channel_ids_end(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: lightning::ln::msgs::ReplyShortChannelIdsEnd) -> Result<(), lightning::ln::msgs::LightningError> {
+ fn handle_reply_short_channel_ids_end(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: lightning::ln::msgs::ReplyShortChannelIdsEnd) -> Result<(), lightning::ln::msgs::LightningError> {
let mut ret = (self.handle_reply_short_channel_ids_end)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), crate::lightning::ln::msgs::ReplyShortChannelIdsEnd { inner: ObjOps::heap_alloc(msg), is_owned: true });
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((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).take_inner()) } })};
local_ret
}
- fn handle_query_channel_range(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: lightning::ln::msgs::QueryChannelRange) -> Result<(), lightning::ln::msgs::LightningError> {
+ fn handle_query_channel_range(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: lightning::ln::msgs::QueryChannelRange) -> Result<(), lightning::ln::msgs::LightningError> {
let mut ret = (self.handle_query_channel_range)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), crate::lightning::ln::msgs::QueryChannelRange { inner: ObjOps::heap_alloc(msg), is_owned: true });
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((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).take_inner()) } })};
local_ret
}
- fn handle_query_short_channel_ids(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: lightning::ln::msgs::QueryShortChannelIds) -> Result<(), lightning::ln::msgs::LightningError> {
+ fn handle_query_short_channel_ids(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: lightning::ln::msgs::QueryShortChannelIds) -> Result<(), lightning::ln::msgs::LightningError> {
let mut ret = (self.handle_query_short_channel_ids)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), crate::lightning::ln::msgs::QueryShortChannelIds { inner: ObjOps::heap_alloc(msg), is_owned: true });
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((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).take_inner()) } })};
local_ret
local_res
}
#[no_mangle]
-/// Serialize the FundingLocked object into a byte array which can be read by FundingLocked_read
-pub extern "C" fn FundingLocked_write(obj: &crate::lightning::ln::msgs::FundingLocked) -> crate::c_types::derived::CVec_u8Z {
+/// Serialize the ChannelReady object into a byte array which can be read by ChannelReady_read
+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]
-pub(crate) extern "C" fn FundingLocked_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
- crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeFundingLocked) })
+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) })
}
#[no_mangle]
-/// Read a FundingLocked from a byte array, created by FundingLocked_write
-pub extern "C" fn FundingLocked_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_FundingLockedDecodeErrorZ {
- let res: Result<lightning::ln::msgs::FundingLocked, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
- let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::FundingLocked { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+/// Read a ChannelReady from a byte array, created by ChannelReady_write
+pub extern "C" fn ChannelReady_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelReadyDecodeErrorZ {
+ let res: Result<lightning::ln::msgs::ChannelReady, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
+ let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::ChannelReady { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
local_res
}
#[no_mangle]
//! Instead of actually servicing sockets ourselves we require that you implement the
//! SocketDescriptor interface and use that to receive actions which you should perform on the
//! socket, and call into PeerManager with bytes read from the socket. The PeerManager will then
-//! call into the provided message handlers (probably a ChannelManager and NetGraphmsgHandler) with messages
-//! they should handle, and encoding/sending response messages.
+//! call into the provided message handlers (probably a ChannelManager and P2PGossipSync) with
+//! messages they should handle, and encoding/sending response messages.
use alloc::str::FromStr;
use core::ffi::c_void;
use lightning::ln::peer_handler::CustomMessageHandler as rustCustomMessageHandler;
impl rustCustomMessageHandler for CustomMessageHandler {
- fn handle_custom_message(&self, mut msg: crate::lightning::ln::wire::Type, mut sender_node_id: &bitcoin::secp256k1::key::PublicKey) -> Result<(), lightning::ln::msgs::LightningError> {
+ fn handle_custom_message(&self, mut msg: crate::lightning::ln::wire::Type, mut sender_node_id: &bitcoin::secp256k1::PublicKey) -> Result<(), lightning::ln::msgs::LightningError> {
let mut ret = (self.handle_custom_message)(self.this_arg, Into::into(msg), crate::c_types::PublicKey::from_rust(&sender_node_id));
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((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).take_inner()) } })};
local_ret
}
- fn get_and_clear_pending_msg(&self) -> Vec<(bitcoin::secp256k1::key::PublicKey, crate::lightning::ln::wire::Type)> {
+ fn get_and_clear_pending_msg(&self) -> Vec<(bitcoin::secp256k1::PublicKey, crate::lightning::ln::wire::Type)> {
let mut ret = (self.get_and_clear_pending_msg)(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) = item.to_rust(); let mut local_ret_0 = (orig_ret_0_0.into_rust(), orig_ret_0_1); local_ret_0 }); };
local_ret
handle_accept_channel: ErroringMessageHandler_ChannelMessageHandler_handle_accept_channel,
handle_funding_created: ErroringMessageHandler_ChannelMessageHandler_handle_funding_created,
handle_funding_signed: ErroringMessageHandler_ChannelMessageHandler_handle_funding_signed,
- handle_funding_locked: ErroringMessageHandler_ChannelMessageHandler_handle_funding_locked,
+ handle_channel_ready: ErroringMessageHandler_ChannelMessageHandler_handle_channel_ready,
handle_shutdown: ErroringMessageHandler_ChannelMessageHandler_handle_shutdown,
handle_closing_signed: ErroringMessageHandler_ChannelMessageHandler_handle_closing_signed,
handle_update_add_htlc: ErroringMessageHandler_ChannelMessageHandler_handle_update_add_htlc,
extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_funding_signed(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::FundingSigned) {
<nativeErroringMessageHandler as lightning::ln::msgs::ChannelMessageHandler<>>::handle_funding_signed(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), msg.get_native_ref())
}
-extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_funding_locked(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::FundingLocked) {
- <nativeErroringMessageHandler as lightning::ln::msgs::ChannelMessageHandler<>>::handle_funding_locked(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), msg.get_native_ref())
+extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_channel_ready(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::ChannelReady) {
+ <nativeErroringMessageHandler as lightning::ln::msgs::ChannelMessageHandler<>>::handle_channel_ready(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), msg.get_native_ref())
}
extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_shutdown(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, _their_features: &crate::lightning::ln::features::InitFeatures, msg: &crate::lightning::ln::msgs::Shutdown) {
<nativeErroringMessageHandler as lightning::ln::msgs::ChannelMessageHandler<>>::handle_shutdown(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), _their_features.get_native_ref(), msg.get_native_ref())
extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_announcement_signatures(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::AnnouncementSignatures) {
<nativeErroringMessageHandler as lightning::ln::msgs::ChannelMessageHandler<>>::handle_announcement_signatures(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), msg.get_native_ref())
}
-extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_channel_reestablish(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::ChannelReestablish) {
- <nativeErroringMessageHandler as lightning::ln::msgs::ChannelMessageHandler<>>::handle_channel_reestablish(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), msg.get_native_ref())
-}
-extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_channel_update(this_arg: *const c_void, mut _their_node_id: crate::c_types::PublicKey, _msg: &crate::lightning::ln::msgs::ChannelUpdate) {
- <nativeErroringMessageHandler as lightning::ln::msgs::ChannelMessageHandler<>>::handle_channel_update(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &_their_node_id.into_rust(), _msg.get_native_ref())
-}
extern "C" fn ErroringMessageHandler_ChannelMessageHandler_peer_disconnected(this_arg: *const c_void, mut _their_node_id: crate::c_types::PublicKey, mut _no_connection_possible: bool) {
<nativeErroringMessageHandler as lightning::ln::msgs::ChannelMessageHandler<>>::peer_disconnected(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &_their_node_id.into_rust(), _no_connection_possible)
}
extern "C" fn ErroringMessageHandler_ChannelMessageHandler_peer_connected(this_arg: *const c_void, mut _their_node_id: crate::c_types::PublicKey, _msg: &crate::lightning::ln::msgs::Init) {
<nativeErroringMessageHandler as lightning::ln::msgs::ChannelMessageHandler<>>::peer_connected(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &_their_node_id.into_rust(), _msg.get_native_ref())
}
+extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_channel_reestablish(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::ChannelReestablish) {
+ <nativeErroringMessageHandler as lightning::ln::msgs::ChannelMessageHandler<>>::handle_channel_reestablish(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), msg.get_native_ref())
+}
+extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_channel_update(this_arg: *const c_void, mut _their_node_id: crate::c_types::PublicKey, _msg: &crate::lightning::ln::msgs::ChannelUpdate) {
+ <nativeErroringMessageHandler as lightning::ln::msgs::ChannelMessageHandler<>>::handle_channel_update(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &_their_node_id.into_rust(), _msg.get_native_ref())
+}
extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_error(this_arg: *const c_void, mut _their_node_id: crate::c_types::PublicKey, _msg: &crate::lightning::ln::msgs::ErrorMessage) {
<nativeErroringMessageHandler as lightning::ln::msgs::ChannelMessageHandler<>>::handle_error(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &_their_node_id.into_rust(), _msg.get_native_ref())
}
unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.chan_handler = val;
}
/// A message handler which handles messages updating our knowledge of the network channel
-/// graph. Usually this is just a [`NetGraphMsgHandler`] object or an
-/// [`IgnoringMessageHandler`].
+/// graph. Usually this is just a [`P2PGossipSync`] object or an [`IgnoringMessageHandler`].
///
-/// [`NetGraphMsgHandler`]: crate::routing::network_graph::NetGraphMsgHandler
+/// [`P2PGossipSync`]: crate::routing::gossip::P2PGossipSync
#[no_mangle]
pub extern "C" fn MessageHandler_get_route_handler(this_ptr: &MessageHandler) -> *const crate::lightning::ln::msgs::RoutingMessageHandler {
let mut inner_val = &mut this_ptr.get_native_mut_ref().route_handler;
inner_val
}
/// A message handler which handles messages updating our knowledge of the network channel
-/// graph. Usually this is just a [`NetGraphMsgHandler`] object or an
-/// [`IgnoringMessageHandler`].
+/// graph. Usually this is just a [`P2PGossipSync`] object or an [`IgnoringMessageHandler`].
///
-/// [`NetGraphMsgHandler`]: crate::routing::network_graph::NetGraphMsgHandler
+/// [`P2PGossipSync`]: crate::routing::gossip::P2PGossipSync
#[no_mangle]
pub extern "C" fn MessageHandler_set_route_handler(this_ptr: &mut MessageHandler, mut val: crate::lightning::ln::msgs::RoutingMessageHandler) {
unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.route_handler = val;
ret
}
}
-/// Used to indicate that we probably can't make any future connections to this peer, implying
-/// we should go ahead and force-close any channels we have with it.
+/// Used to indicate that we probably can't make any future connections to this peer (e.g.
+/// because we required features that our peer was missing, or vice versa).
+///
+/// While LDK's [`ChannelManager`] will not do it automatically, you likely wish to force-close
+/// any channels with this peer or check for new versions of LDK.
+///
+/// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
#[no_mangle]
pub extern "C" fn PeerHandleError_get_no_connection_possible(this_ptr: &PeerHandleError) -> bool {
let mut inner_val = &mut this_ptr.get_native_mut_ref().no_connection_possible;
*inner_val
}
-/// Used to indicate that we probably can't make any future connections to this peer, implying
-/// we should go ahead and force-close any channels we have with it.
+/// Used to indicate that we probably can't make any future connections to this peer (e.g.
+/// because we required features that our peer was missing, or vice versa).
+///
+/// While LDK's [`ChannelManager`] will not do it automatically, you likely wish to force-close
+/// any channels with this peer or check for new versions of LDK.
+///
+/// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
#[no_mangle]
pub extern "C" fn PeerHandleError_set_no_connection_possible(this_ptr: &mut PeerHandleError, mut val: bool) {
unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.no_connection_possible = val;
/// You don't have to call this function explicitly if you are using [`lightning-net-tokio`]
/// or one of the other clients provided in our language bindings.
///
+/// Note that if there are any other calls to this function waiting on lock(s) this may return
+/// without doing any work. All available events that need handling will be handled before the
+/// other calls return.
+///
/// [`send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
/// [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards
/// [`send_data`]: SocketDescriptor::send_data
/// A script pubkey for shutting down a channel as defined by [BOLT #2].
///
-/// [BOLT #2]: https://github.com/lightningnetwork/lightning-rfc/blob/master/02-peer-protocol.md
+/// [BOLT #2]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md
#[must_use]
#[repr(C)]
pub struct ShutdownScript {
}
/// The script that did not meet the requirements from [BOLT #2].
///
-/// [BOLT #2]: https://github.com/lightningnetwork/lightning-rfc/blob/master/02-peer-protocol.md
+/// [BOLT #2]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md
#[no_mangle]
pub extern "C" fn InvalidShutdownScript_get_script(this_ptr: &InvalidShutdownScript) -> crate::c_types::u8slice {
let mut inner_val = &mut this_ptr.get_native_mut_ref().script;
}
/// The script that did not meet the requirements from [BOLT #2].
///
-/// [BOLT #2]: https://github.com/lightningnetwork/lightning-rfc/blob/master/02-peer-protocol.md
+/// [BOLT #2]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md
#[no_mangle]
pub extern "C" fn InvalidShutdownScript_set_script(this_ptr: &mut InvalidShutdownScript, mut val: crate::c_types::derived::CVec_u8Z) {
unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.script = ::bitcoin::blockdata::script::Script::from(val.into_rust());
/// This function may return an error if `program` is invalid for the segwit `version`.
#[must_use]
#[no_mangle]
-pub extern "C" fn ShutdownScript_new_witness_program(mut version: u8, mut program: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ShutdownScriptInvalidShutdownScriptZ {
- let mut ret = lightning::ln::script::ShutdownScript::new_witness_program(core::num::NonZeroU8::new(version).expect("Value must be non-zero"), program.to_slice());
+pub extern "C" fn ShutdownScript_new_witness_program(mut version: crate::c_types::WitnessVersion, mut program: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ShutdownScriptInvalidShutdownScriptZ {
+ let mut ret = lightning::ln::script::ShutdownScript::new_witness_program(version.into(), program.to_slice());
let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::script::ShutdownScript { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::script::InvalidShutdownScript { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
local_ret
}
//! Wire encoding/decoding for Lightning messages according to [BOLT #1], and for
//! custom message through the [`CustomMessageReader`] trait.
//!
-//! [BOLT #1]: https://github.com/lightningnetwork/lightning-rfc/blob/master/01-messaging.md
+//! [BOLT #1]: https://github.com/lightning/bolts/blob/master/01-messaging.md
use alloc::str::FromStr;
use core::ffi::c_void;
//! figure out how best to make networking happen/timers fire/things get written to disk/keys get
//! generated/etc. This makes it a good candidate for tight integration into an existing wallet
//! instead of having a rather-separate lightning appendage to a wallet.
+//!
+//! `default` features are:
+//!
+//! * `std` - enables functionalities which require `std`, including `std::io` trait implementations and things which utilize time
+//! * `grind_signatures` - enables generation of [low-r bitcoin signatures](https://bitcoin.stackexchange.com/questions/111660/what-is-signature-grinding),
+//! which saves 1 byte per signature in 50% of the cases (see [bitcoin PR #13666](https://github.com/bitcoin/bitcoin/pull/13666))
+//!
+//! Available features are:
+//!
+//! * `std`
+//! * `grind_signatures`
+//! * `no-std ` - exposes write trait implementations from the `core2` crate (at least one of `no-std` or `std` are required)
+//! * Skip logging of messages at levels below the given log level:
+//! * `max_level_off`
+//! * `max_level_error`
+//! * `max_level_warn`
+//! * `max_level_info`
+//! * `max_level_debug`
+//! * `max_level_trace`
use alloc::str::FromStr;
use core::ffi::c_void;
--- /dev/null
+// This file is Copyright its original authors, visible in version control
+// history and in the source files from which this was generated.
+//
+// This file is licensed under the license available in the LICENSE or LICENSE.md
+// file in the root of this repository or, if no such file exists, the same
+// license as that which applies to the original source files from which this
+// source was automatically generated.
+
+//! The top-level network map tracking logic lives here.
+
+use alloc::str::FromStr;
+use core::ffi::c_void;
+use core::convert::Infallible;
+use bitcoin::hashes::Hash;
+use crate::c_types::*;
+#[cfg(feature="no-std")]
+use alloc::{vec::Vec, boxed::Box};
+
+
+use lightning::routing::gossip::NodeId as nativeNodeIdImport;
+pub(crate) type nativeNodeId = nativeNodeIdImport;
+
+/// Represents the compressed public key of a node
+#[must_use]
+#[repr(C)]
+pub struct NodeId {
+ /// 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 nativeNodeId,
+ /// 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 NodeId {
+ fn drop(&mut self) {
+ if self.is_owned && !<*mut nativeNodeId>::is_null(self.inner) {
+ let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+ }
+ }
+}
+/// Frees any resources used by the NodeId, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn NodeId_free(this_obj: NodeId) { }
+#[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_free_void(this_ptr: *mut c_void) {
+ unsafe { let _ = Box::from_raw(this_ptr as *mut nativeNodeId); }
+}
+#[allow(unused)]
+impl NodeId {
+ pub(crate) fn get_native_ref(&self) -> &'static nativeNodeId {
+ unsafe { &*ObjOps::untweak_ptr(self.inner) }
+ }
+ pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeNodeId {
+ 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 nativeNodeId {
+ assert!(self.is_owned);
+ let ret = ObjOps::untweak_ptr(self.inner);
+ self.inner = core::ptr::null_mut();
+ ret
+ }
+}
+impl Clone for NodeId {
+ fn clone(&self) -> Self {
+ Self {
+ inner: if <*mut nativeNodeId>::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 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
+}
+#[no_mangle]
+/// Creates a copy of the NodeId
+pub extern "C" fn NodeId_clone(orig: &NodeId) -> NodeId {
+ orig.clone()
+}
+/// Create a new NodeId from a public key
+#[must_use]
+#[no_mangle]
+pub extern "C" fn NodeId_from_pubkey(mut pubkey: crate::c_types::PublicKey) -> crate::lightning::routing::gossip::NodeId {
+ let mut ret = lightning::routing::gossip::NodeId::from_pubkey(&pubkey.into_rust());
+ crate::lightning::routing::gossip::NodeId { inner: ObjOps::heap_alloc(ret), is_owned: true }
+}
+
+/// Get the public key slice from this NodeId
+#[must_use]
+#[no_mangle]
+pub extern "C" fn NodeId_as_slice(this_arg: &crate::lightning::routing::gossip::NodeId) -> crate::c_types::u8slice {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.as_slice();
+ let mut local_ret = crate::c_types::u8slice::from_slice(ret);
+ local_ret
+}
+
+/// Checks if two NodeIds contain equal inner contents.
+#[no_mangle]
+pub extern "C" fn NodeId_hash(o: &NodeId) -> u64 {
+ if o.inner.is_null() { return 0; }
+ // Note that we'd love to use alloc::collections::hash_map::DefaultHasher but it's not in core
+ #[allow(deprecated)]
+ let mut hasher = core::hash::SipHasher::new();
+ core::hash::Hash::hash(o.get_native_ref(), &mut hasher);
+ core::hash::Hasher::finish(&hasher)
+}
+#[no_mangle]
+/// Serialize the NodeId object into a byte array which can be read by NodeId_read
+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]
+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) })
+}
+#[no_mangle]
+/// Read a NodeId from a byte array, created by NodeId_write
+pub extern "C" fn NodeId_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_NodeIdDecodeErrorZ {
+ let res: Result<lightning::routing::gossip::NodeId, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
+ let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::gossip::NodeId { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+ local_res
+}
+
+use lightning::routing::gossip::NetworkGraph as nativeNetworkGraphImport;
+pub(crate) type nativeNetworkGraph = nativeNetworkGraphImport<crate::lightning::util::logger::Logger>;
+
+/// Represents the network as nodes and channels between them
+#[must_use]
+#[repr(C)]
+pub struct NetworkGraph {
+ /// 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 nativeNetworkGraph,
+ /// 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 NetworkGraph {
+ fn drop(&mut self) {
+ if self.is_owned && !<*mut nativeNetworkGraph>::is_null(self.inner) {
+ let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+ }
+ }
+}
+/// Frees any resources used by the NetworkGraph, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn NetworkGraph_free(this_obj: NetworkGraph) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn NetworkGraph_free_void(this_ptr: *mut c_void) {
+ unsafe { let _ = Box::from_raw(this_ptr as *mut nativeNetworkGraph); }
+}
+#[allow(unused)]
+impl NetworkGraph {
+ pub(crate) fn get_native_ref(&self) -> &'static nativeNetworkGraph {
+ unsafe { &*ObjOps::untweak_ptr(self.inner) }
+ }
+ pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeNetworkGraph {
+ 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 nativeNetworkGraph {
+ assert!(self.is_owned);
+ let ret = ObjOps::untweak_ptr(self.inner);
+ self.inner = core::ptr::null_mut();
+ ret
+ }
+}
+
+use lightning::routing::gossip::ReadOnlyNetworkGraph as nativeReadOnlyNetworkGraphImport;
+pub(crate) type nativeReadOnlyNetworkGraph = nativeReadOnlyNetworkGraphImport<'static>;
+
+/// A read-only view of [`NetworkGraph`].
+#[must_use]
+#[repr(C)]
+pub struct ReadOnlyNetworkGraph {
+ /// 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 nativeReadOnlyNetworkGraph,
+ /// 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 ReadOnlyNetworkGraph {
+ fn drop(&mut self) {
+ if self.is_owned && !<*mut nativeReadOnlyNetworkGraph>::is_null(self.inner) {
+ let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+ }
+ }
+}
+/// Frees any resources used by the ReadOnlyNetworkGraph, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn ReadOnlyNetworkGraph_free(this_obj: ReadOnlyNetworkGraph) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn ReadOnlyNetworkGraph_free_void(this_ptr: *mut c_void) {
+ unsafe { let _ = Box::from_raw(this_ptr as *mut nativeReadOnlyNetworkGraph); }
+}
+#[allow(unused)]
+impl ReadOnlyNetworkGraph {
+ pub(crate) fn get_native_ref(&self) -> &'static nativeReadOnlyNetworkGraph {
+ unsafe { &*ObjOps::untweak_ptr(self.inner) }
+ }
+ pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeReadOnlyNetworkGraph {
+ 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 nativeReadOnlyNetworkGraph {
+ assert!(self.is_owned);
+ let ret = ObjOps::untweak_ptr(self.inner);
+ self.inner = core::ptr::null_mut();
+ ret
+ }
+}
+/// Update to the [`NetworkGraph`] based on payment failure information conveyed via the Onion
+/// return packet by a node along the route. See [BOLT #4] for details.
+///
+/// [BOLT #4]: https://github.com/lightning/bolts/blob/master/04-onion-routing.md
+#[derive(Clone)]
+#[must_use]
+#[repr(C)]
+pub enum NetworkUpdate {
+ /// An error indicating a `channel_update` messages should be applied via
+ /// [`NetworkGraph::update_channel`].
+ ChannelUpdateMessage {
+ /// The update to apply via [`NetworkGraph::update_channel`].
+ msg: crate::lightning::ln::msgs::ChannelUpdate,
+ },
+ /// An error indicating that a channel failed to route a payment, which should be applied via
+ /// [`NetworkGraph::channel_failed`].
+ ChannelFailure {
+ /// The short channel id of the closed channel.
+ short_channel_id: u64,
+ /// Whether the channel should be permanently removed or temporarily disabled until a new
+ /// `channel_update` message is received.
+ is_permanent: bool,
+ },
+ /// An error indicating that a node failed to route a payment, which should be applied via
+ /// [`NetworkGraph::node_failed`].
+ NodeFailure {
+ /// The node id of the failed node.
+ node_id: crate::c_types::PublicKey,
+ /// Whether the node should be permanently removed from consideration or can be restored
+ /// when a new `channel_update` message is received.
+ is_permanent: bool,
+ },
+}
+use lightning::routing::gossip::NetworkUpdate as NetworkUpdateImport;
+pub(crate) type nativeNetworkUpdate = NetworkUpdateImport;
+
+impl NetworkUpdate {
+ #[allow(unused)]
+ pub(crate) fn to_native(&self) -> nativeNetworkUpdate {
+ match self {
+ NetworkUpdate::ChannelUpdateMessage {ref msg, } => {
+ let mut msg_nonref = (*msg).clone();
+ nativeNetworkUpdate::ChannelUpdateMessage {
+ msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) },
+ }
+ },
+ NetworkUpdate::ChannelFailure {ref short_channel_id, ref is_permanent, } => {
+ let mut short_channel_id_nonref = (*short_channel_id).clone();
+ let mut is_permanent_nonref = (*is_permanent).clone();
+ nativeNetworkUpdate::ChannelFailure {
+ short_channel_id: short_channel_id_nonref,
+ is_permanent: is_permanent_nonref,
+ }
+ },
+ NetworkUpdate::NodeFailure {ref node_id, ref is_permanent, } => {
+ let mut node_id_nonref = (*node_id).clone();
+ let mut is_permanent_nonref = (*is_permanent).clone();
+ nativeNetworkUpdate::NodeFailure {
+ node_id: node_id_nonref.into_rust(),
+ is_permanent: is_permanent_nonref,
+ }
+ },
+ }
+ }
+ #[allow(unused)]
+ pub(crate) fn into_native(self) -> nativeNetworkUpdate {
+ match self {
+ NetworkUpdate::ChannelUpdateMessage {mut msg, } => {
+ nativeNetworkUpdate::ChannelUpdateMessage {
+ msg: *unsafe { Box::from_raw(msg.take_inner()) },
+ }
+ },
+ NetworkUpdate::ChannelFailure {mut short_channel_id, mut is_permanent, } => {
+ nativeNetworkUpdate::ChannelFailure {
+ short_channel_id: short_channel_id,
+ is_permanent: is_permanent,
+ }
+ },
+ NetworkUpdate::NodeFailure {mut node_id, mut is_permanent, } => {
+ nativeNetworkUpdate::NodeFailure {
+ node_id: node_id.into_rust(),
+ is_permanent: is_permanent,
+ }
+ },
+ }
+ }
+ #[allow(unused)]
+ pub(crate) fn from_native(native: &nativeNetworkUpdate) -> Self {
+ match native {
+ nativeNetworkUpdate::ChannelUpdateMessage {ref msg, } => {
+ let mut msg_nonref = (*msg).clone();
+ NetworkUpdate::ChannelUpdateMessage {
+ msg: crate::lightning::ln::msgs::ChannelUpdate { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true },
+ }
+ },
+ nativeNetworkUpdate::ChannelFailure {ref short_channel_id, ref is_permanent, } => {
+ let mut short_channel_id_nonref = (*short_channel_id).clone();
+ let mut is_permanent_nonref = (*is_permanent).clone();
+ NetworkUpdate::ChannelFailure {
+ short_channel_id: short_channel_id_nonref,
+ is_permanent: is_permanent_nonref,
+ }
+ },
+ nativeNetworkUpdate::NodeFailure {ref node_id, ref is_permanent, } => {
+ let mut node_id_nonref = (*node_id).clone();
+ let mut is_permanent_nonref = (*is_permanent).clone();
+ NetworkUpdate::NodeFailure {
+ node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref),
+ is_permanent: is_permanent_nonref,
+ }
+ },
+ }
+ }
+ #[allow(unused)]
+ pub(crate) fn native_into(native: nativeNetworkUpdate) -> Self {
+ match native {
+ nativeNetworkUpdate::ChannelUpdateMessage {mut msg, } => {
+ NetworkUpdate::ChannelUpdateMessage {
+ msg: crate::lightning::ln::msgs::ChannelUpdate { inner: ObjOps::heap_alloc(msg), is_owned: true },
+ }
+ },
+ nativeNetworkUpdate::ChannelFailure {mut short_channel_id, mut is_permanent, } => {
+ NetworkUpdate::ChannelFailure {
+ short_channel_id: short_channel_id,
+ is_permanent: is_permanent,
+ }
+ },
+ nativeNetworkUpdate::NodeFailure {mut node_id, mut is_permanent, } => {
+ NetworkUpdate::NodeFailure {
+ node_id: crate::c_types::PublicKey::from_rust(&node_id),
+ is_permanent: is_permanent,
+ }
+ },
+ }
+ }
+}
+/// Frees any resources used by the NetworkUpdate
+#[no_mangle]
+pub extern "C" fn NetworkUpdate_free(this_ptr: NetworkUpdate) { }
+/// Creates a copy of the NetworkUpdate
+#[no_mangle]
+pub extern "C" fn NetworkUpdate_clone(orig: &NetworkUpdate) -> NetworkUpdate {
+ orig.clone()
+}
+#[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 {
+ NetworkUpdate::ChannelUpdateMessage {
+ msg,
+ }
+}
+#[no_mangle]
+/// Utility method to constructs a new ChannelFailure-variant NetworkUpdate
+pub extern "C" fn NetworkUpdate_channel_failure(short_channel_id: u64, is_permanent: bool) -> NetworkUpdate {
+ NetworkUpdate::ChannelFailure {
+ short_channel_id,
+ is_permanent,
+ }
+}
+#[no_mangle]
+/// Utility method to constructs a new NodeFailure-variant NetworkUpdate
+pub extern "C" fn NetworkUpdate_node_failure(node_id: crate::c_types::PublicKey, is_permanent: bool) -> NetworkUpdate {
+ NetworkUpdate::NodeFailure {
+ node_id,
+ is_permanent,
+ }
+}
+#[no_mangle]
+/// Serialize the NetworkUpdate object into a byte array which can be read by NetworkUpdate_read
+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())
+}
+#[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 {
+ let res: Result<Option<lightning::routing::gossip::NetworkUpdate>, lightning::ln::msgs::DecodeError> = crate::c_types::maybe_deserialize_obj(ser);
+ let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { let mut local_res_0 = if o.is_none() { crate::c_types::derived::COption_NetworkUpdateZ::None } else { crate::c_types::derived::COption_NetworkUpdateZ::Some( { crate::lightning::routing::gossip::NetworkUpdate::native_into(o.unwrap()) }) }; local_res_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+ local_res
+}
+
+use lightning::routing::gossip::P2PGossipSync as nativeP2PGossipSyncImport;
+pub(crate) type nativeP2PGossipSync = nativeP2PGossipSyncImport<&'static lightning::routing::gossip::NetworkGraph<crate::lightning::util::logger::Logger>, crate::lightning::chain::Access, crate::lightning::util::logger::Logger>;
+
+/// Receives and validates network updates from peers,
+/// stores authentic and relevant data as a network graph.
+/// This network graph is then used for routing payments.
+/// Provides interface to help with initial routing sync by
+/// serving historical announcements.
+///
+/// Serves as an [`EventHandler`] for applying updates from [`Event::PaymentPathFailed`] to the
+/// [`NetworkGraph`].
+#[must_use]
+#[repr(C)]
+pub struct P2PGossipSync {
+ /// 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 nativeP2PGossipSync,
+ /// 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 P2PGossipSync {
+ fn drop(&mut self) {
+ if self.is_owned && !<*mut nativeP2PGossipSync>::is_null(self.inner) {
+ let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+ }
+ }
+}
+/// Frees any resources used by the P2PGossipSync, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn P2PGossipSync_free(this_obj: P2PGossipSync) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn P2PGossipSync_free_void(this_ptr: *mut c_void) {
+ unsafe { let _ = Box::from_raw(this_ptr as *mut nativeP2PGossipSync); }
+}
+#[allow(unused)]
+impl P2PGossipSync {
+ pub(crate) fn get_native_ref(&self) -> &'static nativeP2PGossipSync {
+ unsafe { &*ObjOps::untweak_ptr(self.inner) }
+ }
+ pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeP2PGossipSync {
+ 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 nativeP2PGossipSync {
+ assert!(self.is_owned);
+ let ret = ObjOps::untweak_ptr(self.inner);
+ self.inner = core::ptr::null_mut();
+ ret
+ }
+}
+/// Creates a new tracker of the actual state of the network of channels and nodes,
+/// assuming an existing Network Graph.
+/// Chain monitor is used to make sure announced channels exist on-chain,
+/// channel data is correct, and that the announcement is signed with
+/// channel owners' keys.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn P2PGossipSync_new(network_graph: &crate::lightning::routing::gossip::NetworkGraph, mut chain_access: crate::c_types::derived::COption_AccessZ, mut logger: crate::lightning::util::logger::Logger) -> crate::lightning::routing::gossip::P2PGossipSync {
+ let mut local_chain_access = { /* chain_access*/ let chain_access_opt = chain_access; { } if chain_access_opt.is_none() { None } else { Some({ chain_access_opt.take() }) } };
+ let mut ret = lightning::routing::gossip::P2PGossipSync::new(network_graph.get_native_ref(), local_chain_access, logger);
+ crate::lightning::routing::gossip::P2PGossipSync { inner: ObjOps::heap_alloc(ret), is_owned: true }
+}
+
+/// Adds a provider used to check new announcements. Does not affect
+/// existing announcements unless they are updated.
+/// Add, update or remove the provider would replace the current one.
+#[no_mangle]
+pub extern "C" fn P2PGossipSync_add_chain_access(this_arg: &mut crate::lightning::routing::gossip::P2PGossipSync, mut chain_access: crate::c_types::derived::COption_AccessZ) {
+ let mut local_chain_access = { /* chain_access*/ let chain_access_opt = chain_access; { } if chain_access_opt.is_none() { None } else { Some({ chain_access_opt.take() }) } };
+ unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::routing::gossip::nativeP2PGossipSync)) }.add_chain_access(local_chain_access)
+}
+
+impl From<nativeNetworkGraph> for crate::lightning::util::events::EventHandler {
+ fn from(obj: nativeNetworkGraph) -> Self {
+ let mut rust_obj = NetworkGraph { inner: ObjOps::heap_alloc(obj), is_owned: true };
+ let mut ret = NetworkGraph_as_EventHandler(&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(NetworkGraph_free_void);
+ ret
+ }
+}
+/// Constructs a new EventHandler which calls the relevant methods on this_arg.
+/// This copies the `inner` pointer in this_arg and thus the returned EventHandler must be freed before this_arg is
+#[no_mangle]
+pub extern "C" fn NetworkGraph_as_EventHandler(this_arg: &NetworkGraph) -> crate::lightning::util::events::EventHandler {
+ crate::lightning::util::events::EventHandler {
+ this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void },
+ free: None,
+ handle_event: NetworkGraph_EventHandler_handle_event,
+ }
+}
+
+extern "C" fn NetworkGraph_EventHandler_handle_event(this_arg: *const c_void, event: &crate::lightning::util::events::Event) {
+ <nativeNetworkGraph as lightning::util::events::EventHandler<>>::handle_event(unsafe { &mut *(this_arg as *mut nativeNetworkGraph) }, &event.to_native())
+}
+
+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 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();
+ ret.free = Some(P2PGossipSync_free_void);
+ ret
+ }
+}
+/// Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
+/// This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
+#[no_mangle]
+pub extern "C" fn P2PGossipSync_as_RoutingMessageHandler(this_arg: &P2PGossipSync) -> crate::lightning::ln::msgs::RoutingMessageHandler {
+ crate::lightning::ln::msgs::RoutingMessageHandler {
+ this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void },
+ free: None,
+ handle_node_announcement: P2PGossipSync_RoutingMessageHandler_handle_node_announcement,
+ handle_channel_announcement: P2PGossipSync_RoutingMessageHandler_handle_channel_announcement,
+ handle_channel_update: P2PGossipSync_RoutingMessageHandler_handle_channel_update,
+ get_next_channel_announcements: P2PGossipSync_RoutingMessageHandler_get_next_channel_announcements,
+ get_next_node_announcements: P2PGossipSync_RoutingMessageHandler_get_next_node_announcements,
+ peer_connected: P2PGossipSync_RoutingMessageHandler_peer_connected,
+ handle_reply_channel_range: P2PGossipSync_RoutingMessageHandler_handle_reply_channel_range,
+ handle_reply_short_channel_ids_end: P2PGossipSync_RoutingMessageHandler_handle_reply_short_channel_ids_end,
+ handle_query_channel_range: P2PGossipSync_RoutingMessageHandler_handle_query_channel_range,
+ handle_query_short_channel_ids: P2PGossipSync_RoutingMessageHandler_handle_query_short_channel_ids,
+ MessageSendEventsProvider: crate::lightning::util::events::MessageSendEventsProvider {
+ this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void },
+ free: None,
+ get_and_clear_pending_msg_events: P2PGossipSync_MessageSendEventsProvider_get_and_clear_pending_msg_events,
+ },
+ }
+}
+
+#[must_use]
+extern "C" fn P2PGossipSync_RoutingMessageHandler_handle_node_announcement(this_arg: *const c_void, msg: &crate::lightning::ln::msgs::NodeAnnouncement) -> crate::c_types::derived::CResult_boolLightningErrorZ {
+ let mut ret = <nativeP2PGossipSync as lightning::ln::msgs::RoutingMessageHandler<>>::handle_node_announcement(unsafe { &mut *(this_arg as *mut nativeP2PGossipSync) }, 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
+}
+#[must_use]
+extern "C" fn P2PGossipSync_RoutingMessageHandler_handle_channel_announcement(this_arg: *const c_void, msg: &crate::lightning::ln::msgs::ChannelAnnouncement) -> crate::c_types::derived::CResult_boolLightningErrorZ {
+ let mut ret = <nativeP2PGossipSync as lightning::ln::msgs::RoutingMessageHandler<>>::handle_channel_announcement(unsafe { &mut *(this_arg as *mut nativeP2PGossipSync) }, 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
+}
+#[must_use]
+extern "C" fn P2PGossipSync_RoutingMessageHandler_handle_channel_update(this_arg: *const c_void, msg: &crate::lightning::ln::msgs::ChannelUpdate) -> crate::c_types::derived::CResult_boolLightningErrorZ {
+ let mut ret = <nativeP2PGossipSync as lightning::ln::msgs::RoutingMessageHandler<>>::handle_channel_update(unsafe { &mut *(this_arg as *mut nativeP2PGossipSync) }, 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
+}
+#[must_use]
+extern "C" fn P2PGossipSync_RoutingMessageHandler_get_next_channel_announcements(this_arg: *const c_void, mut starting_point: u64, mut batch_amount: u8) -> crate::c_types::derived::CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
+ let mut ret = <nativeP2PGossipSync as lightning::ln::msgs::RoutingMessageHandler<>>::get_next_channel_announcements(unsafe { &mut *(this_arg as *mut nativeP2PGossipSync) }, starting_point, batch_amount);
+ 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_1 = crate::lightning::ln::msgs::ChannelUpdate { inner: if orig_ret_0_1.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((orig_ret_0_1.unwrap())) } }, is_owned: true }; let mut local_orig_ret_0_2 = crate::lightning::ln::msgs::ChannelUpdate { 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::ln::msgs::ChannelAnnouncement { inner: ObjOps::heap_alloc(orig_ret_0_0), is_owned: true }, local_orig_ret_0_1, local_orig_ret_0_2).into(); local_ret_0 }); };
+ local_ret.into()
+}
+#[must_use]
+extern "C" fn P2PGossipSync_RoutingMessageHandler_get_next_node_announcements(this_arg: *const c_void, mut starting_point: crate::c_types::PublicKey, mut batch_amount: u8) -> crate::c_types::derived::CVec_NodeAnnouncementZ {
+ let mut local_starting_point_base = if starting_point.is_null() { None } else { Some( { starting_point.into_rust() }) }; let mut local_starting_point = local_starting_point_base.as_ref();
+ let mut ret = <nativeP2PGossipSync as lightning::ln::msgs::RoutingMessageHandler<>>::get_next_node_announcements(unsafe { &mut *(this_arg as *mut nativeP2PGossipSync) }, local_starting_point, batch_amount);
+ let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning::ln::msgs::NodeAnnouncement { inner: ObjOps::heap_alloc(item), is_owned: true } }); };
+ local_ret.into()
+}
+extern "C" fn P2PGossipSync_RoutingMessageHandler_peer_connected(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, init_msg: &crate::lightning::ln::msgs::Init) {
+ <nativeP2PGossipSync as lightning::ln::msgs::RoutingMessageHandler<>>::peer_connected(unsafe { &mut *(this_arg as *mut nativeP2PGossipSync) }, &their_node_id.into_rust(), init_msg.get_native_ref())
+}
+#[must_use]
+extern "C" fn P2PGossipSync_RoutingMessageHandler_handle_reply_channel_range(this_arg: *const c_void, mut _their_node_id: crate::c_types::PublicKey, mut _msg: crate::lightning::ln::msgs::ReplyChannelRange) -> crate::c_types::derived::CResult_NoneLightningErrorZ {
+ let mut ret = <nativeP2PGossipSync as lightning::ln::msgs::RoutingMessageHandler<>>::handle_reply_channel_range(unsafe { &mut *(this_arg as *mut nativeP2PGossipSync) }, &_their_node_id.into_rust(), *unsafe { Box::from_raw(_msg.take_inner()) });
+ 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
+}
+#[must_use]
+extern "C" fn P2PGossipSync_RoutingMessageHandler_handle_reply_short_channel_ids_end(this_arg: *const c_void, mut _their_node_id: crate::c_types::PublicKey, mut _msg: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> crate::c_types::derived::CResult_NoneLightningErrorZ {
+ let mut ret = <nativeP2PGossipSync as lightning::ln::msgs::RoutingMessageHandler<>>::handle_reply_short_channel_ids_end(unsafe { &mut *(this_arg as *mut nativeP2PGossipSync) }, &_their_node_id.into_rust(), *unsafe { Box::from_raw(_msg.take_inner()) });
+ 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
+}
+#[must_use]
+extern "C" fn P2PGossipSync_RoutingMessageHandler_handle_query_channel_range(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, mut msg: crate::lightning::ln::msgs::QueryChannelRange) -> crate::c_types::derived::CResult_NoneLightningErrorZ {
+ let mut ret = <nativeP2PGossipSync as lightning::ln::msgs::RoutingMessageHandler<>>::handle_query_channel_range(unsafe { &mut *(this_arg as *mut nativeP2PGossipSync) }, &their_node_id.into_rust(), *unsafe { Box::from_raw(msg.take_inner()) });
+ 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
+}
+#[must_use]
+extern "C" fn P2PGossipSync_RoutingMessageHandler_handle_query_short_channel_ids(this_arg: *const c_void, mut _their_node_id: crate::c_types::PublicKey, mut _msg: crate::lightning::ln::msgs::QueryShortChannelIds) -> crate::c_types::derived::CResult_NoneLightningErrorZ {
+ let mut ret = <nativeP2PGossipSync as lightning::ln::msgs::RoutingMessageHandler<>>::handle_query_short_channel_ids(unsafe { &mut *(this_arg as *mut nativeP2PGossipSync) }, &_their_node_id.into_rust(), *unsafe { Box::from_raw(_msg.take_inner()) });
+ 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
+}
+
+impl From<nativeP2PGossipSync> for crate::lightning::util::events::MessageSendEventsProvider {
+ fn from(obj: nativeP2PGossipSync) -> Self {
+ let mut rust_obj = 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();
+ ret.free = Some(P2PGossipSync_free_void);
+ ret
+ }
+}
+/// Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
+/// This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
+#[no_mangle]
+pub extern "C" fn P2PGossipSync_as_MessageSendEventsProvider(this_arg: &P2PGossipSync) -> crate::lightning::util::events::MessageSendEventsProvider {
+ crate::lightning::util::events::MessageSendEventsProvider {
+ this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void },
+ free: None,
+ get_and_clear_pending_msg_events: P2PGossipSync_MessageSendEventsProvider_get_and_clear_pending_msg_events,
+ }
+}
+
+#[must_use]
+extern "C" fn P2PGossipSync_MessageSendEventsProvider_get_and_clear_pending_msg_events(this_arg: *const c_void) -> crate::c_types::derived::CVec_MessageSendEventZ {
+ let mut ret = <nativeP2PGossipSync as lightning::util::events::MessageSendEventsProvider<>>::get_and_clear_pending_msg_events(unsafe { &mut *(this_arg as *mut nativeP2PGossipSync) }, );
+ let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning::util::events::MessageSendEvent::native_into(item) }); };
+ local_ret.into()
+}
+
+
+use lightning::routing::gossip::ChannelUpdateInfo as nativeChannelUpdateInfoImport;
+pub(crate) type nativeChannelUpdateInfo = nativeChannelUpdateInfoImport;
+
+/// Details about one direction of a channel as received within a [`ChannelUpdate`].
+#[must_use]
+#[repr(C)]
+pub struct ChannelUpdateInfo {
+ /// 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 nativeChannelUpdateInfo,
+ /// 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 ChannelUpdateInfo {
+ fn drop(&mut self) {
+ if self.is_owned && !<*mut nativeChannelUpdateInfo>::is_null(self.inner) {
+ let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+ }
+ }
+}
+/// Frees any resources used by the ChannelUpdateInfo, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn ChannelUpdateInfo_free(this_obj: ChannelUpdateInfo) { }
+#[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_free_void(this_ptr: *mut c_void) {
+ unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelUpdateInfo); }
+}
+#[allow(unused)]
+impl ChannelUpdateInfo {
+ pub(crate) fn get_native_ref(&self) -> &'static nativeChannelUpdateInfo {
+ unsafe { &*ObjOps::untweak_ptr(self.inner) }
+ }
+ pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeChannelUpdateInfo {
+ 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 nativeChannelUpdateInfo {
+ assert!(self.is_owned);
+ let ret = ObjOps::untweak_ptr(self.inner);
+ self.inner = core::ptr::null_mut();
+ ret
+ }
+}
+/// When the last update to the channel direction was issued.
+/// Value is opaque, as set in the announcement.
+#[no_mangle]
+pub extern "C" fn ChannelUpdateInfo_get_last_update(this_ptr: &ChannelUpdateInfo) -> u32 {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().last_update;
+ *inner_val
+}
+/// When the last update to the channel direction was issued.
+/// Value is opaque, as set in the announcement.
+#[no_mangle]
+pub extern "C" fn ChannelUpdateInfo_set_last_update(this_ptr: &mut ChannelUpdateInfo, mut val: u32) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.last_update = val;
+}
+/// Whether the channel can be currently used for payments (in this one direction).
+#[no_mangle]
+pub extern "C" fn ChannelUpdateInfo_get_enabled(this_ptr: &ChannelUpdateInfo) -> bool {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().enabled;
+ *inner_val
+}
+/// Whether the channel can be currently used for payments (in this one direction).
+#[no_mangle]
+pub extern "C" fn ChannelUpdateInfo_set_enabled(this_ptr: &mut ChannelUpdateInfo, mut val: bool) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.enabled = val;
+}
+/// The difference in CLTV values that you must have when routing through this channel.
+#[no_mangle]
+pub extern "C" fn ChannelUpdateInfo_get_cltv_expiry_delta(this_ptr: &ChannelUpdateInfo) -> u16 {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().cltv_expiry_delta;
+ *inner_val
+}
+/// The difference in CLTV values that you must have when routing through this channel.
+#[no_mangle]
+pub extern "C" fn ChannelUpdateInfo_set_cltv_expiry_delta(this_ptr: &mut ChannelUpdateInfo, mut val: u16) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.cltv_expiry_delta = val;
+}
+/// The minimum value, which must be relayed to the next hop via the channel
+#[no_mangle]
+pub extern "C" fn ChannelUpdateInfo_get_htlc_minimum_msat(this_ptr: &ChannelUpdateInfo) -> u64 {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().htlc_minimum_msat;
+ *inner_val
+}
+/// The minimum value, which must be relayed to the next hop via the channel
+#[no_mangle]
+pub extern "C" fn ChannelUpdateInfo_set_htlc_minimum_msat(this_ptr: &mut ChannelUpdateInfo, mut val: u64) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.htlc_minimum_msat = val;
+}
+/// The maximum value which may be relayed to the next hop via the channel.
+#[no_mangle]
+pub extern "C" fn ChannelUpdateInfo_get_htlc_maximum_msat(this_ptr: &ChannelUpdateInfo) -> crate::c_types::derived::COption_u64Z {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().htlc_maximum_msat;
+ let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { inner_val.unwrap() }) };
+ local_inner_val
+}
+/// The maximum value which may be relayed to the next hop via the channel.
+#[no_mangle]
+pub extern "C" fn ChannelUpdateInfo_set_htlc_maximum_msat(this_ptr: &mut ChannelUpdateInfo, mut val: crate::c_types::derived::COption_u64Z) {
+ let mut local_val = if val.is_some() { Some( { val.take() }) } else { None };
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.htlc_maximum_msat = local_val;
+}
+/// Fees charged when the channel is used for routing
+#[no_mangle]
+pub extern "C" fn ChannelUpdateInfo_get_fees(this_ptr: &ChannelUpdateInfo) -> crate::lightning::routing::gossip::RoutingFees {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().fees;
+ crate::lightning::routing::gossip::RoutingFees { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::routing::gossip::RoutingFees<>) as *mut _) }, is_owned: false }
+}
+/// Fees charged when the channel is used for routing
+#[no_mangle]
+pub extern "C" fn ChannelUpdateInfo_set_fees(this_ptr: &mut ChannelUpdateInfo, mut val: crate::lightning::routing::gossip::RoutingFees) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.fees = *unsafe { Box::from_raw(val.take_inner()) };
+}
+/// Most recent update for the channel received from the network
+/// Mostly redundant with the data we store in fields explicitly.
+/// Everything else is useful only for sending out for initial routing sync.
+/// Not stored if contains excess data to prevent DoS.
+///
+/// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
+#[no_mangle]
+pub extern "C" fn ChannelUpdateInfo_get_last_update_message(this_ptr: &ChannelUpdateInfo) -> crate::lightning::ln::msgs::ChannelUpdate {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().last_update_message;
+ let mut local_inner_val = crate::lightning::ln::msgs::ChannelUpdate { inner: unsafe { (if inner_val.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::ln::msgs::ChannelUpdate<>) as *mut _ }, is_owned: false };
+ local_inner_val
+}
+/// Most recent update for the channel received from the network
+/// Mostly redundant with the data we store in fields explicitly.
+/// Everything else is useful only for sending out for initial routing sync.
+/// Not stored if contains excess data to prevent DoS.
+///
+/// Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
+#[no_mangle]
+pub extern "C" fn ChannelUpdateInfo_set_last_update_message(this_ptr: &mut ChannelUpdateInfo, mut val: crate::lightning::ln::msgs::ChannelUpdate) {
+ let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_inner()) } }) };
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.last_update_message = local_val;
+}
+/// Constructs a new ChannelUpdateInfo given each field
+#[must_use]
+#[no_mangle]
+pub extern "C" fn ChannelUpdateInfo_new(mut last_update_arg: u32, mut enabled_arg: bool, mut cltv_expiry_delta_arg: u16, mut htlc_minimum_msat_arg: u64, mut htlc_maximum_msat_arg: crate::c_types::derived::COption_u64Z, mut fees_arg: crate::lightning::routing::gossip::RoutingFees, mut last_update_message_arg: crate::lightning::ln::msgs::ChannelUpdate) -> ChannelUpdateInfo {
+ let mut local_htlc_maximum_msat_arg = if htlc_maximum_msat_arg.is_some() { Some( { htlc_maximum_msat_arg.take() }) } else { None };
+ let mut local_last_update_message_arg = if last_update_message_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(last_update_message_arg.take_inner()) } }) };
+ ChannelUpdateInfo { inner: ObjOps::heap_alloc(nativeChannelUpdateInfo {
+ last_update: last_update_arg,
+ enabled: enabled_arg,
+ cltv_expiry_delta: cltv_expiry_delta_arg,
+ htlc_minimum_msat: htlc_minimum_msat_arg,
+ htlc_maximum_msat: local_htlc_maximum_msat_arg,
+ fees: *unsafe { Box::from_raw(fees_arg.take_inner()) },
+ last_update_message: local_last_update_message_arg,
+ }), is_owned: true }
+}
+impl Clone for ChannelUpdateInfo {
+ fn clone(&self) -> Self {
+ Self {
+ inner: if <*mut nativeChannelUpdateInfo>::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 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
+}
+#[no_mangle]
+/// Creates a copy of the ChannelUpdateInfo
+pub extern "C" fn ChannelUpdateInfo_clone(orig: &ChannelUpdateInfo) -> ChannelUpdateInfo {
+ orig.clone()
+}
+#[no_mangle]
+/// Serialize the ChannelUpdateInfo object into a byte array which can be read by ChannelUpdateInfo_read
+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]
+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) })
+}
+#[no_mangle]
+/// Read a ChannelUpdateInfo from a byte array, created by ChannelUpdateInfo_write
+pub extern "C" fn ChannelUpdateInfo_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelUpdateInfoDecodeErrorZ {
+ let res: Result<lightning::routing::gossip::ChannelUpdateInfo, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
+ let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::gossip::ChannelUpdateInfo { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+ local_res
+}
+
+use lightning::routing::gossip::ChannelInfo as nativeChannelInfoImport;
+pub(crate) type nativeChannelInfo = nativeChannelInfoImport;
+
+/// Details about a channel (both directions).
+/// Received within a channel announcement.
+#[must_use]
+#[repr(C)]
+pub struct ChannelInfo {
+ /// 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 nativeChannelInfo,
+ /// 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 ChannelInfo {
+ fn drop(&mut self) {
+ if self.is_owned && !<*mut nativeChannelInfo>::is_null(self.inner) {
+ let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+ }
+ }
+}
+/// Frees any resources used by the ChannelInfo, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn ChannelInfo_free(this_obj: ChannelInfo) { }
+#[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_free_void(this_ptr: *mut c_void) {
+ unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelInfo); }
+}
+#[allow(unused)]
+impl ChannelInfo {
+ pub(crate) fn get_native_ref(&self) -> &'static nativeChannelInfo {
+ unsafe { &*ObjOps::untweak_ptr(self.inner) }
+ }
+ pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeChannelInfo {
+ 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 nativeChannelInfo {
+ assert!(self.is_owned);
+ let ret = ObjOps::untweak_ptr(self.inner);
+ self.inner = core::ptr::null_mut();
+ ret
+ }
+}
+/// Protocol features of a channel communicated during its announcement
+#[no_mangle]
+pub extern "C" fn ChannelInfo_get_features(this_ptr: &ChannelInfo) -> crate::lightning::ln::features::ChannelFeatures {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().features;
+ crate::lightning::ln::features::ChannelFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::features::ChannelFeatures<>) as *mut _) }, is_owned: false }
+}
+/// Protocol features of a channel communicated during its announcement
+#[no_mangle]
+pub extern "C" fn ChannelInfo_set_features(this_ptr: &mut ChannelInfo, mut val: crate::lightning::ln::features::ChannelFeatures) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.features = *unsafe { Box::from_raw(val.take_inner()) };
+}
+/// Source node of the first direction of a channel
+#[no_mangle]
+pub extern "C" fn ChannelInfo_get_node_one(this_ptr: &ChannelInfo) -> crate::lightning::routing::gossip::NodeId {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().node_one;
+ crate::lightning::routing::gossip::NodeId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::routing::gossip::NodeId<>) as *mut _) }, is_owned: false }
+}
+/// Source node of the first direction of a channel
+#[no_mangle]
+pub extern "C" fn ChannelInfo_set_node_one(this_ptr: &mut ChannelInfo, mut val: crate::lightning::routing::gossip::NodeId) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.node_one = *unsafe { Box::from_raw(val.take_inner()) };
+}
+/// Details about the first direction of a channel
+///
+/// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
+#[no_mangle]
+pub extern "C" fn ChannelInfo_get_one_to_two(this_ptr: &ChannelInfo) -> crate::lightning::routing::gossip::ChannelUpdateInfo {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().one_to_two;
+ let mut local_inner_val = crate::lightning::routing::gossip::ChannelUpdateInfo { inner: unsafe { (if inner_val.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::routing::gossip::ChannelUpdateInfo<>) as *mut _ }, is_owned: false };
+ local_inner_val
+}
+/// Details about the first direction of a channel
+///
+/// Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
+#[no_mangle]
+pub extern "C" fn ChannelInfo_set_one_to_two(this_ptr: &mut ChannelInfo, mut val: crate::lightning::routing::gossip::ChannelUpdateInfo) {
+ let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_inner()) } }) };
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.one_to_two = local_val;
+}
+/// Source node of the second direction of a channel
+#[no_mangle]
+pub extern "C" fn ChannelInfo_get_node_two(this_ptr: &ChannelInfo) -> crate::lightning::routing::gossip::NodeId {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().node_two;
+ crate::lightning::routing::gossip::NodeId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::routing::gossip::NodeId<>) as *mut _) }, is_owned: false }
+}
+/// Source node of the second direction of a channel
+#[no_mangle]
+pub extern "C" fn ChannelInfo_set_node_two(this_ptr: &mut ChannelInfo, mut val: crate::lightning::routing::gossip::NodeId) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.node_two = *unsafe { Box::from_raw(val.take_inner()) };
+}
+/// Details about the second direction of a channel
+///
+/// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
+#[no_mangle]
+pub extern "C" fn ChannelInfo_get_two_to_one(this_ptr: &ChannelInfo) -> crate::lightning::routing::gossip::ChannelUpdateInfo {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().two_to_one;
+ let mut local_inner_val = crate::lightning::routing::gossip::ChannelUpdateInfo { inner: unsafe { (if inner_val.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::routing::gossip::ChannelUpdateInfo<>) as *mut _ }, is_owned: false };
+ local_inner_val
+}
+/// Details about the second direction of a channel
+///
+/// Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
+#[no_mangle]
+pub extern "C" fn ChannelInfo_set_two_to_one(this_ptr: &mut ChannelInfo, mut val: crate::lightning::routing::gossip::ChannelUpdateInfo) {
+ let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_inner()) } }) };
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.two_to_one = local_val;
+}
+/// The channel capacity as seen on-chain, if chain lookup is available.
+#[no_mangle]
+pub extern "C" fn ChannelInfo_get_capacity_sats(this_ptr: &ChannelInfo) -> crate::c_types::derived::COption_u64Z {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().capacity_sats;
+ let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { inner_val.unwrap() }) };
+ local_inner_val
+}
+/// The channel capacity as seen on-chain, if chain lookup is available.
+#[no_mangle]
+pub extern "C" fn ChannelInfo_set_capacity_sats(this_ptr: &mut ChannelInfo, mut val: crate::c_types::derived::COption_u64Z) {
+ let mut local_val = if val.is_some() { Some( { val.take() }) } else { None };
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.capacity_sats = local_val;
+}
+/// An initial announcement of the channel
+/// Mostly redundant with the data we store in fields explicitly.
+/// Everything else is useful only for sending out for initial routing sync.
+/// Not stored if contains excess data to prevent DoS.
+///
+/// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
+#[no_mangle]
+pub extern "C" fn ChannelInfo_get_announcement_message(this_ptr: &ChannelInfo) -> crate::lightning::ln::msgs::ChannelAnnouncement {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().announcement_message;
+ let mut local_inner_val = crate::lightning::ln::msgs::ChannelAnnouncement { inner: unsafe { (if inner_val.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::ln::msgs::ChannelAnnouncement<>) as *mut _ }, is_owned: false };
+ local_inner_val
+}
+/// An initial announcement of the channel
+/// Mostly redundant with the data we store in fields explicitly.
+/// Everything else is useful only for sending out for initial routing sync.
+/// Not stored if contains excess data to prevent DoS.
+///
+/// Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
+#[no_mangle]
+pub extern "C" fn ChannelInfo_set_announcement_message(this_ptr: &mut ChannelInfo, mut val: crate::lightning::ln::msgs::ChannelAnnouncement) {
+ let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_inner()) } }) };
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.announcement_message = local_val;
+}
+impl Clone for ChannelInfo {
+ fn clone(&self) -> Self {
+ Self {
+ inner: if <*mut nativeChannelInfo>::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 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
+}
+#[no_mangle]
+/// Creates a copy of the ChannelInfo
+pub extern "C" fn ChannelInfo_clone(orig: &ChannelInfo) -> ChannelInfo {
+ orig.clone()
+}
+/// Returns a [`ChannelUpdateInfo`] based on the direction implied by the channel_flag.
+///
+/// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
+#[must_use]
+#[no_mangle]
+pub extern "C" fn ChannelInfo_get_directional_info(this_arg: &crate::lightning::routing::gossip::ChannelInfo, mut channel_flags: u8) -> crate::lightning::routing::gossip::ChannelUpdateInfo {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_directional_info(channel_flags);
+ let mut local_ret = crate::lightning::routing::gossip::ChannelUpdateInfo { inner: unsafe { (if ret.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (ret.unwrap()) }) } as *const lightning::routing::gossip::ChannelUpdateInfo<>) as *mut _ }, is_owned: false };
+ local_ret
+}
+
+#[no_mangle]
+/// Serialize the ChannelInfo object into a byte array which can be read by ChannelInfo_read
+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]
+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) })
+}
+#[no_mangle]
+/// Read a ChannelInfo from a byte array, created by ChannelInfo_write
+pub extern "C" fn ChannelInfo_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelInfoDecodeErrorZ {
+ let res: Result<lightning::routing::gossip::ChannelInfo, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
+ let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::gossip::ChannelInfo { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+ local_res
+}
+
+use lightning::routing::gossip::DirectedChannelInfo as nativeDirectedChannelInfoImport;
+pub(crate) type nativeDirectedChannelInfo = nativeDirectedChannelInfoImport<'static>;
+
+/// A wrapper around [`ChannelInfo`] representing information about the channel as directed from a
+/// source node to a target node.
+#[must_use]
+#[repr(C)]
+pub struct DirectedChannelInfo {
+ /// 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 nativeDirectedChannelInfo,
+ /// 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 DirectedChannelInfo {
+ fn drop(&mut self) {
+ if self.is_owned && !<*mut nativeDirectedChannelInfo>::is_null(self.inner) {
+ let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+ }
+ }
+}
+/// Frees any resources used by the DirectedChannelInfo, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn DirectedChannelInfo_free(this_obj: DirectedChannelInfo) { }
+#[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_free_void(this_ptr: *mut c_void) {
+ unsafe { let _ = Box::from_raw(this_ptr as *mut nativeDirectedChannelInfo); }
+}
+#[allow(unused)]
+impl DirectedChannelInfo {
+ pub(crate) fn get_native_ref(&self) -> &'static nativeDirectedChannelInfo {
+ unsafe { &*ObjOps::untweak_ptr(self.inner) }
+ }
+ pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeDirectedChannelInfo {
+ 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 nativeDirectedChannelInfo {
+ assert!(self.is_owned);
+ let ret = ObjOps::untweak_ptr(self.inner);
+ self.inner = core::ptr::null_mut();
+ ret
+ }
+}
+impl Clone for DirectedChannelInfo {
+ fn clone(&self) -> Self {
+ Self {
+ inner: if <*mut nativeDirectedChannelInfo>::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 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
+}
+#[no_mangle]
+/// Creates a copy of the DirectedChannelInfo
+pub extern "C" fn DirectedChannelInfo_clone(orig: &DirectedChannelInfo) -> DirectedChannelInfo {
+ orig.clone()
+}
+/// Returns information for the channel.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn DirectedChannelInfo_channel(this_arg: &crate::lightning::routing::gossip::DirectedChannelInfo) -> crate::lightning::routing::gossip::ChannelInfo {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.channel();
+ crate::lightning::routing::gossip::ChannelInfo { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::routing::gossip::ChannelInfo<>) as *mut _) }, is_owned: false }
+}
+
+/// Returns information for the direction.
+///
+/// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
+#[must_use]
+#[no_mangle]
+pub extern "C" fn DirectedChannelInfo_direction(this_arg: &crate::lightning::routing::gossip::DirectedChannelInfo) -> crate::lightning::routing::gossip::ChannelUpdateInfo {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.direction();
+ let mut local_ret = crate::lightning::routing::gossip::ChannelUpdateInfo { inner: unsafe { (if ret.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (ret.unwrap()) }) } as *const lightning::routing::gossip::ChannelUpdateInfo<>) as *mut _ }, is_owned: false };
+ local_ret
+}
+
+/// Returns the maximum HTLC amount allowed over the channel in the direction.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn DirectedChannelInfo_htlc_maximum_msat(this_arg: &crate::lightning::routing::gossip::DirectedChannelInfo) -> u64 {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.htlc_maximum_msat();
+ ret
+}
+
+/// Returns the [`EffectiveCapacity`] of the channel in the direction.
+///
+/// This is either the total capacity from the funding transaction, if known, or the
+/// `htlc_maximum_msat` for the direction as advertised by the gossip network, if known,
+/// otherwise.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn DirectedChannelInfo_effective_capacity(this_arg: &crate::lightning::routing::gossip::DirectedChannelInfo) -> crate::lightning::routing::gossip::EffectiveCapacity {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.effective_capacity();
+ crate::lightning::routing::gossip::EffectiveCapacity::native_into(ret)
+}
+
+/// The effective capacity of a channel for routing purposes.
+///
+/// While this may be smaller than the actual channel capacity, amounts greater than
+/// [`Self::as_msat`] should not be routed through the channel.
+#[derive(Clone)]
+#[must_use]
+#[repr(C)]
+pub enum EffectiveCapacity {
+ /// The available liquidity in the channel known from being a channel counterparty, and thus a
+ /// direct hop.
+ ExactLiquidity {
+ /// Either the inbound or outbound liquidity depending on the direction, denominated in
+ /// millisatoshi.
+ liquidity_msat: u64,
+ },
+ /// The maximum HTLC amount in one direction as advertised on the gossip network.
+ MaximumHTLC {
+ /// The maximum HTLC amount denominated in millisatoshi.
+ amount_msat: u64,
+ },
+ /// The total capacity of the channel as determined by the funding transaction.
+ Total {
+ /// The funding amount denominated in millisatoshi.
+ capacity_msat: u64,
+ },
+ /// A capacity sufficient to route any payment, typically used for private channels provided by
+ /// an invoice.
+ Infinite,
+ /// A capacity that is unknown possibly because either the chain state is unavailable to know
+ /// the total capacity or the `htlc_maximum_msat` was not advertised on the gossip network.
+ Unknown,
+}
+use lightning::routing::gossip::EffectiveCapacity as EffectiveCapacityImport;
+pub(crate) type nativeEffectiveCapacity = EffectiveCapacityImport;
+
+impl EffectiveCapacity {
+ #[allow(unused)]
+ pub(crate) fn to_native(&self) -> nativeEffectiveCapacity {
+ match self {
+ EffectiveCapacity::ExactLiquidity {ref liquidity_msat, } => {
+ let mut liquidity_msat_nonref = (*liquidity_msat).clone();
+ nativeEffectiveCapacity::ExactLiquidity {
+ liquidity_msat: liquidity_msat_nonref,
+ }
+ },
+ EffectiveCapacity::MaximumHTLC {ref amount_msat, } => {
+ let mut amount_msat_nonref = (*amount_msat).clone();
+ nativeEffectiveCapacity::MaximumHTLC {
+ amount_msat: amount_msat_nonref,
+ }
+ },
+ EffectiveCapacity::Total {ref capacity_msat, } => {
+ let mut capacity_msat_nonref = (*capacity_msat).clone();
+ nativeEffectiveCapacity::Total {
+ capacity_msat: capacity_msat_nonref,
+ }
+ },
+ EffectiveCapacity::Infinite => nativeEffectiveCapacity::Infinite,
+ EffectiveCapacity::Unknown => nativeEffectiveCapacity::Unknown,
+ }
+ }
+ #[allow(unused)]
+ pub(crate) fn into_native(self) -> nativeEffectiveCapacity {
+ match self {
+ EffectiveCapacity::ExactLiquidity {mut liquidity_msat, } => {
+ nativeEffectiveCapacity::ExactLiquidity {
+ liquidity_msat: liquidity_msat,
+ }
+ },
+ EffectiveCapacity::MaximumHTLC {mut amount_msat, } => {
+ nativeEffectiveCapacity::MaximumHTLC {
+ amount_msat: amount_msat,
+ }
+ },
+ EffectiveCapacity::Total {mut capacity_msat, } => {
+ nativeEffectiveCapacity::Total {
+ capacity_msat: capacity_msat,
+ }
+ },
+ EffectiveCapacity::Infinite => nativeEffectiveCapacity::Infinite,
+ EffectiveCapacity::Unknown => nativeEffectiveCapacity::Unknown,
+ }
+ }
+ #[allow(unused)]
+ pub(crate) fn from_native(native: &nativeEffectiveCapacity) -> Self {
+ match native {
+ nativeEffectiveCapacity::ExactLiquidity {ref liquidity_msat, } => {
+ let mut liquidity_msat_nonref = (*liquidity_msat).clone();
+ EffectiveCapacity::ExactLiquidity {
+ liquidity_msat: liquidity_msat_nonref,
+ }
+ },
+ nativeEffectiveCapacity::MaximumHTLC {ref amount_msat, } => {
+ let mut amount_msat_nonref = (*amount_msat).clone();
+ EffectiveCapacity::MaximumHTLC {
+ amount_msat: amount_msat_nonref,
+ }
+ },
+ nativeEffectiveCapacity::Total {ref capacity_msat, } => {
+ let mut capacity_msat_nonref = (*capacity_msat).clone();
+ EffectiveCapacity::Total {
+ capacity_msat: capacity_msat_nonref,
+ }
+ },
+ nativeEffectiveCapacity::Infinite => EffectiveCapacity::Infinite,
+ nativeEffectiveCapacity::Unknown => EffectiveCapacity::Unknown,
+ }
+ }
+ #[allow(unused)]
+ pub(crate) fn native_into(native: nativeEffectiveCapacity) -> Self {
+ match native {
+ nativeEffectiveCapacity::ExactLiquidity {mut liquidity_msat, } => {
+ EffectiveCapacity::ExactLiquidity {
+ liquidity_msat: liquidity_msat,
+ }
+ },
+ nativeEffectiveCapacity::MaximumHTLC {mut amount_msat, } => {
+ EffectiveCapacity::MaximumHTLC {
+ amount_msat: amount_msat,
+ }
+ },
+ nativeEffectiveCapacity::Total {mut capacity_msat, } => {
+ EffectiveCapacity::Total {
+ capacity_msat: capacity_msat,
+ }
+ },
+ nativeEffectiveCapacity::Infinite => EffectiveCapacity::Infinite,
+ nativeEffectiveCapacity::Unknown => EffectiveCapacity::Unknown,
+ }
+ }
+}
+/// Frees any resources used by the EffectiveCapacity
+#[no_mangle]
+pub extern "C" fn EffectiveCapacity_free(this_ptr: EffectiveCapacity) { }
+/// Creates a copy of the EffectiveCapacity
+#[no_mangle]
+pub extern "C" fn EffectiveCapacity_clone(orig: &EffectiveCapacity) -> EffectiveCapacity {
+ orig.clone()
+}
+#[no_mangle]
+/// Utility method to constructs a new ExactLiquidity-variant EffectiveCapacity
+pub extern "C" fn EffectiveCapacity_exact_liquidity(liquidity_msat: u64) -> EffectiveCapacity {
+ EffectiveCapacity::ExactLiquidity {
+ liquidity_msat,
+ }
+}
+#[no_mangle]
+/// Utility method to constructs a new MaximumHTLC-variant EffectiveCapacity
+pub extern "C" fn EffectiveCapacity_maximum_htlc(amount_msat: u64) -> EffectiveCapacity {
+ EffectiveCapacity::MaximumHTLC {
+ amount_msat,
+ }
+}
+#[no_mangle]
+/// Utility method to constructs a new Total-variant EffectiveCapacity
+pub extern "C" fn EffectiveCapacity_total(capacity_msat: u64) -> EffectiveCapacity {
+ EffectiveCapacity::Total {
+ capacity_msat,
+ }
+}
+#[no_mangle]
+/// Utility method to constructs a new Infinite-variant EffectiveCapacity
+pub extern "C" fn EffectiveCapacity_infinite() -> EffectiveCapacity {
+ EffectiveCapacity::Infinite}
+#[no_mangle]
+/// Utility method to constructs a new Unknown-variant EffectiveCapacity
+pub extern "C" fn EffectiveCapacity_unknown() -> EffectiveCapacity {
+ EffectiveCapacity::Unknown}
+/// The presumed channel capacity denominated in millisatoshi for [`EffectiveCapacity::Unknown`] to
+/// use when making routing decisions.
+
+#[no_mangle]
+pub static UNKNOWN_CHANNEL_CAPACITY_MSAT: u64 = lightning::routing::gossip::UNKNOWN_CHANNEL_CAPACITY_MSAT;
+/// Returns the effective capacity denominated in millisatoshi.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn EffectiveCapacity_as_msat(this_arg: &crate::lightning::routing::gossip::EffectiveCapacity) -> u64 {
+ let mut ret = this_arg.to_native().as_msat();
+ ret
+}
+
+
+use lightning::routing::gossip::RoutingFees as nativeRoutingFeesImport;
+pub(crate) type nativeRoutingFees = nativeRoutingFeesImport;
+
+/// Fees for routing via a given channel or a node
+#[must_use]
+#[repr(C)]
+pub struct RoutingFees {
+ /// 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 nativeRoutingFees,
+ /// 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 RoutingFees {
+ fn drop(&mut self) {
+ if self.is_owned && !<*mut nativeRoutingFees>::is_null(self.inner) {
+ let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+ }
+ }
+}
+/// Frees any resources used by the RoutingFees, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn RoutingFees_free(this_obj: RoutingFees) { }
+#[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_free_void(this_ptr: *mut c_void) {
+ unsafe { let _ = Box::from_raw(this_ptr as *mut nativeRoutingFees); }
+}
+#[allow(unused)]
+impl RoutingFees {
+ pub(crate) fn get_native_ref(&self) -> &'static nativeRoutingFees {
+ unsafe { &*ObjOps::untweak_ptr(self.inner) }
+ }
+ pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeRoutingFees {
+ 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 nativeRoutingFees {
+ assert!(self.is_owned);
+ let ret = ObjOps::untweak_ptr(self.inner);
+ self.inner = core::ptr::null_mut();
+ ret
+ }
+}
+/// Flat routing fee in satoshis
+#[no_mangle]
+pub extern "C" fn RoutingFees_get_base_msat(this_ptr: &RoutingFees) -> u32 {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().base_msat;
+ *inner_val
+}
+/// Flat routing fee in satoshis
+#[no_mangle]
+pub extern "C" fn RoutingFees_set_base_msat(this_ptr: &mut RoutingFees, mut val: u32) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.base_msat = val;
+}
+/// Liquidity-based routing fee in millionths of a routed amount.
+/// In other words, 10000 is 1%.
+#[no_mangle]
+pub extern "C" fn RoutingFees_get_proportional_millionths(this_ptr: &RoutingFees) -> u32 {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().proportional_millionths;
+ *inner_val
+}
+/// Liquidity-based routing fee in millionths of a routed amount.
+/// In other words, 10000 is 1%.
+#[no_mangle]
+pub extern "C" fn RoutingFees_set_proportional_millionths(this_ptr: &mut RoutingFees, mut val: u32) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.proportional_millionths = val;
+}
+/// Constructs a new RoutingFees given each field
+#[must_use]
+#[no_mangle]
+pub extern "C" fn RoutingFees_new(mut base_msat_arg: u32, mut proportional_millionths_arg: u32) -> RoutingFees {
+ RoutingFees { inner: ObjOps::heap_alloc(nativeRoutingFees {
+ base_msat: base_msat_arg,
+ proportional_millionths: proportional_millionths_arg,
+ }), is_owned: true }
+}
+/// Checks if two RoutingFeess 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 RoutingFees_eq(a: &RoutingFees, b: &RoutingFees) -> bool {
+ if a.inner == b.inner { return true; }
+ if a.inner.is_null() || b.inner.is_null() { return false; }
+ if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
+impl Clone for RoutingFees {
+ fn clone(&self) -> Self {
+ Self {
+ inner: if <*mut nativeRoutingFees>::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 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
+}
+#[no_mangle]
+/// Creates a copy of the RoutingFees
+pub extern "C" fn RoutingFees_clone(orig: &RoutingFees) -> RoutingFees {
+ orig.clone()
+}
+/// Checks if two RoutingFeess contain equal inner contents.
+#[no_mangle]
+pub extern "C" fn RoutingFees_hash(o: &RoutingFees) -> u64 {
+ if o.inner.is_null() { return 0; }
+ // Note that we'd love to use alloc::collections::hash_map::DefaultHasher but it's not in core
+ #[allow(deprecated)]
+ let mut hasher = core::hash::SipHasher::new();
+ core::hash::Hash::hash(o.get_native_ref(), &mut hasher);
+ core::hash::Hasher::finish(&hasher)
+}
+#[no_mangle]
+/// Serialize the RoutingFees object into a byte array which can be read by RoutingFees_read
+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]
+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) })
+}
+#[no_mangle]
+/// Read a RoutingFees from a byte array, created by RoutingFees_write
+pub extern "C" fn RoutingFees_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_RoutingFeesDecodeErrorZ {
+ let res: Result<lightning::routing::gossip::RoutingFees, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
+ let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::gossip::RoutingFees { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+ local_res
+}
+
+use lightning::routing::gossip::NodeAnnouncementInfo as nativeNodeAnnouncementInfoImport;
+pub(crate) type nativeNodeAnnouncementInfo = nativeNodeAnnouncementInfoImport;
+
+/// Information received in the latest node_announcement from this node.
+#[must_use]
+#[repr(C)]
+pub struct NodeAnnouncementInfo {
+ /// 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 nativeNodeAnnouncementInfo,
+ /// 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 NodeAnnouncementInfo {
+ fn drop(&mut self) {
+ if self.is_owned && !<*mut nativeNodeAnnouncementInfo>::is_null(self.inner) {
+ let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+ }
+ }
+}
+/// Frees any resources used by the NodeAnnouncementInfo, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn NodeAnnouncementInfo_free(this_obj: NodeAnnouncementInfo) { }
+#[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_free_void(this_ptr: *mut c_void) {
+ unsafe { let _ = Box::from_raw(this_ptr as *mut nativeNodeAnnouncementInfo); }
+}
+#[allow(unused)]
+impl NodeAnnouncementInfo {
+ pub(crate) fn get_native_ref(&self) -> &'static nativeNodeAnnouncementInfo {
+ unsafe { &*ObjOps::untweak_ptr(self.inner) }
+ }
+ pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeNodeAnnouncementInfo {
+ 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 nativeNodeAnnouncementInfo {
+ assert!(self.is_owned);
+ let ret = ObjOps::untweak_ptr(self.inner);
+ self.inner = core::ptr::null_mut();
+ ret
+ }
+}
+/// Protocol features the node announced support for
+#[no_mangle]
+pub extern "C" fn NodeAnnouncementInfo_get_features(this_ptr: &NodeAnnouncementInfo) -> crate::lightning::ln::features::NodeFeatures {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().features;
+ crate::lightning::ln::features::NodeFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::features::NodeFeatures<>) as *mut _) }, is_owned: false }
+}
+/// Protocol features the node announced support for
+#[no_mangle]
+pub extern "C" fn NodeAnnouncementInfo_set_features(this_ptr: &mut NodeAnnouncementInfo, mut val: crate::lightning::ln::features::NodeFeatures) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.features = *unsafe { Box::from_raw(val.take_inner()) };
+}
+/// When the last known update to the node state was issued.
+/// Value is opaque, as set in the announcement.
+#[no_mangle]
+pub extern "C" fn NodeAnnouncementInfo_get_last_update(this_ptr: &NodeAnnouncementInfo) -> u32 {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().last_update;
+ *inner_val
+}
+/// When the last known update to the node state was issued.
+/// Value is opaque, as set in the announcement.
+#[no_mangle]
+pub extern "C" fn NodeAnnouncementInfo_set_last_update(this_ptr: &mut NodeAnnouncementInfo, mut val: u32) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.last_update = val;
+}
+/// Color assigned to the node
+#[no_mangle]
+pub extern "C" fn NodeAnnouncementInfo_get_rgb(this_ptr: &NodeAnnouncementInfo) -> *const [u8; 3] {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().rgb;
+ inner_val
+}
+/// Color assigned to the node
+#[no_mangle]
+pub extern "C" fn NodeAnnouncementInfo_set_rgb(this_ptr: &mut NodeAnnouncementInfo, mut val: crate::c_types::ThreeBytes) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.rgb = val.data;
+}
+/// Moniker assigned to the node.
+/// May be invalid or malicious (eg control chars),
+/// should not be exposed to the user.
+#[no_mangle]
+pub extern "C" fn NodeAnnouncementInfo_get_alias(this_ptr: &NodeAnnouncementInfo) -> *const [u8; 32] {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().alias;
+ inner_val
+}
+/// Moniker assigned to the node.
+/// May be invalid or malicious (eg control chars),
+/// should not be exposed to the user.
+#[no_mangle]
+pub extern "C" fn NodeAnnouncementInfo_set_alias(this_ptr: &mut NodeAnnouncementInfo, mut val: crate::c_types::ThirtyTwoBytes) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.alias = val.data;
+}
+/// Internet-level addresses via which one can connect to the node
+#[no_mangle]
+pub extern "C" fn NodeAnnouncementInfo_set_addresses(this_ptr: &mut NodeAnnouncementInfo, mut val: crate::c_types::derived::CVec_NetAddressZ) {
+ let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { item.into_native() }); };
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.addresses = local_val;
+}
+/// An initial announcement of the node
+/// Mostly redundant with the data we store in fields explicitly.
+/// Everything else is useful only for sending out for initial routing sync.
+/// Not stored if contains excess data to prevent DoS.
+///
+/// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
+#[no_mangle]
+pub extern "C" fn NodeAnnouncementInfo_get_announcement_message(this_ptr: &NodeAnnouncementInfo) -> crate::lightning::ln::msgs::NodeAnnouncement {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().announcement_message;
+ let mut local_inner_val = crate::lightning::ln::msgs::NodeAnnouncement { inner: unsafe { (if inner_val.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::ln::msgs::NodeAnnouncement<>) as *mut _ }, is_owned: false };
+ local_inner_val
+}
+/// An initial announcement of the node
+/// Mostly redundant with the data we store in fields explicitly.
+/// Everything else is useful only for sending out for initial routing sync.
+/// Not stored if contains excess data to prevent DoS.
+///
+/// Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
+#[no_mangle]
+pub extern "C" fn NodeAnnouncementInfo_set_announcement_message(this_ptr: &mut NodeAnnouncementInfo, mut val: crate::lightning::ln::msgs::NodeAnnouncement) {
+ let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_inner()) } }) };
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.announcement_message = local_val;
+}
+/// Constructs a new NodeAnnouncementInfo given each field
+#[must_use]
+#[no_mangle]
+pub extern "C" fn NodeAnnouncementInfo_new(mut features_arg: crate::lightning::ln::features::NodeFeatures, mut last_update_arg: u32, mut rgb_arg: crate::c_types::ThreeBytes, mut alias_arg: crate::c_types::ThirtyTwoBytes, mut addresses_arg: crate::c_types::derived::CVec_NetAddressZ, mut announcement_message_arg: crate::lightning::ln::msgs::NodeAnnouncement) -> NodeAnnouncementInfo {
+ let mut local_addresses_arg = Vec::new(); for mut item in addresses_arg.into_rust().drain(..) { local_addresses_arg.push( { item.into_native() }); };
+ let mut local_announcement_message_arg = if announcement_message_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(announcement_message_arg.take_inner()) } }) };
+ NodeAnnouncementInfo { inner: ObjOps::heap_alloc(nativeNodeAnnouncementInfo {
+ features: *unsafe { Box::from_raw(features_arg.take_inner()) },
+ last_update: last_update_arg,
+ rgb: rgb_arg.data,
+ alias: alias_arg.data,
+ addresses: local_addresses_arg,
+ announcement_message: local_announcement_message_arg,
+ }), is_owned: true }
+}
+impl Clone for NodeAnnouncementInfo {
+ fn clone(&self) -> Self {
+ Self {
+ inner: if <*mut nativeNodeAnnouncementInfo>::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 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
+}
+#[no_mangle]
+/// Creates a copy of the NodeAnnouncementInfo
+pub extern "C" fn NodeAnnouncementInfo_clone(orig: &NodeAnnouncementInfo) -> NodeAnnouncementInfo {
+ orig.clone()
+}
+#[no_mangle]
+/// Serialize the NodeAnnouncementInfo object into a byte array which can be read by NodeAnnouncementInfo_read
+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]
+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) })
+}
+#[no_mangle]
+/// Read a NodeAnnouncementInfo from a byte array, created by NodeAnnouncementInfo_write
+pub extern "C" fn NodeAnnouncementInfo_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_NodeAnnouncementInfoDecodeErrorZ {
+ let res: Result<lightning::routing::gossip::NodeAnnouncementInfo, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
+ let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::gossip::NodeAnnouncementInfo { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+ local_res
+}
+
+use lightning::routing::gossip::NodeInfo as nativeNodeInfoImport;
+pub(crate) type nativeNodeInfo = nativeNodeInfoImport;
+
+/// Details about a node in the network, known from the network announcement.
+#[must_use]
+#[repr(C)]
+pub struct NodeInfo {
+ /// 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 nativeNodeInfo,
+ /// 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 NodeInfo {
+ fn drop(&mut self) {
+ if self.is_owned && !<*mut nativeNodeInfo>::is_null(self.inner) {
+ let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+ }
+ }
+}
+/// Frees any resources used by the NodeInfo, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn NodeInfo_free(this_obj: NodeInfo) { }
+#[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_free_void(this_ptr: *mut c_void) {
+ unsafe { let _ = Box::from_raw(this_ptr as *mut nativeNodeInfo); }
+}
+#[allow(unused)]
+impl NodeInfo {
+ pub(crate) fn get_native_ref(&self) -> &'static nativeNodeInfo {
+ unsafe { &*ObjOps::untweak_ptr(self.inner) }
+ }
+ pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeNodeInfo {
+ 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 nativeNodeInfo {
+ assert!(self.is_owned);
+ let ret = ObjOps::untweak_ptr(self.inner);
+ self.inner = core::ptr::null_mut();
+ ret
+ }
+}
+/// All valid channels a node has announced
+#[no_mangle]
+pub extern "C" fn NodeInfo_set_channels(this_ptr: &mut NodeInfo, mut val: crate::c_types::derived::CVec_u64Z) {
+ let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { item }); };
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channels = local_val;
+}
+/// Lowest fees enabling routing via any of the enabled, known channels to a node.
+/// The two fields (flat and proportional fee) are independent,
+/// meaning they don't have to refer to the same channel.
+///
+/// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
+#[no_mangle]
+pub extern "C" fn NodeInfo_get_lowest_inbound_channel_fees(this_ptr: &NodeInfo) -> crate::lightning::routing::gossip::RoutingFees {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().lowest_inbound_channel_fees;
+ let mut local_inner_val = crate::lightning::routing::gossip::RoutingFees { inner: unsafe { (if inner_val.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::routing::gossip::RoutingFees<>) as *mut _ }, is_owned: false };
+ local_inner_val
+}
+/// Lowest fees enabling routing via any of the enabled, known channels to a node.
+/// The two fields (flat and proportional fee) are independent,
+/// meaning they don't have to refer to the same channel.
+///
+/// Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
+#[no_mangle]
+pub extern "C" fn NodeInfo_set_lowest_inbound_channel_fees(this_ptr: &mut NodeInfo, mut val: crate::lightning::routing::gossip::RoutingFees) {
+ let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_inner()) } }) };
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.lowest_inbound_channel_fees = local_val;
+}
+/// More information about a node from node_announcement.
+/// Optional because we store a Node entry after learning about it from
+/// a channel announcement, but before receiving a node announcement.
+///
+/// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
+#[no_mangle]
+pub extern "C" fn NodeInfo_get_announcement_info(this_ptr: &NodeInfo) -> crate::lightning::routing::gossip::NodeAnnouncementInfo {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().announcement_info;
+ let mut local_inner_val = crate::lightning::routing::gossip::NodeAnnouncementInfo { inner: unsafe { (if inner_val.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::routing::gossip::NodeAnnouncementInfo<>) as *mut _ }, is_owned: false };
+ local_inner_val
+}
+/// More information about a node from node_announcement.
+/// Optional because we store a Node entry after learning about it from
+/// a channel announcement, but before receiving a node announcement.
+///
+/// Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
+#[no_mangle]
+pub extern "C" fn NodeInfo_set_announcement_info(this_ptr: &mut NodeInfo, mut val: crate::lightning::routing::gossip::NodeAnnouncementInfo) {
+ let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_inner()) } }) };
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.announcement_info = local_val;
+}
+/// Constructs a new NodeInfo given each field
+#[must_use]
+#[no_mangle]
+pub extern "C" fn NodeInfo_new(mut channels_arg: crate::c_types::derived::CVec_u64Z, mut lowest_inbound_channel_fees_arg: crate::lightning::routing::gossip::RoutingFees, mut announcement_info_arg: crate::lightning::routing::gossip::NodeAnnouncementInfo) -> NodeInfo {
+ let mut local_channels_arg = Vec::new(); for mut item in channels_arg.into_rust().drain(..) { local_channels_arg.push( { item }); };
+ let mut local_lowest_inbound_channel_fees_arg = if lowest_inbound_channel_fees_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(lowest_inbound_channel_fees_arg.take_inner()) } }) };
+ let mut local_announcement_info_arg = if announcement_info_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(announcement_info_arg.take_inner()) } }) };
+ NodeInfo { inner: ObjOps::heap_alloc(nativeNodeInfo {
+ channels: local_channels_arg,
+ lowest_inbound_channel_fees: local_lowest_inbound_channel_fees_arg,
+ announcement_info: local_announcement_info_arg,
+ }), is_owned: true }
+}
+impl Clone for NodeInfo {
+ fn clone(&self) -> Self {
+ Self {
+ inner: if <*mut nativeNodeInfo>::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 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
+}
+#[no_mangle]
+/// Creates a copy of the NodeInfo
+pub extern "C" fn NodeInfo_clone(orig: &NodeInfo) -> NodeInfo {
+ orig.clone()
+}
+#[no_mangle]
+/// Serialize the NodeInfo object into a byte array which can be read by NodeInfo_read
+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]
+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) })
+}
+#[no_mangle]
+/// Read a NodeInfo from a byte array, created by NodeInfo_write
+pub extern "C" fn NodeInfo_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_NodeInfoDecodeErrorZ {
+ let res: Result<lightning::routing::gossip::NodeInfo, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
+ let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::gossip::NodeInfo { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+ local_res
+}
+#[no_mangle]
+/// Serialize the NetworkGraph object into a byte array which can be read by NetworkGraph_read
+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]
+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) })
+}
+#[no_mangle]
+/// Read a NetworkGraph from a byte array, created by NetworkGraph_write
+pub extern "C" fn NetworkGraph_read(ser: crate::c_types::u8slice, arg: crate::lightning::util::logger::Logger) -> crate::c_types::derived::CResult_NetworkGraphDecodeErrorZ {
+ let arg_conv = arg;
+ let res: Result<lightning::routing::gossip::NetworkGraph<crate::lightning::util::logger::Logger>, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj_arg(ser, arg_conv);
+ let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::gossip::NetworkGraph { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+ local_res
+}
+/// Creates a new, empty, network graph.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn NetworkGraph_new(mut genesis_hash: crate::c_types::ThirtyTwoBytes, mut logger: crate::lightning::util::logger::Logger) -> crate::lightning::routing::gossip::NetworkGraph {
+ let mut ret = lightning::routing::gossip::NetworkGraph::new(::bitcoin::hash_types::BlockHash::from_slice(&genesis_hash.data[..]).unwrap(), logger);
+ crate::lightning::routing::gossip::NetworkGraph { inner: ObjOps::heap_alloc(ret), is_owned: true }
+}
+
+/// Returns a read-only view of the network graph.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn NetworkGraph_read_only(this_arg: &crate::lightning::routing::gossip::NetworkGraph) -> crate::lightning::routing::gossip::ReadOnlyNetworkGraph {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.read_only();
+ crate::lightning::routing::gossip::ReadOnlyNetworkGraph { inner: ObjOps::heap_alloc(ret), is_owned: true }
+}
+
+/// The unix timestamp provided by the most recent rapid gossip sync.
+/// It will be set by the rapid sync process after every sync completion.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn NetworkGraph_get_last_rapid_gossip_sync_timestamp(this_arg: &crate::lightning::routing::gossip::NetworkGraph) -> crate::c_types::derived::COption_u32Z {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_last_rapid_gossip_sync_timestamp();
+ let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_u32Z::None } else { crate::c_types::derived::COption_u32Z::Some( { ret.unwrap() }) };
+ local_ret
+}
+
+/// Update the unix timestamp provided by the most recent rapid gossip sync.
+/// This should be done automatically by the rapid sync process after every sync completion.
+#[no_mangle]
+pub extern "C" fn NetworkGraph_set_last_rapid_gossip_sync_timestamp(this_arg: &crate::lightning::routing::gossip::NetworkGraph, mut last_rapid_gossip_sync_timestamp: u32) {
+ unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.set_last_rapid_gossip_sync_timestamp(last_rapid_gossip_sync_timestamp)
+}
+
+/// For an already known node (from channel announcements), update its stored properties from a
+/// given node announcement.
+///
+/// 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.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn NetworkGraph_update_node_from_announcement(this_arg: &crate::lightning::routing::gossip::NetworkGraph, msg: &crate::lightning::ln::msgs::NodeAnnouncement) -> crate::c_types::derived::CResult_NoneLightningErrorZ {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.update_node_from_announcement(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
+}
+
+/// For an already known node (from channel announcements), update its stored properties from a
+/// given node announcement without verifying the associated signatures. Because we aren't
+/// given the associated signatures here we cannot relay the node announcement to any of our
+/// peers.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn NetworkGraph_update_node_from_unsigned_announcement(this_arg: &crate::lightning::routing::gossip::NetworkGraph, msg: &crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> crate::c_types::derived::CResult_NoneLightningErrorZ {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.update_node_from_unsigned_announcement(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
+}
+
+/// Store or update channel info from a channel announcement.
+///
+/// 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 a `chain::Access` object is provided via `chain_access`, it will be called to verify
+/// the corresponding UTXO exists on chain and is correctly-formatted.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn NetworkGraph_update_channel_from_announcement(this_arg: &crate::lightning::routing::gossip::NetworkGraph, msg: &crate::lightning::ln::msgs::ChannelAnnouncement, mut chain_access: crate::c_types::derived::COption_AccessZ) -> crate::c_types::derived::CResult_NoneLightningErrorZ {
+ let mut local_chain_access = { /* chain_access*/ let chain_access_opt = chain_access; { } if chain_access_opt.is_none() { None } else { Some({ chain_access_opt.take() }) } };
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.update_channel_from_announcement(msg.get_native_ref(), &local_chain_access);
+ 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
+}
+
+/// Store or update channel info from a channel announcement without verifying the associated
+/// signatures. Because we aren't given the associated signatures here we cannot relay the
+/// channel announcement to any of our peers.
+///
+/// If a `chain::Access` object is provided via `chain_access`, it will be called to verify
+/// the corresponding UTXO exists on chain and is correctly-formatted.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn NetworkGraph_update_channel_from_unsigned_announcement(this_arg: &crate::lightning::routing::gossip::NetworkGraph, msg: &crate::lightning::ln::msgs::UnsignedChannelAnnouncement, mut chain_access: crate::c_types::derived::COption_AccessZ) -> crate::c_types::derived::CResult_NoneLightningErrorZ {
+ let mut local_chain_access = { /* chain_access*/ let chain_access_opt = chain_access; { } if chain_access_opt.is_none() { None } else { Some({ chain_access_opt.take() }) } };
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.update_channel_from_unsigned_announcement(msg.get_native_ref(), &local_chain_access);
+ 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
+}
+
+/// Update channel from partial announcement data received via rapid gossip sync
+///
+/// `timestamp: u64`: Timestamp emulating the backdated original announcement receipt (by the
+/// rapid gossip sync server)
+///
+/// All other parameters as used in [`msgs::UnsignedChannelAnnouncement`] fields.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn NetworkGraph_add_channel_from_partial_announcement(this_arg: &crate::lightning::routing::gossip::NetworkGraph, mut short_channel_id: u64, mut timestamp: u64, mut features: crate::lightning::ln::features::ChannelFeatures, mut node_id_1: crate::c_types::PublicKey, mut node_id_2: crate::c_types::PublicKey) -> crate::c_types::derived::CResult_NoneLightningErrorZ {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.add_channel_from_partial_announcement(short_channel_id, timestamp, *unsafe { Box::from_raw(features.take_inner()) }, node_id_1.into_rust(), node_id_2.into_rust());
+ 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
+}
+
+/// Marks a channel in the graph as failed if a corresponding HTLC fail was sent.
+/// If permanent, removes a channel from the local storage.
+/// May cause the removal of nodes too, if this was their last channel.
+/// If not permanent, makes channels unavailable for routing.
+#[no_mangle]
+pub extern "C" fn NetworkGraph_channel_failed(this_arg: &crate::lightning::routing::gossip::NetworkGraph, mut short_channel_id: u64, mut is_permanent: bool) {
+ unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.channel_failed(short_channel_id, is_permanent)
+}
+
+/// Marks a node in the graph as failed.
+#[no_mangle]
+pub extern "C" fn NetworkGraph_node_failed(this_arg: &crate::lightning::routing::gossip::NetworkGraph, mut _node_id: crate::c_types::PublicKey, mut is_permanent: bool) {
+ unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.node_failed(&_node_id.into_rust(), is_permanent)
+}
+
+/// Removes information about channels that we haven't heard any updates about in some time.
+/// This can be used regularly to prune the network graph of channels that likely no longer
+/// exist.
+///
+/// While there is no formal requirement that nodes regularly re-broadcast their channel
+/// updates every two weeks, the non-normative section of BOLT 7 currently suggests that
+/// pruning occur for updates which are at least two weeks old, which we implement here.
+///
+/// Note that for users of the `lightning-background-processor` crate this method may be
+/// automatically called regularly for you.
+///
+/// This method is only available with the `std` feature. See
+/// [`NetworkGraph::remove_stale_channels_with_time`] for `no-std` use.
+#[no_mangle]
+pub extern "C" fn NetworkGraph_remove_stale_channels(this_arg: &crate::lightning::routing::gossip::NetworkGraph) {
+ unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.remove_stale_channels()
+}
+
+/// Removes information about channels that we haven't heard any updates about in some time.
+/// This can be used regularly to prune the network graph of channels that likely no longer
+/// exist.
+///
+/// While there is no formal requirement that nodes regularly re-broadcast their channel
+/// updates every two weeks, the non-normative section of BOLT 7 currently suggests that
+/// pruning occur for updates which are at least two weeks old, which we implement here.
+///
+/// This function takes the current unix time as an argument. For users with the `std` feature
+/// enabled, [`NetworkGraph::remove_stale_channels`] may be preferable.
+#[no_mangle]
+pub extern "C" fn NetworkGraph_remove_stale_channels_with_time(this_arg: &crate::lightning::routing::gossip::NetworkGraph, mut current_time_unix: u64) {
+ unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.remove_stale_channels_with_time(current_time_unix)
+}
+
+/// For an already known (from announcement) channel, update info about one of the directions
+/// of the channel.
+///
+/// You probably don't want to call this directly, instead relying on a 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
+/// materially in the future will be rejected.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn NetworkGraph_update_channel(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) }.update_channel(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
+}
+
+/// For an already known (from announcement) channel, update info about one of the directions
+/// of the channel without verifying the associated signatures. Because we aren't given the
+/// associated signatures here we cannot relay the channel update to any of our peers.
+///
+/// If built with `no-std`, any updates with a timestamp more than two weeks in the past or
+/// materially in the future will be rejected.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn NetworkGraph_update_channel_unsigned(this_arg: &crate::lightning::routing::gossip::NetworkGraph, msg: &crate::lightning::ln::msgs::UnsignedChannelUpdate) -> crate::c_types::derived::CResult_NoneLightningErrorZ {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.update_channel_unsigned(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
+}
+
+/// Get network addresses by node id.
+/// Returns None if the requested node is completely unknown,
+/// or if node announcement for the node was never received.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn ReadOnlyNetworkGraph_get_addresses(this_arg: &crate::lightning::routing::gossip::ReadOnlyNetworkGraph, mut pubkey: crate::c_types::PublicKey) -> crate::c_types::derived::COption_CVec_NetAddressZZ {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_addresses(&pubkey.into_rust());
+ let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_CVec_NetAddressZZ::None } else { crate::c_types::derived::COption_CVec_NetAddressZZ::Some( { let mut local_ret_0 = Vec::new(); for mut item in ret.unwrap().drain(..) { local_ret_0.push( { crate::lightning::ln::msgs::NetAddress::native_into(item) }); }; local_ret_0.into() }) };
+ local_ret
+}
+
#[cfg(feature="no-std")]
use alloc::{vec::Vec, boxed::Box};
-pub mod network_graph;
+pub mod gossip;
pub mod router;
pub mod scoring;
+++ /dev/null
-// This file is Copyright its original authors, visible in version control
-// history and in the source files from which this was generated.
-//
-// This file is licensed under the license available in the LICENSE or LICENSE.md
-// file in the root of this repository or, if no such file exists, the same
-// license as that which applies to the original source files from which this
-// source was automatically generated.
-
-//! The top-level network map tracking logic lives here.
-
-use alloc::str::FromStr;
-use core::ffi::c_void;
-use core::convert::Infallible;
-use bitcoin::hashes::Hash;
-use crate::c_types::*;
-#[cfg(feature="no-std")]
-use alloc::{vec::Vec, boxed::Box};
-
-
-use lightning::routing::network_graph::NodeId as nativeNodeIdImport;
-pub(crate) type nativeNodeId = nativeNodeIdImport;
-
-/// Represents the compressed public key of a node
-#[must_use]
-#[repr(C)]
-pub struct NodeId {
- /// 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 nativeNodeId,
- /// 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 NodeId {
- fn drop(&mut self) {
- if self.is_owned && !<*mut nativeNodeId>::is_null(self.inner) {
- let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
- }
- }
-}
-/// Frees any resources used by the NodeId, if is_owned is set and inner is non-NULL.
-#[no_mangle]
-pub extern "C" fn NodeId_free(this_obj: NodeId) { }
-#[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_free_void(this_ptr: *mut c_void) {
- unsafe { let _ = Box::from_raw(this_ptr as *mut nativeNodeId); }
-}
-#[allow(unused)]
-impl NodeId {
- pub(crate) fn get_native_ref(&self) -> &'static nativeNodeId {
- unsafe { &*ObjOps::untweak_ptr(self.inner) }
- }
- pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeNodeId {
- 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 nativeNodeId {
- assert!(self.is_owned);
- let ret = ObjOps::untweak_ptr(self.inner);
- self.inner = core::ptr::null_mut();
- ret
- }
-}
-impl Clone for NodeId {
- fn clone(&self) -> Self {
- Self {
- inner: if <*mut nativeNodeId>::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 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
-}
-#[no_mangle]
-/// Creates a copy of the NodeId
-pub extern "C" fn NodeId_clone(orig: &NodeId) -> NodeId {
- orig.clone()
-}
-/// Create a new NodeId from a public key
-#[must_use]
-#[no_mangle]
-pub extern "C" fn NodeId_from_pubkey(mut pubkey: crate::c_types::PublicKey) -> crate::lightning::routing::network_graph::NodeId {
- let mut ret = lightning::routing::network_graph::NodeId::from_pubkey(&pubkey.into_rust());
- crate::lightning::routing::network_graph::NodeId { inner: ObjOps::heap_alloc(ret), is_owned: true }
-}
-
-/// Get the public key slice from this NodeId
-#[must_use]
-#[no_mangle]
-pub extern "C" fn NodeId_as_slice(this_arg: &crate::lightning::routing::network_graph::NodeId) -> crate::c_types::u8slice {
- let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.as_slice();
- let mut local_ret = crate::c_types::u8slice::from_slice(ret);
- local_ret
-}
-
-/// Checks if two NodeIds contain equal inner contents.
-#[no_mangle]
-pub extern "C" fn NodeId_hash(o: &NodeId) -> u64 {
- if o.inner.is_null() { return 0; }
- // Note that we'd love to use alloc::collections::hash_map::DefaultHasher but it's not in core
- #[allow(deprecated)]
- let mut hasher = core::hash::SipHasher::new();
- core::hash::Hash::hash(o.get_native_ref(), &mut hasher);
- core::hash::Hasher::finish(&hasher)
-}
-#[no_mangle]
-/// Serialize the NodeId object into a byte array which can be read by NodeId_read
-pub extern "C" fn NodeId_write(obj: &crate::lightning::routing::network_graph::NodeId) -> crate::c_types::derived::CVec_u8Z {
- crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
-}
-#[no_mangle]
-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) })
-}
-#[no_mangle]
-/// Read a NodeId from a byte array, created by NodeId_write
-pub extern "C" fn NodeId_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_NodeIdDecodeErrorZ {
- let res: Result<lightning::routing::network_graph::NodeId, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
- let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::network_graph::NodeId { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
- local_res
-}
-
-use lightning::routing::network_graph::NetworkGraph as nativeNetworkGraphImport;
-pub(crate) type nativeNetworkGraph = nativeNetworkGraphImport;
-
-/// Represents the network as nodes and channels between them
-#[must_use]
-#[repr(C)]
-pub struct NetworkGraph {
- /// 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 nativeNetworkGraph,
- /// 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 NetworkGraph {
- fn drop(&mut self) {
- if self.is_owned && !<*mut nativeNetworkGraph>::is_null(self.inner) {
- let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
- }
- }
-}
-/// Frees any resources used by the NetworkGraph, if is_owned is set and inner is non-NULL.
-#[no_mangle]
-pub extern "C" fn NetworkGraph_free(this_obj: NetworkGraph) { }
-#[allow(unused)]
-/// Used only if an object of this type is returned as a trait impl by a method
-pub(crate) extern "C" fn NetworkGraph_free_void(this_ptr: *mut c_void) {
- unsafe { let _ = Box::from_raw(this_ptr as *mut nativeNetworkGraph); }
-}
-#[allow(unused)]
-impl NetworkGraph {
- pub(crate) fn get_native_ref(&self) -> &'static nativeNetworkGraph {
- unsafe { &*ObjOps::untweak_ptr(self.inner) }
- }
- pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeNetworkGraph {
- 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 nativeNetworkGraph {
- assert!(self.is_owned);
- let ret = ObjOps::untweak_ptr(self.inner);
- self.inner = core::ptr::null_mut();
- ret
- }
-}
-impl Clone for NetworkGraph {
- fn clone(&self) -> Self {
- Self {
- inner: if <*mut nativeNetworkGraph>::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 NetworkGraph_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeNetworkGraph)).clone() })) as *mut c_void
-}
-#[no_mangle]
-/// Creates a copy of the NetworkGraph
-pub extern "C" fn NetworkGraph_clone(orig: &NetworkGraph) -> NetworkGraph {
- orig.clone()
-}
-
-use lightning::routing::network_graph::ReadOnlyNetworkGraph as nativeReadOnlyNetworkGraphImport;
-pub(crate) type nativeReadOnlyNetworkGraph = nativeReadOnlyNetworkGraphImport<'static>;
-
-/// A read-only view of [`NetworkGraph`].
-#[must_use]
-#[repr(C)]
-pub struct ReadOnlyNetworkGraph {
- /// 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 nativeReadOnlyNetworkGraph,
- /// 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 ReadOnlyNetworkGraph {
- fn drop(&mut self) {
- if self.is_owned && !<*mut nativeReadOnlyNetworkGraph>::is_null(self.inner) {
- let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
- }
- }
-}
-/// Frees any resources used by the ReadOnlyNetworkGraph, if is_owned is set and inner is non-NULL.
-#[no_mangle]
-pub extern "C" fn ReadOnlyNetworkGraph_free(this_obj: ReadOnlyNetworkGraph) { }
-#[allow(unused)]
-/// Used only if an object of this type is returned as a trait impl by a method
-pub(crate) extern "C" fn ReadOnlyNetworkGraph_free_void(this_ptr: *mut c_void) {
- unsafe { let _ = Box::from_raw(this_ptr as *mut nativeReadOnlyNetworkGraph); }
-}
-#[allow(unused)]
-impl ReadOnlyNetworkGraph {
- pub(crate) fn get_native_ref(&self) -> &'static nativeReadOnlyNetworkGraph {
- unsafe { &*ObjOps::untweak_ptr(self.inner) }
- }
- pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeReadOnlyNetworkGraph {
- 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 nativeReadOnlyNetworkGraph {
- assert!(self.is_owned);
- let ret = ObjOps::untweak_ptr(self.inner);
- self.inner = core::ptr::null_mut();
- ret
- }
-}
-/// Update to the [`NetworkGraph`] based on payment failure information conveyed via the Onion
-/// return packet by a node along the route. See [BOLT #4] for details.
-///
-/// [BOLT #4]: https://github.com/lightningnetwork/lightning-rfc/blob/master/04-onion-routing.md
-#[must_use]
-#[derive(Clone)]
-#[repr(C)]
-pub enum NetworkUpdate {
- /// An error indicating a `channel_update` messages should be applied via
- /// [`NetworkGraph::update_channel`].
- ChannelUpdateMessage {
- /// The update to apply via [`NetworkGraph::update_channel`].
- msg: crate::lightning::ln::msgs::ChannelUpdate,
- },
- /// An error indicating only that a channel has been closed, which should be applied via
- /// [`NetworkGraph::close_channel_from_update`].
- ChannelClosed {
- /// The short channel id of the closed channel.
- short_channel_id: u64,
- /// Whether the channel should be permanently removed or temporarily disabled until a new
- /// `channel_update` message is received.
- is_permanent: bool,
- },
- /// An error indicating only that a node has failed, which should be applied via
- /// [`NetworkGraph::fail_node`].
- NodeFailure {
- /// The node id of the failed node.
- node_id: crate::c_types::PublicKey,
- /// Whether the node should be permanently removed from consideration or can be restored
- /// when a new `channel_update` message is received.
- is_permanent: bool,
- },
-}
-use lightning::routing::network_graph::NetworkUpdate as nativeNetworkUpdate;
-impl NetworkUpdate {
- #[allow(unused)]
- pub(crate) fn to_native(&self) -> nativeNetworkUpdate {
- match self {
- NetworkUpdate::ChannelUpdateMessage {ref msg, } => {
- let mut msg_nonref = (*msg).clone();
- nativeNetworkUpdate::ChannelUpdateMessage {
- msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) },
- }
- },
- NetworkUpdate::ChannelClosed {ref short_channel_id, ref is_permanent, } => {
- let mut short_channel_id_nonref = (*short_channel_id).clone();
- let mut is_permanent_nonref = (*is_permanent).clone();
- nativeNetworkUpdate::ChannelClosed {
- short_channel_id: short_channel_id_nonref,
- is_permanent: is_permanent_nonref,
- }
- },
- NetworkUpdate::NodeFailure {ref node_id, ref is_permanent, } => {
- let mut node_id_nonref = (*node_id).clone();
- let mut is_permanent_nonref = (*is_permanent).clone();
- nativeNetworkUpdate::NodeFailure {
- node_id: node_id_nonref.into_rust(),
- is_permanent: is_permanent_nonref,
- }
- },
- }
- }
- #[allow(unused)]
- pub(crate) fn into_native(self) -> nativeNetworkUpdate {
- match self {
- NetworkUpdate::ChannelUpdateMessage {mut msg, } => {
- nativeNetworkUpdate::ChannelUpdateMessage {
- msg: *unsafe { Box::from_raw(msg.take_inner()) },
- }
- },
- NetworkUpdate::ChannelClosed {mut short_channel_id, mut is_permanent, } => {
- nativeNetworkUpdate::ChannelClosed {
- short_channel_id: short_channel_id,
- is_permanent: is_permanent,
- }
- },
- NetworkUpdate::NodeFailure {mut node_id, mut is_permanent, } => {
- nativeNetworkUpdate::NodeFailure {
- node_id: node_id.into_rust(),
- is_permanent: is_permanent,
- }
- },
- }
- }
- #[allow(unused)]
- pub(crate) fn from_native(native: &nativeNetworkUpdate) -> Self {
- match native {
- nativeNetworkUpdate::ChannelUpdateMessage {ref msg, } => {
- let mut msg_nonref = (*msg).clone();
- NetworkUpdate::ChannelUpdateMessage {
- msg: crate::lightning::ln::msgs::ChannelUpdate { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true },
- }
- },
- nativeNetworkUpdate::ChannelClosed {ref short_channel_id, ref is_permanent, } => {
- let mut short_channel_id_nonref = (*short_channel_id).clone();
- let mut is_permanent_nonref = (*is_permanent).clone();
- NetworkUpdate::ChannelClosed {
- short_channel_id: short_channel_id_nonref,
- is_permanent: is_permanent_nonref,
- }
- },
- nativeNetworkUpdate::NodeFailure {ref node_id, ref is_permanent, } => {
- let mut node_id_nonref = (*node_id).clone();
- let mut is_permanent_nonref = (*is_permanent).clone();
- NetworkUpdate::NodeFailure {
- node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref),
- is_permanent: is_permanent_nonref,
- }
- },
- }
- }
- #[allow(unused)]
- pub(crate) fn native_into(native: nativeNetworkUpdate) -> Self {
- match native {
- nativeNetworkUpdate::ChannelUpdateMessage {mut msg, } => {
- NetworkUpdate::ChannelUpdateMessage {
- msg: crate::lightning::ln::msgs::ChannelUpdate { inner: ObjOps::heap_alloc(msg), is_owned: true },
- }
- },
- nativeNetworkUpdate::ChannelClosed {mut short_channel_id, mut is_permanent, } => {
- NetworkUpdate::ChannelClosed {
- short_channel_id: short_channel_id,
- is_permanent: is_permanent,
- }
- },
- nativeNetworkUpdate::NodeFailure {mut node_id, mut is_permanent, } => {
- NetworkUpdate::NodeFailure {
- node_id: crate::c_types::PublicKey::from_rust(&node_id),
- is_permanent: is_permanent,
- }
- },
- }
- }
-}
-/// Frees any resources used by the NetworkUpdate
-#[no_mangle]
-pub extern "C" fn NetworkUpdate_free(this_ptr: NetworkUpdate) { }
-/// Creates a copy of the NetworkUpdate
-#[no_mangle]
-pub extern "C" fn NetworkUpdate_clone(orig: &NetworkUpdate) -> NetworkUpdate {
- orig.clone()
-}
-#[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 {
- NetworkUpdate::ChannelUpdateMessage {
- msg,
- }
-}
-#[no_mangle]
-/// Utility method to constructs a new ChannelClosed-variant NetworkUpdate
-pub extern "C" fn NetworkUpdate_channel_closed(short_channel_id: u64, is_permanent: bool) -> NetworkUpdate {
- NetworkUpdate::ChannelClosed {
- short_channel_id,
- is_permanent,
- }
-}
-#[no_mangle]
-/// Utility method to constructs a new NodeFailure-variant NetworkUpdate
-pub extern "C" fn NetworkUpdate_node_failure(node_id: crate::c_types::PublicKey, is_permanent: bool) -> NetworkUpdate {
- NetworkUpdate::NodeFailure {
- node_id,
- is_permanent,
- }
-}
-#[no_mangle]
-/// Serialize the NetworkUpdate object into a byte array which can be read by NetworkUpdate_read
-pub extern "C" fn NetworkUpdate_write(obj: &crate::lightning::routing::network_graph::NetworkUpdate) -> crate::c_types::derived::CVec_u8Z {
- crate::c_types::serialize_obj(&unsafe { &*obj }.to_native())
-}
-#[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 {
- let res: Result<Option<lightning::routing::network_graph::NetworkUpdate>, lightning::ln::msgs::DecodeError> = crate::c_types::maybe_deserialize_obj(ser);
- let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { let mut local_res_0 = if o.is_none() { crate::c_types::derived::COption_NetworkUpdateZ::None } else { crate::c_types::derived::COption_NetworkUpdateZ::Some( { crate::lightning::routing::network_graph::NetworkUpdate::native_into(o.unwrap()) }) }; local_res_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
- local_res
-}
-impl From<nativeNetGraphMsgHandler> for crate::lightning::util::events::EventHandler {
- fn from(obj: nativeNetGraphMsgHandler) -> Self {
- let mut rust_obj = NetGraphMsgHandler { inner: ObjOps::heap_alloc(obj), is_owned: true };
- let mut ret = NetGraphMsgHandler_as_EventHandler(&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(NetGraphMsgHandler_free_void);
- ret
- }
-}
-/// Constructs a new EventHandler which calls the relevant methods on this_arg.
-/// This copies the `inner` pointer in this_arg and thus the returned EventHandler must be freed before this_arg is
-#[no_mangle]
-pub extern "C" fn NetGraphMsgHandler_as_EventHandler(this_arg: &NetGraphMsgHandler) -> crate::lightning::util::events::EventHandler {
- crate::lightning::util::events::EventHandler {
- this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void },
- free: None,
- handle_event: NetGraphMsgHandler_EventHandler_handle_event,
- }
-}
-
-extern "C" fn NetGraphMsgHandler_EventHandler_handle_event(this_arg: *const c_void, event: &crate::lightning::util::events::Event) {
- <nativeNetGraphMsgHandler as lightning::util::events::EventHandler<>>::handle_event(unsafe { &mut *(this_arg as *mut nativeNetGraphMsgHandler) }, &event.to_native())
-}
-
-
-use lightning::routing::network_graph::NetGraphMsgHandler as nativeNetGraphMsgHandlerImport;
-pub(crate) type nativeNetGraphMsgHandler = nativeNetGraphMsgHandlerImport<&'static lightning::routing::network_graph::NetworkGraph, crate::lightning::chain::Access, crate::lightning::util::logger::Logger>;
-
-/// Receives and validates network updates from peers,
-/// stores authentic and relevant data as a network graph.
-/// This network graph is then used for routing payments.
-/// Provides interface to help with initial routing sync by
-/// serving historical announcements.
-///
-/// Serves as an [`EventHandler`] for applying updates from [`Event::PaymentPathFailed`] to the
-/// [`NetworkGraph`].
-#[must_use]
-#[repr(C)]
-pub struct NetGraphMsgHandler {
- /// 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 nativeNetGraphMsgHandler,
- /// 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 NetGraphMsgHandler {
- fn drop(&mut self) {
- if self.is_owned && !<*mut nativeNetGraphMsgHandler>::is_null(self.inner) {
- let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
- }
- }
-}
-/// Frees any resources used by the NetGraphMsgHandler, if is_owned is set and inner is non-NULL.
-#[no_mangle]
-pub extern "C" fn NetGraphMsgHandler_free(this_obj: NetGraphMsgHandler) { }
-#[allow(unused)]
-/// Used only if an object of this type is returned as a trait impl by a method
-pub(crate) extern "C" fn NetGraphMsgHandler_free_void(this_ptr: *mut c_void) {
- unsafe { let _ = Box::from_raw(this_ptr as *mut nativeNetGraphMsgHandler); }
-}
-#[allow(unused)]
-impl NetGraphMsgHandler {
- pub(crate) fn get_native_ref(&self) -> &'static nativeNetGraphMsgHandler {
- unsafe { &*ObjOps::untweak_ptr(self.inner) }
- }
- pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeNetGraphMsgHandler {
- 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 nativeNetGraphMsgHandler {
- assert!(self.is_owned);
- let ret = ObjOps::untweak_ptr(self.inner);
- self.inner = core::ptr::null_mut();
- ret
- }
-}
-/// Creates a new tracker of the actual state of the network of channels and nodes,
-/// assuming an existing Network Graph.
-/// Chain monitor is used to make sure announced channels exist on-chain,
-/// channel data is correct, and that the announcement is signed with
-/// channel owners' keys.
-#[must_use]
-#[no_mangle]
-pub extern "C" fn NetGraphMsgHandler_new(network_graph: &crate::lightning::routing::network_graph::NetworkGraph, mut chain_access: crate::c_types::derived::COption_AccessZ, mut logger: crate::lightning::util::logger::Logger) -> crate::lightning::routing::network_graph::NetGraphMsgHandler {
- let mut local_chain_access = { /* chain_access*/ let chain_access_opt = chain_access; { } if chain_access_opt.is_none() { None } else { Some({ chain_access_opt.take() }) } };
- let mut ret = lightning::routing::network_graph::NetGraphMsgHandler::new(network_graph.get_native_ref(), local_chain_access, logger);
- crate::lightning::routing::network_graph::NetGraphMsgHandler { inner: ObjOps::heap_alloc(ret), is_owned: true }
-}
-
-/// Adds a provider used to check new announcements. Does not affect
-/// existing announcements unless they are updated.
-/// Add, update or remove the provider would replace the current one.
-#[no_mangle]
-pub extern "C" fn NetGraphMsgHandler_add_chain_access(this_arg: &mut crate::lightning::routing::network_graph::NetGraphMsgHandler, mut chain_access: crate::c_types::derived::COption_AccessZ) {
- let mut local_chain_access = { /* chain_access*/ let chain_access_opt = chain_access; { } if chain_access_opt.is_none() { None } else { Some({ chain_access_opt.take() }) } };
- unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::routing::network_graph::nativeNetGraphMsgHandler)) }.add_chain_access(local_chain_access)
-}
-
-impl From<nativeNetGraphMsgHandler> for crate::lightning::ln::msgs::RoutingMessageHandler {
- fn from(obj: nativeNetGraphMsgHandler) -> Self {
- let mut rust_obj = NetGraphMsgHandler { inner: ObjOps::heap_alloc(obj), is_owned: true };
- let mut ret = NetGraphMsgHandler_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();
- ret.free = Some(NetGraphMsgHandler_free_void);
- ret
- }
-}
-/// Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
-/// This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
-#[no_mangle]
-pub extern "C" fn NetGraphMsgHandler_as_RoutingMessageHandler(this_arg: &NetGraphMsgHandler) -> crate::lightning::ln::msgs::RoutingMessageHandler {
- crate::lightning::ln::msgs::RoutingMessageHandler {
- this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void },
- free: None,
- handle_node_announcement: NetGraphMsgHandler_RoutingMessageHandler_handle_node_announcement,
- handle_channel_announcement: NetGraphMsgHandler_RoutingMessageHandler_handle_channel_announcement,
- handle_channel_update: NetGraphMsgHandler_RoutingMessageHandler_handle_channel_update,
- get_next_channel_announcements: NetGraphMsgHandler_RoutingMessageHandler_get_next_channel_announcements,
- get_next_node_announcements: NetGraphMsgHandler_RoutingMessageHandler_get_next_node_announcements,
- peer_connected: NetGraphMsgHandler_RoutingMessageHandler_peer_connected,
- handle_reply_channel_range: NetGraphMsgHandler_RoutingMessageHandler_handle_reply_channel_range,
- handle_reply_short_channel_ids_end: NetGraphMsgHandler_RoutingMessageHandler_handle_reply_short_channel_ids_end,
- handle_query_channel_range: NetGraphMsgHandler_RoutingMessageHandler_handle_query_channel_range,
- handle_query_short_channel_ids: NetGraphMsgHandler_RoutingMessageHandler_handle_query_short_channel_ids,
- MessageSendEventsProvider: crate::lightning::util::events::MessageSendEventsProvider {
- this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void },
- free: None,
- get_and_clear_pending_msg_events: NetGraphMsgHandler_MessageSendEventsProvider_get_and_clear_pending_msg_events,
- },
- }
-}
-
-#[must_use]
-extern "C" fn NetGraphMsgHandler_RoutingMessageHandler_handle_node_announcement(this_arg: *const c_void, msg: &crate::lightning::ln::msgs::NodeAnnouncement) -> crate::c_types::derived::CResult_boolLightningErrorZ {
- let mut ret = <nativeNetGraphMsgHandler as lightning::ln::msgs::RoutingMessageHandler<>>::handle_node_announcement(unsafe { &mut *(this_arg as *mut nativeNetGraphMsgHandler) }, 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
-}
-#[must_use]
-extern "C" fn NetGraphMsgHandler_RoutingMessageHandler_handle_channel_announcement(this_arg: *const c_void, msg: &crate::lightning::ln::msgs::ChannelAnnouncement) -> crate::c_types::derived::CResult_boolLightningErrorZ {
- let mut ret = <nativeNetGraphMsgHandler as lightning::ln::msgs::RoutingMessageHandler<>>::handle_channel_announcement(unsafe { &mut *(this_arg as *mut nativeNetGraphMsgHandler) }, 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
-}
-#[must_use]
-extern "C" fn NetGraphMsgHandler_RoutingMessageHandler_handle_channel_update(this_arg: *const c_void, msg: &crate::lightning::ln::msgs::ChannelUpdate) -> crate::c_types::derived::CResult_boolLightningErrorZ {
- let mut ret = <nativeNetGraphMsgHandler as lightning::ln::msgs::RoutingMessageHandler<>>::handle_channel_update(unsafe { &mut *(this_arg as *mut nativeNetGraphMsgHandler) }, 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
-}
-#[must_use]
-extern "C" fn NetGraphMsgHandler_RoutingMessageHandler_get_next_channel_announcements(this_arg: *const c_void, mut starting_point: u64, mut batch_amount: u8) -> crate::c_types::derived::CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
- let mut ret = <nativeNetGraphMsgHandler as lightning::ln::msgs::RoutingMessageHandler<>>::get_next_channel_announcements(unsafe { &mut *(this_arg as *mut nativeNetGraphMsgHandler) }, starting_point, batch_amount);
- 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_1 = crate::lightning::ln::msgs::ChannelUpdate { inner: if orig_ret_0_1.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((orig_ret_0_1.unwrap())) } }, is_owned: true }; let mut local_orig_ret_0_2 = crate::lightning::ln::msgs::ChannelUpdate { 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::ln::msgs::ChannelAnnouncement { inner: ObjOps::heap_alloc(orig_ret_0_0), is_owned: true }, local_orig_ret_0_1, local_orig_ret_0_2).into(); local_ret_0 }); };
- local_ret.into()
-}
-#[must_use]
-extern "C" fn NetGraphMsgHandler_RoutingMessageHandler_get_next_node_announcements(this_arg: *const c_void, mut starting_point: crate::c_types::PublicKey, mut batch_amount: u8) -> crate::c_types::derived::CVec_NodeAnnouncementZ {
- let mut local_starting_point_base = if starting_point.is_null() { None } else { Some( { starting_point.into_rust() }) }; let mut local_starting_point = local_starting_point_base.as_ref();
- let mut ret = <nativeNetGraphMsgHandler as lightning::ln::msgs::RoutingMessageHandler<>>::get_next_node_announcements(unsafe { &mut *(this_arg as *mut nativeNetGraphMsgHandler) }, local_starting_point, batch_amount);
- let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning::ln::msgs::NodeAnnouncement { inner: ObjOps::heap_alloc(item), is_owned: true } }); };
- local_ret.into()
-}
-extern "C" fn NetGraphMsgHandler_RoutingMessageHandler_peer_connected(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, init_msg: &crate::lightning::ln::msgs::Init) {
- <nativeNetGraphMsgHandler as lightning::ln::msgs::RoutingMessageHandler<>>::peer_connected(unsafe { &mut *(this_arg as *mut nativeNetGraphMsgHandler) }, &their_node_id.into_rust(), init_msg.get_native_ref())
-}
-#[must_use]
-extern "C" fn NetGraphMsgHandler_RoutingMessageHandler_handle_reply_channel_range(this_arg: *const c_void, mut _their_node_id: crate::c_types::PublicKey, mut _msg: crate::lightning::ln::msgs::ReplyChannelRange) -> crate::c_types::derived::CResult_NoneLightningErrorZ {
- let mut ret = <nativeNetGraphMsgHandler as lightning::ln::msgs::RoutingMessageHandler<>>::handle_reply_channel_range(unsafe { &mut *(this_arg as *mut nativeNetGraphMsgHandler) }, &_their_node_id.into_rust(), *unsafe { Box::from_raw(_msg.take_inner()) });
- 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
-}
-#[must_use]
-extern "C" fn NetGraphMsgHandler_RoutingMessageHandler_handle_reply_short_channel_ids_end(this_arg: *const c_void, mut _their_node_id: crate::c_types::PublicKey, mut _msg: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> crate::c_types::derived::CResult_NoneLightningErrorZ {
- let mut ret = <nativeNetGraphMsgHandler as lightning::ln::msgs::RoutingMessageHandler<>>::handle_reply_short_channel_ids_end(unsafe { &mut *(this_arg as *mut nativeNetGraphMsgHandler) }, &_their_node_id.into_rust(), *unsafe { Box::from_raw(_msg.take_inner()) });
- 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
-}
-#[must_use]
-extern "C" fn NetGraphMsgHandler_RoutingMessageHandler_handle_query_channel_range(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, mut msg: crate::lightning::ln::msgs::QueryChannelRange) -> crate::c_types::derived::CResult_NoneLightningErrorZ {
- let mut ret = <nativeNetGraphMsgHandler as lightning::ln::msgs::RoutingMessageHandler<>>::handle_query_channel_range(unsafe { &mut *(this_arg as *mut nativeNetGraphMsgHandler) }, &their_node_id.into_rust(), *unsafe { Box::from_raw(msg.take_inner()) });
- 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
-}
-#[must_use]
-extern "C" fn NetGraphMsgHandler_RoutingMessageHandler_handle_query_short_channel_ids(this_arg: *const c_void, mut _their_node_id: crate::c_types::PublicKey, mut _msg: crate::lightning::ln::msgs::QueryShortChannelIds) -> crate::c_types::derived::CResult_NoneLightningErrorZ {
- let mut ret = <nativeNetGraphMsgHandler as lightning::ln::msgs::RoutingMessageHandler<>>::handle_query_short_channel_ids(unsafe { &mut *(this_arg as *mut nativeNetGraphMsgHandler) }, &_their_node_id.into_rust(), *unsafe { Box::from_raw(_msg.take_inner()) });
- 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
-}
-
-impl From<nativeNetGraphMsgHandler> for crate::lightning::util::events::MessageSendEventsProvider {
- fn from(obj: nativeNetGraphMsgHandler) -> Self {
- let mut rust_obj = NetGraphMsgHandler { inner: ObjOps::heap_alloc(obj), is_owned: true };
- let mut ret = NetGraphMsgHandler_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();
- ret.free = Some(NetGraphMsgHandler_free_void);
- ret
- }
-}
-/// Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
-/// This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
-#[no_mangle]
-pub extern "C" fn NetGraphMsgHandler_as_MessageSendEventsProvider(this_arg: &NetGraphMsgHandler) -> crate::lightning::util::events::MessageSendEventsProvider {
- crate::lightning::util::events::MessageSendEventsProvider {
- this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void },
- free: None,
- get_and_clear_pending_msg_events: NetGraphMsgHandler_MessageSendEventsProvider_get_and_clear_pending_msg_events,
- }
-}
-
-#[must_use]
-extern "C" fn NetGraphMsgHandler_MessageSendEventsProvider_get_and_clear_pending_msg_events(this_arg: *const c_void) -> crate::c_types::derived::CVec_MessageSendEventZ {
- let mut ret = <nativeNetGraphMsgHandler as lightning::util::events::MessageSendEventsProvider<>>::get_and_clear_pending_msg_events(unsafe { &mut *(this_arg as *mut nativeNetGraphMsgHandler) }, );
- let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning::util::events::MessageSendEvent::native_into(item) }); };
- local_ret.into()
-}
-
-
-use lightning::routing::network_graph::ChannelUpdateInfo as nativeChannelUpdateInfoImport;
-pub(crate) type nativeChannelUpdateInfo = nativeChannelUpdateInfoImport;
-
-/// Details about one direction of a channel as received within a [`ChannelUpdate`].
-#[must_use]
-#[repr(C)]
-pub struct ChannelUpdateInfo {
- /// 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 nativeChannelUpdateInfo,
- /// 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 ChannelUpdateInfo {
- fn drop(&mut self) {
- if self.is_owned && !<*mut nativeChannelUpdateInfo>::is_null(self.inner) {
- let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
- }
- }
-}
-/// Frees any resources used by the ChannelUpdateInfo, if is_owned is set and inner is non-NULL.
-#[no_mangle]
-pub extern "C" fn ChannelUpdateInfo_free(this_obj: ChannelUpdateInfo) { }
-#[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_free_void(this_ptr: *mut c_void) {
- unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelUpdateInfo); }
-}
-#[allow(unused)]
-impl ChannelUpdateInfo {
- pub(crate) fn get_native_ref(&self) -> &'static nativeChannelUpdateInfo {
- unsafe { &*ObjOps::untweak_ptr(self.inner) }
- }
- pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeChannelUpdateInfo {
- 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 nativeChannelUpdateInfo {
- assert!(self.is_owned);
- let ret = ObjOps::untweak_ptr(self.inner);
- self.inner = core::ptr::null_mut();
- ret
- }
-}
-/// When the last update to the channel direction was issued.
-/// Value is opaque, as set in the announcement.
-#[no_mangle]
-pub extern "C" fn ChannelUpdateInfo_get_last_update(this_ptr: &ChannelUpdateInfo) -> u32 {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().last_update;
- *inner_val
-}
-/// When the last update to the channel direction was issued.
-/// Value is opaque, as set in the announcement.
-#[no_mangle]
-pub extern "C" fn ChannelUpdateInfo_set_last_update(this_ptr: &mut ChannelUpdateInfo, mut val: u32) {
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.last_update = val;
-}
-/// Whether the channel can be currently used for payments (in this one direction).
-#[no_mangle]
-pub extern "C" fn ChannelUpdateInfo_get_enabled(this_ptr: &ChannelUpdateInfo) -> bool {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().enabled;
- *inner_val
-}
-/// Whether the channel can be currently used for payments (in this one direction).
-#[no_mangle]
-pub extern "C" fn ChannelUpdateInfo_set_enabled(this_ptr: &mut ChannelUpdateInfo, mut val: bool) {
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.enabled = val;
-}
-/// The difference in CLTV values that you must have when routing through this channel.
-#[no_mangle]
-pub extern "C" fn ChannelUpdateInfo_get_cltv_expiry_delta(this_ptr: &ChannelUpdateInfo) -> u16 {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().cltv_expiry_delta;
- *inner_val
-}
-/// The difference in CLTV values that you must have when routing through this channel.
-#[no_mangle]
-pub extern "C" fn ChannelUpdateInfo_set_cltv_expiry_delta(this_ptr: &mut ChannelUpdateInfo, mut val: u16) {
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.cltv_expiry_delta = val;
-}
-/// The minimum value, which must be relayed to the next hop via the channel
-#[no_mangle]
-pub extern "C" fn ChannelUpdateInfo_get_htlc_minimum_msat(this_ptr: &ChannelUpdateInfo) -> u64 {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().htlc_minimum_msat;
- *inner_val
-}
-/// The minimum value, which must be relayed to the next hop via the channel
-#[no_mangle]
-pub extern "C" fn ChannelUpdateInfo_set_htlc_minimum_msat(this_ptr: &mut ChannelUpdateInfo, mut val: u64) {
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.htlc_minimum_msat = val;
-}
-/// The maximum value which may be relayed to the next hop via the channel.
-#[no_mangle]
-pub extern "C" fn ChannelUpdateInfo_get_htlc_maximum_msat(this_ptr: &ChannelUpdateInfo) -> crate::c_types::derived::COption_u64Z {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().htlc_maximum_msat;
- let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { inner_val.unwrap() }) };
- local_inner_val
-}
-/// The maximum value which may be relayed to the next hop via the channel.
-#[no_mangle]
-pub extern "C" fn ChannelUpdateInfo_set_htlc_maximum_msat(this_ptr: &mut ChannelUpdateInfo, mut val: crate::c_types::derived::COption_u64Z) {
- let mut local_val = if val.is_some() { Some( { val.take() }) } else { None };
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.htlc_maximum_msat = local_val;
-}
-/// Fees charged when the channel is used for routing
-#[no_mangle]
-pub extern "C" fn ChannelUpdateInfo_get_fees(this_ptr: &ChannelUpdateInfo) -> crate::lightning::routing::network_graph::RoutingFees {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().fees;
- crate::lightning::routing::network_graph::RoutingFees { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::routing::network_graph::RoutingFees<>) as *mut _) }, is_owned: false }
-}
-/// Fees charged when the channel is used for routing
-#[no_mangle]
-pub extern "C" fn ChannelUpdateInfo_set_fees(this_ptr: &mut ChannelUpdateInfo, mut val: crate::lightning::routing::network_graph::RoutingFees) {
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.fees = *unsafe { Box::from_raw(val.take_inner()) };
-}
-/// Most recent update for the channel received from the network
-/// Mostly redundant with the data we store in fields explicitly.
-/// Everything else is useful only for sending out for initial routing sync.
-/// Not stored if contains excess data to prevent DoS.
-///
-/// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
-#[no_mangle]
-pub extern "C" fn ChannelUpdateInfo_get_last_update_message(this_ptr: &ChannelUpdateInfo) -> crate::lightning::ln::msgs::ChannelUpdate {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().last_update_message;
- let mut local_inner_val = crate::lightning::ln::msgs::ChannelUpdate { inner: unsafe { (if inner_val.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::ln::msgs::ChannelUpdate<>) as *mut _ }, is_owned: false };
- local_inner_val
-}
-/// Most recent update for the channel received from the network
-/// Mostly redundant with the data we store in fields explicitly.
-/// Everything else is useful only for sending out for initial routing sync.
-/// Not stored if contains excess data to prevent DoS.
-///
-/// Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
-#[no_mangle]
-pub extern "C" fn ChannelUpdateInfo_set_last_update_message(this_ptr: &mut ChannelUpdateInfo, mut val: crate::lightning::ln::msgs::ChannelUpdate) {
- let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_inner()) } }) };
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.last_update_message = local_val;
-}
-/// Constructs a new ChannelUpdateInfo given each field
-#[must_use]
-#[no_mangle]
-pub extern "C" fn ChannelUpdateInfo_new(mut last_update_arg: u32, mut enabled_arg: bool, mut cltv_expiry_delta_arg: u16, mut htlc_minimum_msat_arg: u64, mut htlc_maximum_msat_arg: crate::c_types::derived::COption_u64Z, mut fees_arg: crate::lightning::routing::network_graph::RoutingFees, mut last_update_message_arg: crate::lightning::ln::msgs::ChannelUpdate) -> ChannelUpdateInfo {
- let mut local_htlc_maximum_msat_arg = if htlc_maximum_msat_arg.is_some() { Some( { htlc_maximum_msat_arg.take() }) } else { None };
- let mut local_last_update_message_arg = if last_update_message_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(last_update_message_arg.take_inner()) } }) };
- ChannelUpdateInfo { inner: ObjOps::heap_alloc(nativeChannelUpdateInfo {
- last_update: last_update_arg,
- enabled: enabled_arg,
- cltv_expiry_delta: cltv_expiry_delta_arg,
- htlc_minimum_msat: htlc_minimum_msat_arg,
- htlc_maximum_msat: local_htlc_maximum_msat_arg,
- fees: *unsafe { Box::from_raw(fees_arg.take_inner()) },
- last_update_message: local_last_update_message_arg,
- }), is_owned: true }
-}
-impl Clone for ChannelUpdateInfo {
- fn clone(&self) -> Self {
- Self {
- inner: if <*mut nativeChannelUpdateInfo>::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 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
-}
-#[no_mangle]
-/// Creates a copy of the ChannelUpdateInfo
-pub extern "C" fn ChannelUpdateInfo_clone(orig: &ChannelUpdateInfo) -> ChannelUpdateInfo {
- orig.clone()
-}
-#[no_mangle]
-/// Serialize the ChannelUpdateInfo object into a byte array which can be read by ChannelUpdateInfo_read
-pub extern "C" fn ChannelUpdateInfo_write(obj: &crate::lightning::routing::network_graph::ChannelUpdateInfo) -> crate::c_types::derived::CVec_u8Z {
- crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
-}
-#[no_mangle]
-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) })
-}
-#[no_mangle]
-/// Read a ChannelUpdateInfo from a byte array, created by ChannelUpdateInfo_write
-pub extern "C" fn ChannelUpdateInfo_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelUpdateInfoDecodeErrorZ {
- let res: Result<lightning::routing::network_graph::ChannelUpdateInfo, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
- let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::network_graph::ChannelUpdateInfo { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
- local_res
-}
-
-use lightning::routing::network_graph::ChannelInfo as nativeChannelInfoImport;
-pub(crate) type nativeChannelInfo = nativeChannelInfoImport;
-
-/// Details about a channel (both directions).
-/// Received within a channel announcement.
-#[must_use]
-#[repr(C)]
-pub struct ChannelInfo {
- /// 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 nativeChannelInfo,
- /// 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 ChannelInfo {
- fn drop(&mut self) {
- if self.is_owned && !<*mut nativeChannelInfo>::is_null(self.inner) {
- let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
- }
- }
-}
-/// Frees any resources used by the ChannelInfo, if is_owned is set and inner is non-NULL.
-#[no_mangle]
-pub extern "C" fn ChannelInfo_free(this_obj: ChannelInfo) { }
-#[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_free_void(this_ptr: *mut c_void) {
- unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelInfo); }
-}
-#[allow(unused)]
-impl ChannelInfo {
- pub(crate) fn get_native_ref(&self) -> &'static nativeChannelInfo {
- unsafe { &*ObjOps::untweak_ptr(self.inner) }
- }
- pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeChannelInfo {
- 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 nativeChannelInfo {
- assert!(self.is_owned);
- let ret = ObjOps::untweak_ptr(self.inner);
- self.inner = core::ptr::null_mut();
- ret
- }
-}
-/// Protocol features of a channel communicated during its announcement
-#[no_mangle]
-pub extern "C" fn ChannelInfo_get_features(this_ptr: &ChannelInfo) -> crate::lightning::ln::features::ChannelFeatures {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().features;
- crate::lightning::ln::features::ChannelFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::features::ChannelFeatures<>) as *mut _) }, is_owned: false }
-}
-/// Protocol features of a channel communicated during its announcement
-#[no_mangle]
-pub extern "C" fn ChannelInfo_set_features(this_ptr: &mut ChannelInfo, mut val: crate::lightning::ln::features::ChannelFeatures) {
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.features = *unsafe { Box::from_raw(val.take_inner()) };
-}
-/// Source node of the first direction of a channel
-#[no_mangle]
-pub extern "C" fn ChannelInfo_get_node_one(this_ptr: &ChannelInfo) -> crate::lightning::routing::network_graph::NodeId {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().node_one;
- crate::lightning::routing::network_graph::NodeId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::routing::network_graph::NodeId<>) as *mut _) }, is_owned: false }
-}
-/// Source node of the first direction of a channel
-#[no_mangle]
-pub extern "C" fn ChannelInfo_set_node_one(this_ptr: &mut ChannelInfo, mut val: crate::lightning::routing::network_graph::NodeId) {
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.node_one = *unsafe { Box::from_raw(val.take_inner()) };
-}
-/// Details about the first direction of a channel
-///
-/// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
-#[no_mangle]
-pub extern "C" fn ChannelInfo_get_one_to_two(this_ptr: &ChannelInfo) -> crate::lightning::routing::network_graph::ChannelUpdateInfo {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().one_to_two;
- let mut local_inner_val = crate::lightning::routing::network_graph::ChannelUpdateInfo { inner: unsafe { (if inner_val.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::routing::network_graph::ChannelUpdateInfo<>) as *mut _ }, is_owned: false };
- local_inner_val
-}
-/// Details about the first direction of a channel
-///
-/// Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
-#[no_mangle]
-pub extern "C" fn ChannelInfo_set_one_to_two(this_ptr: &mut ChannelInfo, mut val: crate::lightning::routing::network_graph::ChannelUpdateInfo) {
- let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_inner()) } }) };
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.one_to_two = local_val;
-}
-/// Source node of the second direction of a channel
-#[no_mangle]
-pub extern "C" fn ChannelInfo_get_node_two(this_ptr: &ChannelInfo) -> crate::lightning::routing::network_graph::NodeId {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().node_two;
- crate::lightning::routing::network_graph::NodeId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::routing::network_graph::NodeId<>) as *mut _) }, is_owned: false }
-}
-/// Source node of the second direction of a channel
-#[no_mangle]
-pub extern "C" fn ChannelInfo_set_node_two(this_ptr: &mut ChannelInfo, mut val: crate::lightning::routing::network_graph::NodeId) {
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.node_two = *unsafe { Box::from_raw(val.take_inner()) };
-}
-/// Details about the second direction of a channel
-///
-/// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
-#[no_mangle]
-pub extern "C" fn ChannelInfo_get_two_to_one(this_ptr: &ChannelInfo) -> crate::lightning::routing::network_graph::ChannelUpdateInfo {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().two_to_one;
- let mut local_inner_val = crate::lightning::routing::network_graph::ChannelUpdateInfo { inner: unsafe { (if inner_val.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::routing::network_graph::ChannelUpdateInfo<>) as *mut _ }, is_owned: false };
- local_inner_val
-}
-/// Details about the second direction of a channel
-///
-/// Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
-#[no_mangle]
-pub extern "C" fn ChannelInfo_set_two_to_one(this_ptr: &mut ChannelInfo, mut val: crate::lightning::routing::network_graph::ChannelUpdateInfo) {
- let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_inner()) } }) };
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.two_to_one = local_val;
-}
-/// The channel capacity as seen on-chain, if chain lookup is available.
-#[no_mangle]
-pub extern "C" fn ChannelInfo_get_capacity_sats(this_ptr: &ChannelInfo) -> crate::c_types::derived::COption_u64Z {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().capacity_sats;
- let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { inner_val.unwrap() }) };
- local_inner_val
-}
-/// The channel capacity as seen on-chain, if chain lookup is available.
-#[no_mangle]
-pub extern "C" fn ChannelInfo_set_capacity_sats(this_ptr: &mut ChannelInfo, mut val: crate::c_types::derived::COption_u64Z) {
- let mut local_val = if val.is_some() { Some( { val.take() }) } else { None };
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.capacity_sats = local_val;
-}
-/// An initial announcement of the channel
-/// Mostly redundant with the data we store in fields explicitly.
-/// Everything else is useful only for sending out for initial routing sync.
-/// Not stored if contains excess data to prevent DoS.
-///
-/// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
-#[no_mangle]
-pub extern "C" fn ChannelInfo_get_announcement_message(this_ptr: &ChannelInfo) -> crate::lightning::ln::msgs::ChannelAnnouncement {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().announcement_message;
- let mut local_inner_val = crate::lightning::ln::msgs::ChannelAnnouncement { inner: unsafe { (if inner_val.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::ln::msgs::ChannelAnnouncement<>) as *mut _ }, is_owned: false };
- local_inner_val
-}
-/// An initial announcement of the channel
-/// Mostly redundant with the data we store in fields explicitly.
-/// Everything else is useful only for sending out for initial routing sync.
-/// Not stored if contains excess data to prevent DoS.
-///
-/// Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
-#[no_mangle]
-pub extern "C" fn ChannelInfo_set_announcement_message(this_ptr: &mut ChannelInfo, mut val: crate::lightning::ln::msgs::ChannelAnnouncement) {
- let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_inner()) } }) };
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.announcement_message = local_val;
-}
-impl Clone for ChannelInfo {
- fn clone(&self) -> Self {
- Self {
- inner: if <*mut nativeChannelInfo>::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 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
-}
-#[no_mangle]
-/// Creates a copy of the ChannelInfo
-pub extern "C" fn ChannelInfo_clone(orig: &ChannelInfo) -> ChannelInfo {
- orig.clone()
-}
-#[no_mangle]
-/// Serialize the ChannelInfo object into a byte array which can be read by ChannelInfo_read
-pub extern "C" fn ChannelInfo_write(obj: &crate::lightning::routing::network_graph::ChannelInfo) -> crate::c_types::derived::CVec_u8Z {
- crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
-}
-#[no_mangle]
-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) })
-}
-#[no_mangle]
-/// Read a ChannelInfo from a byte array, created by ChannelInfo_write
-pub extern "C" fn ChannelInfo_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelInfoDecodeErrorZ {
- let res: Result<lightning::routing::network_graph::ChannelInfo, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
- let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::network_graph::ChannelInfo { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
- local_res
-}
-
-use lightning::routing::network_graph::DirectedChannelInfo as nativeDirectedChannelInfoImport;
-pub(crate) type nativeDirectedChannelInfo = nativeDirectedChannelInfoImport<'static>;
-
-/// A wrapper around [`ChannelInfo`] representing information about the channel as directed from a
-/// source node to a target node.
-#[must_use]
-#[repr(C)]
-pub struct DirectedChannelInfo {
- /// 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 nativeDirectedChannelInfo,
- /// 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 DirectedChannelInfo {
- fn drop(&mut self) {
- if self.is_owned && !<*mut nativeDirectedChannelInfo>::is_null(self.inner) {
- let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
- }
- }
-}
-/// Frees any resources used by the DirectedChannelInfo, if is_owned is set and inner is non-NULL.
-#[no_mangle]
-pub extern "C" fn DirectedChannelInfo_free(this_obj: DirectedChannelInfo) { }
-#[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_free_void(this_ptr: *mut c_void) {
- unsafe { let _ = Box::from_raw(this_ptr as *mut nativeDirectedChannelInfo); }
-}
-#[allow(unused)]
-impl DirectedChannelInfo {
- pub(crate) fn get_native_ref(&self) -> &'static nativeDirectedChannelInfo {
- unsafe { &*ObjOps::untweak_ptr(self.inner) }
- }
- pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeDirectedChannelInfo {
- 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 nativeDirectedChannelInfo {
- assert!(self.is_owned);
- let ret = ObjOps::untweak_ptr(self.inner);
- self.inner = core::ptr::null_mut();
- ret
- }
-}
-impl Clone for DirectedChannelInfo {
- fn clone(&self) -> Self {
- Self {
- inner: if <*mut nativeDirectedChannelInfo>::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 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
-}
-#[no_mangle]
-/// Creates a copy of the DirectedChannelInfo
-pub extern "C" fn DirectedChannelInfo_clone(orig: &DirectedChannelInfo) -> DirectedChannelInfo {
- orig.clone()
-}
-/// Returns information for the channel.
-#[must_use]
-#[no_mangle]
-pub extern "C" fn DirectedChannelInfo_channel(this_arg: &crate::lightning::routing::network_graph::DirectedChannelInfo) -> crate::lightning::routing::network_graph::ChannelInfo {
- let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.channel();
- crate::lightning::routing::network_graph::ChannelInfo { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::routing::network_graph::ChannelInfo<>) as *mut _) }, is_owned: false }
-}
-
-/// Returns information for the direction.
-///
-/// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
-#[must_use]
-#[no_mangle]
-pub extern "C" fn DirectedChannelInfo_direction(this_arg: &crate::lightning::routing::network_graph::DirectedChannelInfo) -> crate::lightning::routing::network_graph::ChannelUpdateInfo {
- let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.direction();
- let mut local_ret = crate::lightning::routing::network_graph::ChannelUpdateInfo { inner: unsafe { (if ret.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (ret.unwrap()) }) } as *const lightning::routing::network_graph::ChannelUpdateInfo<>) as *mut _ }, is_owned: false };
- local_ret
-}
-
-/// Returns the [`EffectiveCapacity`] of the channel in the direction.
-///
-/// This is either the total capacity from the funding transaction, if known, or the
-/// `htlc_maximum_msat` for the direction as advertised by the gossip network, if known,
-/// whichever is smaller.
-#[must_use]
-#[no_mangle]
-pub extern "C" fn DirectedChannelInfo_effective_capacity(this_arg: &crate::lightning::routing::network_graph::DirectedChannelInfo) -> crate::lightning::routing::network_graph::EffectiveCapacity {
- let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.effective_capacity();
- crate::lightning::routing::network_graph::EffectiveCapacity::native_into(ret)
-}
-
-/// The effective capacity of a channel for routing purposes.
-///
-/// While this may be smaller than the actual channel capacity, amounts greater than
-/// [`Self::as_msat`] should not be routed through the channel.
-#[must_use]
-#[derive(Clone)]
-#[repr(C)]
-pub enum EffectiveCapacity {
- /// The available liquidity in the channel known from being a channel counterparty, and thus a
- /// direct hop.
- ExactLiquidity {
- /// Either the inbound or outbound liquidity depending on the direction, denominated in
- /// millisatoshi.
- liquidity_msat: u64,
- },
- /// The maximum HTLC amount in one direction as advertised on the gossip network.
- MaximumHTLC {
- /// The maximum HTLC amount denominated in millisatoshi.
- amount_msat: u64,
- },
- /// The total capacity of the channel as determined by the funding transaction.
- Total {
- /// The funding amount denominated in millisatoshi.
- capacity_msat: u64,
- },
- /// A capacity sufficient to route any payment, typically used for private channels provided by
- /// an invoice.
- Infinite,
- /// A capacity that is unknown possibly because either the chain state is unavailable to know
- /// the total capacity or the `htlc_maximum_msat` was not advertised on the gossip network.
- Unknown,
-}
-use lightning::routing::network_graph::EffectiveCapacity as nativeEffectiveCapacity;
-impl EffectiveCapacity {
- #[allow(unused)]
- pub(crate) fn to_native(&self) -> nativeEffectiveCapacity {
- match self {
- EffectiveCapacity::ExactLiquidity {ref liquidity_msat, } => {
- let mut liquidity_msat_nonref = (*liquidity_msat).clone();
- nativeEffectiveCapacity::ExactLiquidity {
- liquidity_msat: liquidity_msat_nonref,
- }
- },
- EffectiveCapacity::MaximumHTLC {ref amount_msat, } => {
- let mut amount_msat_nonref = (*amount_msat).clone();
- nativeEffectiveCapacity::MaximumHTLC {
- amount_msat: amount_msat_nonref,
- }
- },
- EffectiveCapacity::Total {ref capacity_msat, } => {
- let mut capacity_msat_nonref = (*capacity_msat).clone();
- nativeEffectiveCapacity::Total {
- capacity_msat: capacity_msat_nonref,
- }
- },
- EffectiveCapacity::Infinite => nativeEffectiveCapacity::Infinite,
- EffectiveCapacity::Unknown => nativeEffectiveCapacity::Unknown,
- }
- }
- #[allow(unused)]
- pub(crate) fn into_native(self) -> nativeEffectiveCapacity {
- match self {
- EffectiveCapacity::ExactLiquidity {mut liquidity_msat, } => {
- nativeEffectiveCapacity::ExactLiquidity {
- liquidity_msat: liquidity_msat,
- }
- },
- EffectiveCapacity::MaximumHTLC {mut amount_msat, } => {
- nativeEffectiveCapacity::MaximumHTLC {
- amount_msat: amount_msat,
- }
- },
- EffectiveCapacity::Total {mut capacity_msat, } => {
- nativeEffectiveCapacity::Total {
- capacity_msat: capacity_msat,
- }
- },
- EffectiveCapacity::Infinite => nativeEffectiveCapacity::Infinite,
- EffectiveCapacity::Unknown => nativeEffectiveCapacity::Unknown,
- }
- }
- #[allow(unused)]
- pub(crate) fn from_native(native: &nativeEffectiveCapacity) -> Self {
- match native {
- nativeEffectiveCapacity::ExactLiquidity {ref liquidity_msat, } => {
- let mut liquidity_msat_nonref = (*liquidity_msat).clone();
- EffectiveCapacity::ExactLiquidity {
- liquidity_msat: liquidity_msat_nonref,
- }
- },
- nativeEffectiveCapacity::MaximumHTLC {ref amount_msat, } => {
- let mut amount_msat_nonref = (*amount_msat).clone();
- EffectiveCapacity::MaximumHTLC {
- amount_msat: amount_msat_nonref,
- }
- },
- nativeEffectiveCapacity::Total {ref capacity_msat, } => {
- let mut capacity_msat_nonref = (*capacity_msat).clone();
- EffectiveCapacity::Total {
- capacity_msat: capacity_msat_nonref,
- }
- },
- nativeEffectiveCapacity::Infinite => EffectiveCapacity::Infinite,
- nativeEffectiveCapacity::Unknown => EffectiveCapacity::Unknown,
- }
- }
- #[allow(unused)]
- pub(crate) fn native_into(native: nativeEffectiveCapacity) -> Self {
- match native {
- nativeEffectiveCapacity::ExactLiquidity {mut liquidity_msat, } => {
- EffectiveCapacity::ExactLiquidity {
- liquidity_msat: liquidity_msat,
- }
- },
- nativeEffectiveCapacity::MaximumHTLC {mut amount_msat, } => {
- EffectiveCapacity::MaximumHTLC {
- amount_msat: amount_msat,
- }
- },
- nativeEffectiveCapacity::Total {mut capacity_msat, } => {
- EffectiveCapacity::Total {
- capacity_msat: capacity_msat,
- }
- },
- nativeEffectiveCapacity::Infinite => EffectiveCapacity::Infinite,
- nativeEffectiveCapacity::Unknown => EffectiveCapacity::Unknown,
- }
- }
-}
-/// Frees any resources used by the EffectiveCapacity
-#[no_mangle]
-pub extern "C" fn EffectiveCapacity_free(this_ptr: EffectiveCapacity) { }
-/// Creates a copy of the EffectiveCapacity
-#[no_mangle]
-pub extern "C" fn EffectiveCapacity_clone(orig: &EffectiveCapacity) -> EffectiveCapacity {
- orig.clone()
-}
-#[no_mangle]
-/// Utility method to constructs a new ExactLiquidity-variant EffectiveCapacity
-pub extern "C" fn EffectiveCapacity_exact_liquidity(liquidity_msat: u64) -> EffectiveCapacity {
- EffectiveCapacity::ExactLiquidity {
- liquidity_msat,
- }
-}
-#[no_mangle]
-/// Utility method to constructs a new MaximumHTLC-variant EffectiveCapacity
-pub extern "C" fn EffectiveCapacity_maximum_htlc(amount_msat: u64) -> EffectiveCapacity {
- EffectiveCapacity::MaximumHTLC {
- amount_msat,
- }
-}
-#[no_mangle]
-/// Utility method to constructs a new Total-variant EffectiveCapacity
-pub extern "C" fn EffectiveCapacity_total(capacity_msat: u64) -> EffectiveCapacity {
- EffectiveCapacity::Total {
- capacity_msat,
- }
-}
-#[no_mangle]
-/// Utility method to constructs a new Infinite-variant EffectiveCapacity
-pub extern "C" fn EffectiveCapacity_infinite() -> EffectiveCapacity {
- EffectiveCapacity::Infinite}
-#[no_mangle]
-/// Utility method to constructs a new Unknown-variant EffectiveCapacity
-pub extern "C" fn EffectiveCapacity_unknown() -> EffectiveCapacity {
- EffectiveCapacity::Unknown}
-/// The presumed channel capacity denominated in millisatoshi for [`EffectiveCapacity::Unknown`] to
-/// use when making routing decisions.
-
-#[no_mangle]
-pub static UNKNOWN_CHANNEL_CAPACITY_MSAT: u64 = lightning::routing::network_graph::UNKNOWN_CHANNEL_CAPACITY_MSAT;
-/// Returns the effective capacity denominated in millisatoshi.
-#[must_use]
-#[no_mangle]
-pub extern "C" fn EffectiveCapacity_as_msat(this_arg: &crate::lightning::routing::network_graph::EffectiveCapacity) -> u64 {
- let mut ret = this_arg.to_native().as_msat();
- ret
-}
-
-
-use lightning::routing::network_graph::RoutingFees as nativeRoutingFeesImport;
-pub(crate) type nativeRoutingFees = nativeRoutingFeesImport;
-
-/// Fees for routing via a given channel or a node
-#[must_use]
-#[repr(C)]
-pub struct RoutingFees {
- /// 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 nativeRoutingFees,
- /// 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 RoutingFees {
- fn drop(&mut self) {
- if self.is_owned && !<*mut nativeRoutingFees>::is_null(self.inner) {
- let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
- }
- }
-}
-/// Frees any resources used by the RoutingFees, if is_owned is set and inner is non-NULL.
-#[no_mangle]
-pub extern "C" fn RoutingFees_free(this_obj: RoutingFees) { }
-#[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_free_void(this_ptr: *mut c_void) {
- unsafe { let _ = Box::from_raw(this_ptr as *mut nativeRoutingFees); }
-}
-#[allow(unused)]
-impl RoutingFees {
- pub(crate) fn get_native_ref(&self) -> &'static nativeRoutingFees {
- unsafe { &*ObjOps::untweak_ptr(self.inner) }
- }
- pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeRoutingFees {
- 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 nativeRoutingFees {
- assert!(self.is_owned);
- let ret = ObjOps::untweak_ptr(self.inner);
- self.inner = core::ptr::null_mut();
- ret
- }
-}
-/// Flat routing fee in satoshis
-#[no_mangle]
-pub extern "C" fn RoutingFees_get_base_msat(this_ptr: &RoutingFees) -> u32 {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().base_msat;
- *inner_val
-}
-/// Flat routing fee in satoshis
-#[no_mangle]
-pub extern "C" fn RoutingFees_set_base_msat(this_ptr: &mut RoutingFees, mut val: u32) {
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.base_msat = val;
-}
-/// Liquidity-based routing fee in millionths of a routed amount.
-/// In other words, 10000 is 1%.
-#[no_mangle]
-pub extern "C" fn RoutingFees_get_proportional_millionths(this_ptr: &RoutingFees) -> u32 {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().proportional_millionths;
- *inner_val
-}
-/// Liquidity-based routing fee in millionths of a routed amount.
-/// In other words, 10000 is 1%.
-#[no_mangle]
-pub extern "C" fn RoutingFees_set_proportional_millionths(this_ptr: &mut RoutingFees, mut val: u32) {
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.proportional_millionths = val;
-}
-/// Constructs a new RoutingFees given each field
-#[must_use]
-#[no_mangle]
-pub extern "C" fn RoutingFees_new(mut base_msat_arg: u32, mut proportional_millionths_arg: u32) -> RoutingFees {
- RoutingFees { inner: ObjOps::heap_alloc(nativeRoutingFees {
- base_msat: base_msat_arg,
- proportional_millionths: proportional_millionths_arg,
- }), is_owned: true }
-}
-/// Checks if two RoutingFeess 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 RoutingFees_eq(a: &RoutingFees, b: &RoutingFees) -> bool {
- if a.inner == b.inner { return true; }
- if a.inner.is_null() || b.inner.is_null() { return false; }
- if a.get_native_ref() == b.get_native_ref() { true } else { false }
-}
-impl Clone for RoutingFees {
- fn clone(&self) -> Self {
- Self {
- inner: if <*mut nativeRoutingFees>::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 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
-}
-#[no_mangle]
-/// Creates a copy of the RoutingFees
-pub extern "C" fn RoutingFees_clone(orig: &RoutingFees) -> RoutingFees {
- orig.clone()
-}
-/// Checks if two RoutingFeess contain equal inner contents.
-#[no_mangle]
-pub extern "C" fn RoutingFees_hash(o: &RoutingFees) -> u64 {
- if o.inner.is_null() { return 0; }
- // Note that we'd love to use alloc::collections::hash_map::DefaultHasher but it's not in core
- #[allow(deprecated)]
- let mut hasher = core::hash::SipHasher::new();
- core::hash::Hash::hash(o.get_native_ref(), &mut hasher);
- core::hash::Hasher::finish(&hasher)
-}
-#[no_mangle]
-/// Serialize the RoutingFees object into a byte array which can be read by RoutingFees_read
-pub extern "C" fn RoutingFees_write(obj: &crate::lightning::routing::network_graph::RoutingFees) -> crate::c_types::derived::CVec_u8Z {
- crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
-}
-#[no_mangle]
-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) })
-}
-#[no_mangle]
-/// Read a RoutingFees from a byte array, created by RoutingFees_write
-pub extern "C" fn RoutingFees_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_RoutingFeesDecodeErrorZ {
- let res: Result<lightning::routing::network_graph::RoutingFees, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
- let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::network_graph::RoutingFees { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
- local_res
-}
-
-use lightning::routing::network_graph::NodeAnnouncementInfo as nativeNodeAnnouncementInfoImport;
-pub(crate) type nativeNodeAnnouncementInfo = nativeNodeAnnouncementInfoImport;
-
-/// Information received in the latest node_announcement from this node.
-#[must_use]
-#[repr(C)]
-pub struct NodeAnnouncementInfo {
- /// 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 nativeNodeAnnouncementInfo,
- /// 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 NodeAnnouncementInfo {
- fn drop(&mut self) {
- if self.is_owned && !<*mut nativeNodeAnnouncementInfo>::is_null(self.inner) {
- let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
- }
- }
-}
-/// Frees any resources used by the NodeAnnouncementInfo, if is_owned is set and inner is non-NULL.
-#[no_mangle]
-pub extern "C" fn NodeAnnouncementInfo_free(this_obj: NodeAnnouncementInfo) { }
-#[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_free_void(this_ptr: *mut c_void) {
- unsafe { let _ = Box::from_raw(this_ptr as *mut nativeNodeAnnouncementInfo); }
-}
-#[allow(unused)]
-impl NodeAnnouncementInfo {
- pub(crate) fn get_native_ref(&self) -> &'static nativeNodeAnnouncementInfo {
- unsafe { &*ObjOps::untweak_ptr(self.inner) }
- }
- pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeNodeAnnouncementInfo {
- 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 nativeNodeAnnouncementInfo {
- assert!(self.is_owned);
- let ret = ObjOps::untweak_ptr(self.inner);
- self.inner = core::ptr::null_mut();
- ret
- }
-}
-/// Protocol features the node announced support for
-#[no_mangle]
-pub extern "C" fn NodeAnnouncementInfo_get_features(this_ptr: &NodeAnnouncementInfo) -> crate::lightning::ln::features::NodeFeatures {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().features;
- crate::lightning::ln::features::NodeFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::features::NodeFeatures<>) as *mut _) }, is_owned: false }
-}
-/// Protocol features the node announced support for
-#[no_mangle]
-pub extern "C" fn NodeAnnouncementInfo_set_features(this_ptr: &mut NodeAnnouncementInfo, mut val: crate::lightning::ln::features::NodeFeatures) {
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.features = *unsafe { Box::from_raw(val.take_inner()) };
-}
-/// When the last known update to the node state was issued.
-/// Value is opaque, as set in the announcement.
-#[no_mangle]
-pub extern "C" fn NodeAnnouncementInfo_get_last_update(this_ptr: &NodeAnnouncementInfo) -> u32 {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().last_update;
- *inner_val
-}
-/// When the last known update to the node state was issued.
-/// Value is opaque, as set in the announcement.
-#[no_mangle]
-pub extern "C" fn NodeAnnouncementInfo_set_last_update(this_ptr: &mut NodeAnnouncementInfo, mut val: u32) {
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.last_update = val;
-}
-/// Color assigned to the node
-#[no_mangle]
-pub extern "C" fn NodeAnnouncementInfo_get_rgb(this_ptr: &NodeAnnouncementInfo) -> *const [u8; 3] {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().rgb;
- inner_val
-}
-/// Color assigned to the node
-#[no_mangle]
-pub extern "C" fn NodeAnnouncementInfo_set_rgb(this_ptr: &mut NodeAnnouncementInfo, mut val: crate::c_types::ThreeBytes) {
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.rgb = val.data;
-}
-/// Moniker assigned to the node.
-/// May be invalid or malicious (eg control chars),
-/// should not be exposed to the user.
-#[no_mangle]
-pub extern "C" fn NodeAnnouncementInfo_get_alias(this_ptr: &NodeAnnouncementInfo) -> *const [u8; 32] {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().alias;
- inner_val
-}
-/// Moniker assigned to the node.
-/// May be invalid or malicious (eg control chars),
-/// should not be exposed to the user.
-#[no_mangle]
-pub extern "C" fn NodeAnnouncementInfo_set_alias(this_ptr: &mut NodeAnnouncementInfo, mut val: crate::c_types::ThirtyTwoBytes) {
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.alias = val.data;
-}
-/// Internet-level addresses via which one can connect to the node
-#[no_mangle]
-pub extern "C" fn NodeAnnouncementInfo_set_addresses(this_ptr: &mut NodeAnnouncementInfo, mut val: crate::c_types::derived::CVec_NetAddressZ) {
- let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { item.into_native() }); };
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.addresses = local_val;
-}
-/// An initial announcement of the node
-/// Mostly redundant with the data we store in fields explicitly.
-/// Everything else is useful only for sending out for initial routing sync.
-/// Not stored if contains excess data to prevent DoS.
-///
-/// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
-#[no_mangle]
-pub extern "C" fn NodeAnnouncementInfo_get_announcement_message(this_ptr: &NodeAnnouncementInfo) -> crate::lightning::ln::msgs::NodeAnnouncement {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().announcement_message;
- let mut local_inner_val = crate::lightning::ln::msgs::NodeAnnouncement { inner: unsafe { (if inner_val.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::ln::msgs::NodeAnnouncement<>) as *mut _ }, is_owned: false };
- local_inner_val
-}
-/// An initial announcement of the node
-/// Mostly redundant with the data we store in fields explicitly.
-/// Everything else is useful only for sending out for initial routing sync.
-/// Not stored if contains excess data to prevent DoS.
-///
-/// Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
-#[no_mangle]
-pub extern "C" fn NodeAnnouncementInfo_set_announcement_message(this_ptr: &mut NodeAnnouncementInfo, mut val: crate::lightning::ln::msgs::NodeAnnouncement) {
- let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_inner()) } }) };
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.announcement_message = local_val;
-}
-/// Constructs a new NodeAnnouncementInfo given each field
-#[must_use]
-#[no_mangle]
-pub extern "C" fn NodeAnnouncementInfo_new(mut features_arg: crate::lightning::ln::features::NodeFeatures, mut last_update_arg: u32, mut rgb_arg: crate::c_types::ThreeBytes, mut alias_arg: crate::c_types::ThirtyTwoBytes, mut addresses_arg: crate::c_types::derived::CVec_NetAddressZ, mut announcement_message_arg: crate::lightning::ln::msgs::NodeAnnouncement) -> NodeAnnouncementInfo {
- let mut local_addresses_arg = Vec::new(); for mut item in addresses_arg.into_rust().drain(..) { local_addresses_arg.push( { item.into_native() }); };
- let mut local_announcement_message_arg = if announcement_message_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(announcement_message_arg.take_inner()) } }) };
- NodeAnnouncementInfo { inner: ObjOps::heap_alloc(nativeNodeAnnouncementInfo {
- features: *unsafe { Box::from_raw(features_arg.take_inner()) },
- last_update: last_update_arg,
- rgb: rgb_arg.data,
- alias: alias_arg.data,
- addresses: local_addresses_arg,
- announcement_message: local_announcement_message_arg,
- }), is_owned: true }
-}
-impl Clone for NodeAnnouncementInfo {
- fn clone(&self) -> Self {
- Self {
- inner: if <*mut nativeNodeAnnouncementInfo>::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 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
-}
-#[no_mangle]
-/// Creates a copy of the NodeAnnouncementInfo
-pub extern "C" fn NodeAnnouncementInfo_clone(orig: &NodeAnnouncementInfo) -> NodeAnnouncementInfo {
- orig.clone()
-}
-#[no_mangle]
-/// Serialize the NodeAnnouncementInfo object into a byte array which can be read by NodeAnnouncementInfo_read
-pub extern "C" fn NodeAnnouncementInfo_write(obj: &crate::lightning::routing::network_graph::NodeAnnouncementInfo) -> crate::c_types::derived::CVec_u8Z {
- crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
-}
-#[no_mangle]
-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) })
-}
-#[no_mangle]
-/// Read a NodeAnnouncementInfo from a byte array, created by NodeAnnouncementInfo_write
-pub extern "C" fn NodeAnnouncementInfo_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_NodeAnnouncementInfoDecodeErrorZ {
- let res: Result<lightning::routing::network_graph::NodeAnnouncementInfo, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
- let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::network_graph::NodeAnnouncementInfo { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
- local_res
-}
-
-use lightning::routing::network_graph::NodeInfo as nativeNodeInfoImport;
-pub(crate) type nativeNodeInfo = nativeNodeInfoImport;
-
-/// Details about a node in the network, known from the network announcement.
-#[must_use]
-#[repr(C)]
-pub struct NodeInfo {
- /// 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 nativeNodeInfo,
- /// 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 NodeInfo {
- fn drop(&mut self) {
- if self.is_owned && !<*mut nativeNodeInfo>::is_null(self.inner) {
- let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
- }
- }
-}
-/// Frees any resources used by the NodeInfo, if is_owned is set and inner is non-NULL.
-#[no_mangle]
-pub extern "C" fn NodeInfo_free(this_obj: NodeInfo) { }
-#[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_free_void(this_ptr: *mut c_void) {
- unsafe { let _ = Box::from_raw(this_ptr as *mut nativeNodeInfo); }
-}
-#[allow(unused)]
-impl NodeInfo {
- pub(crate) fn get_native_ref(&self) -> &'static nativeNodeInfo {
- unsafe { &*ObjOps::untweak_ptr(self.inner) }
- }
- pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeNodeInfo {
- 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 nativeNodeInfo {
- assert!(self.is_owned);
- let ret = ObjOps::untweak_ptr(self.inner);
- self.inner = core::ptr::null_mut();
- ret
- }
-}
-/// All valid channels a node has announced
-#[no_mangle]
-pub extern "C" fn NodeInfo_set_channels(this_ptr: &mut NodeInfo, mut val: crate::c_types::derived::CVec_u64Z) {
- let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { item }); };
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channels = local_val;
-}
-/// Lowest fees enabling routing via any of the enabled, known channels to a node.
-/// The two fields (flat and proportional fee) are independent,
-/// meaning they don't have to refer to the same channel.
-///
-/// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
-#[no_mangle]
-pub extern "C" fn NodeInfo_get_lowest_inbound_channel_fees(this_ptr: &NodeInfo) -> crate::lightning::routing::network_graph::RoutingFees {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().lowest_inbound_channel_fees;
- let mut local_inner_val = crate::lightning::routing::network_graph::RoutingFees { inner: unsafe { (if inner_val.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::routing::network_graph::RoutingFees<>) as *mut _ }, is_owned: false };
- local_inner_val
-}
-/// Lowest fees enabling routing via any of the enabled, known channels to a node.
-/// The two fields (flat and proportional fee) are independent,
-/// meaning they don't have to refer to the same channel.
-///
-/// Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
-#[no_mangle]
-pub extern "C" fn NodeInfo_set_lowest_inbound_channel_fees(this_ptr: &mut NodeInfo, mut val: crate::lightning::routing::network_graph::RoutingFees) {
- let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_inner()) } }) };
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.lowest_inbound_channel_fees = local_val;
-}
-/// More information about a node from node_announcement.
-/// Optional because we store a Node entry after learning about it from
-/// a channel announcement, but before receiving a node announcement.
-///
-/// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
-#[no_mangle]
-pub extern "C" fn NodeInfo_get_announcement_info(this_ptr: &NodeInfo) -> crate::lightning::routing::network_graph::NodeAnnouncementInfo {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().announcement_info;
- let mut local_inner_val = crate::lightning::routing::network_graph::NodeAnnouncementInfo { inner: unsafe { (if inner_val.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::routing::network_graph::NodeAnnouncementInfo<>) as *mut _ }, is_owned: false };
- local_inner_val
-}
-/// More information about a node from node_announcement.
-/// Optional because we store a Node entry after learning about it from
-/// a channel announcement, but before receiving a node announcement.
-///
-/// Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
-#[no_mangle]
-pub extern "C" fn NodeInfo_set_announcement_info(this_ptr: &mut NodeInfo, mut val: crate::lightning::routing::network_graph::NodeAnnouncementInfo) {
- let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_inner()) } }) };
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.announcement_info = local_val;
-}
-/// Constructs a new NodeInfo given each field
-#[must_use]
-#[no_mangle]
-pub extern "C" fn NodeInfo_new(mut channels_arg: crate::c_types::derived::CVec_u64Z, mut lowest_inbound_channel_fees_arg: crate::lightning::routing::network_graph::RoutingFees, mut announcement_info_arg: crate::lightning::routing::network_graph::NodeAnnouncementInfo) -> NodeInfo {
- let mut local_channels_arg = Vec::new(); for mut item in channels_arg.into_rust().drain(..) { local_channels_arg.push( { item }); };
- let mut local_lowest_inbound_channel_fees_arg = if lowest_inbound_channel_fees_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(lowest_inbound_channel_fees_arg.take_inner()) } }) };
- let mut local_announcement_info_arg = if announcement_info_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(announcement_info_arg.take_inner()) } }) };
- NodeInfo { inner: ObjOps::heap_alloc(nativeNodeInfo {
- channels: local_channels_arg,
- lowest_inbound_channel_fees: local_lowest_inbound_channel_fees_arg,
- announcement_info: local_announcement_info_arg,
- }), is_owned: true }
-}
-impl Clone for NodeInfo {
- fn clone(&self) -> Self {
- Self {
- inner: if <*mut nativeNodeInfo>::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 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
-}
-#[no_mangle]
-/// Creates a copy of the NodeInfo
-pub extern "C" fn NodeInfo_clone(orig: &NodeInfo) -> NodeInfo {
- orig.clone()
-}
-#[no_mangle]
-/// Serialize the NodeInfo object into a byte array which can be read by NodeInfo_read
-pub extern "C" fn NodeInfo_write(obj: &crate::lightning::routing::network_graph::NodeInfo) -> crate::c_types::derived::CVec_u8Z {
- crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
-}
-#[no_mangle]
-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) })
-}
-#[no_mangle]
-/// Read a NodeInfo from a byte array, created by NodeInfo_write
-pub extern "C" fn NodeInfo_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_NodeInfoDecodeErrorZ {
- let res: Result<lightning::routing::network_graph::NodeInfo, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
- let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::network_graph::NodeInfo { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
- local_res
-}
-#[no_mangle]
-/// Serialize the NetworkGraph object into a byte array which can be read by NetworkGraph_read
-pub extern "C" fn NetworkGraph_write(obj: &crate::lightning::routing::network_graph::NetworkGraph) -> crate::c_types::derived::CVec_u8Z {
- crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
-}
-#[no_mangle]
-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) })
-}
-#[no_mangle]
-/// Read a NetworkGraph from a byte array, created by NetworkGraph_write
-pub extern "C" fn NetworkGraph_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_NetworkGraphDecodeErrorZ {
- let res: Result<lightning::routing::network_graph::NetworkGraph, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
- let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::network_graph::NetworkGraph { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
- local_res
-}
-/// Creates a new, empty, network graph.
-#[must_use]
-#[no_mangle]
-pub extern "C" fn NetworkGraph_new(mut genesis_hash: crate::c_types::ThirtyTwoBytes) -> crate::lightning::routing::network_graph::NetworkGraph {
- let mut ret = lightning::routing::network_graph::NetworkGraph::new(::bitcoin::hash_types::BlockHash::from_slice(&genesis_hash.data[..]).unwrap());
- crate::lightning::routing::network_graph::NetworkGraph { inner: ObjOps::heap_alloc(ret), is_owned: true }
-}
-
-/// Returns a read-only view of the network graph.
-#[must_use]
-#[no_mangle]
-pub extern "C" fn NetworkGraph_read_only(this_arg: &crate::lightning::routing::network_graph::NetworkGraph) -> crate::lightning::routing::network_graph::ReadOnlyNetworkGraph {
- let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.read_only();
- crate::lightning::routing::network_graph::ReadOnlyNetworkGraph { inner: ObjOps::heap_alloc(ret), is_owned: true }
-}
-
-/// For an already known node (from channel announcements), update its stored properties from a
-/// given node announcement.
-///
-/// You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
-/// RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
-/// routing messages from a source using a protocol other than the lightning P2P protocol.
-#[must_use]
-#[no_mangle]
-pub extern "C" fn NetworkGraph_update_node_from_announcement(this_arg: &crate::lightning::routing::network_graph::NetworkGraph, msg: &crate::lightning::ln::msgs::NodeAnnouncement) -> crate::c_types::derived::CResult_NoneLightningErrorZ {
- let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.update_node_from_announcement(msg.get_native_ref(), secp256k1::SECP256K1);
- 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
-}
-
-/// For an already known node (from channel announcements), update its stored properties from a
-/// given node announcement without verifying the associated signatures. Because we aren't
-/// given the associated signatures here we cannot relay the node announcement to any of our
-/// peers.
-#[must_use]
-#[no_mangle]
-pub extern "C" fn NetworkGraph_update_node_from_unsigned_announcement(this_arg: &crate::lightning::routing::network_graph::NetworkGraph, msg: &crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> crate::c_types::derived::CResult_NoneLightningErrorZ {
- let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.update_node_from_unsigned_announcement(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
-}
-
-/// Store or update channel info from a channel announcement.
-///
-/// You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
-/// RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
-/// routing messages from a source using a protocol other than the lightning P2P protocol.
-///
-/// If a `chain::Access` object is provided via `chain_access`, it will be called to verify
-/// the corresponding UTXO exists on chain and is correctly-formatted.
-#[must_use]
-#[no_mangle]
-pub extern "C" fn NetworkGraph_update_channel_from_announcement(this_arg: &crate::lightning::routing::network_graph::NetworkGraph, msg: &crate::lightning::ln::msgs::ChannelAnnouncement, mut chain_access: crate::c_types::derived::COption_AccessZ) -> crate::c_types::derived::CResult_NoneLightningErrorZ {
- let mut local_chain_access = { /* chain_access*/ let chain_access_opt = chain_access; { } if chain_access_opt.is_none() { None } else { Some({ chain_access_opt.take() }) } };
- let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.update_channel_from_announcement(msg.get_native_ref(), &local_chain_access, secp256k1::SECP256K1);
- 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
-}
-
-/// Store or update channel info from a channel announcement without verifying the associated
-/// signatures. Because we aren't given the associated signatures here we cannot relay the
-/// channel announcement to any of our peers.
-///
-/// If a `chain::Access` object is provided via `chain_access`, it will be called to verify
-/// the corresponding UTXO exists on chain and is correctly-formatted.
-#[must_use]
-#[no_mangle]
-pub extern "C" fn NetworkGraph_update_channel_from_unsigned_announcement(this_arg: &crate::lightning::routing::network_graph::NetworkGraph, msg: &crate::lightning::ln::msgs::UnsignedChannelAnnouncement, mut chain_access: crate::c_types::derived::COption_AccessZ) -> crate::c_types::derived::CResult_NoneLightningErrorZ {
- let mut local_chain_access = { /* chain_access*/ let chain_access_opt = chain_access; { } if chain_access_opt.is_none() { None } else { Some({ chain_access_opt.take() }) } };
- let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.update_channel_from_unsigned_announcement(msg.get_native_ref(), &local_chain_access);
- 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
-}
-
-/// Close a channel if a corresponding HTLC fail was sent.
-/// If permanent, removes a channel from the local storage.
-/// May cause the removal of nodes too, if this was their last channel.
-/// If not permanent, makes channels unavailable for routing.
-#[no_mangle]
-pub extern "C" fn NetworkGraph_close_channel_from_update(this_arg: &crate::lightning::routing::network_graph::NetworkGraph, mut short_channel_id: u64, mut is_permanent: bool) {
- unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.close_channel_from_update(short_channel_id, is_permanent)
-}
-
-/// Marks a node in the graph as failed.
-#[no_mangle]
-pub extern "C" fn NetworkGraph_fail_node(this_arg: &crate::lightning::routing::network_graph::NetworkGraph, mut _node_id: crate::c_types::PublicKey, mut is_permanent: bool) {
- unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.fail_node(&_node_id.into_rust(), is_permanent)
-}
-
-/// Removes information about channels that we haven't heard any updates about in some time.
-/// This can be used regularly to prune the network graph of channels that likely no longer
-/// exist.
-///
-/// While there is no formal requirement that nodes regularly re-broadcast their channel
-/// updates every two weeks, the non-normative section of BOLT 7 currently suggests that
-/// pruning occur for updates which are at least two weeks old, which we implement here.
-///
-/// Note that for users of the `lightning-background-processor` crate this method may be
-/// automatically called regularly for you.
-///
-/// This method is only available with the `std` feature. See
-/// [`NetworkGraph::remove_stale_channels_with_time`] for `no-std` use.
-#[no_mangle]
-pub extern "C" fn NetworkGraph_remove_stale_channels(this_arg: &crate::lightning::routing::network_graph::NetworkGraph) {
- unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.remove_stale_channels()
-}
-
-/// Removes information about channels that we haven't heard any updates about in some time.
-/// This can be used regularly to prune the network graph of channels that likely no longer
-/// exist.
-///
-/// While there is no formal requirement that nodes regularly re-broadcast their channel
-/// updates every two weeks, the non-normative section of BOLT 7 currently suggests that
-/// pruning occur for updates which are at least two weeks old, which we implement here.
-///
-/// This function takes the current unix time as an argument. For users with the `std` feature
-/// enabled, [`NetworkGraph::remove_stale_channels`] may be preferable.
-#[no_mangle]
-pub extern "C" fn NetworkGraph_remove_stale_channels_with_time(this_arg: &crate::lightning::routing::network_graph::NetworkGraph, mut current_time_unix: u64) {
- unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.remove_stale_channels_with_time(current_time_unix)
-}
-
-/// For an already known (from announcement) channel, update info about one of the directions
-/// of the channel.
-///
-/// You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
-/// RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
-/// routing messages from a source using a protocol other than the lightning P2P protocol.
-///
-/// If built with `no-std`, any updates with a timestamp more than two weeks in the past or
-/// materially in the future will be rejected.
-#[must_use]
-#[no_mangle]
-pub extern "C" fn NetworkGraph_update_channel(this_arg: &crate::lightning::routing::network_graph::NetworkGraph, msg: &crate::lightning::ln::msgs::ChannelUpdate) -> crate::c_types::derived::CResult_NoneLightningErrorZ {
- let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.update_channel(msg.get_native_ref(), secp256k1::SECP256K1);
- 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
-}
-
-/// For an already known (from announcement) channel, update info about one of the directions
-/// of the channel without verifying the associated signatures. Because we aren't given the
-/// associated signatures here we cannot relay the channel update to any of our peers.
-///
-/// If built with `no-std`, any updates with a timestamp more than two weeks in the past or
-/// materially in the future will be rejected.
-#[must_use]
-#[no_mangle]
-pub extern "C" fn NetworkGraph_update_channel_unsigned(this_arg: &crate::lightning::routing::network_graph::NetworkGraph, msg: &crate::lightning::ln::msgs::UnsignedChannelUpdate) -> crate::c_types::derived::CResult_NoneLightningErrorZ {
- let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.update_channel_unsigned(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
-}
-
-/// Get network addresses by node id.
-/// Returns None if the requested node is completely unknown,
-/// or if node announcement for the node was never received.
-#[must_use]
-#[no_mangle]
-pub extern "C" fn ReadOnlyNetworkGraph_get_addresses(this_arg: &crate::lightning::routing::network_graph::ReadOnlyNetworkGraph, mut pubkey: crate::c_types::PublicKey) -> crate::c_types::derived::COption_CVec_NetAddressZZ {
- let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_addresses(&pubkey.into_rust());
- let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_CVec_NetAddressZZ::None } else { crate::c_types::derived::COption_CVec_NetAddressZZ::Some( { let mut local_ret_0 = Vec::new(); for mut item in ret.unwrap().drain(..) { local_ret_0.push( { crate::lightning::ln::msgs::NetAddress::native_into(item) }); }; local_ret_0.into() }) };
- local_ret
-}
-
//! The top-level routing/network map tracking logic lives here.
//!
-//! You probably want to create a NetGraphMsgHandler and use that as your RoutingMessageHandler and then
+//! You probably want to create a P2PGossipSync and use that as your RoutingMessageHandler and then
//! interrogate it to get routes for your own payments.
use alloc::str::FromStr;
}
}
/// The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
-/// last RouteHop in each path must be the same.
-/// Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the
-/// destination. Thus, this must always be at least length one. While the maximum length of any
-/// given path is variable, keeping the length of any path to less than 20 should currently
-/// ensure it is viable.
+/// last RouteHop in each path must be the same. Each entry represents a list of hops, NOT
+/// INCLUDING our own, where the last hop is the destination. Thus, this must always be at
+/// least length one. While the maximum length of any given path is variable, keeping the length
+/// of any path less or equal to 19 should currently ensure it is viable.
#[no_mangle]
pub extern "C" fn Route_get_paths(this_ptr: &Route) -> crate::c_types::derived::CVec_CVec_RouteHopZZ {
let mut inner_val = &mut this_ptr.get_native_mut_ref().paths;
local_inner_val.into()
}
/// The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
-/// last RouteHop in each path must be the same.
-/// Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the
-/// destination. Thus, this must always be at least length one. While the maximum length of any
-/// given path is variable, keeping the length of any path to less than 20 should currently
-/// ensure it is viable.
+/// last RouteHop in each path must be the same. Each entry represents a list of hops, NOT
+/// INCLUDING our own, where the last hop is the destination. Thus, this must always be at
+/// least length one. While the maximum length of any given path is variable, keeping the length
+/// of any path less or equal to 19 should currently ensure it is viable.
#[no_mangle]
pub extern "C" fn Route_set_paths(this_ptr: &mut Route, mut val: crate::c_types::derived::CVec_CVec_RouteHopZZ) {
let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { let mut local_val_0 = Vec::new(); for mut item in item.into_rust().drain(..) { local_val_0.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; local_val_0 }); };
/// Parameters needed to find a [`Route`].
///
-/// Passed to [`find_route`] and also provided in [`Event::PaymentPathFailed`] for retrying a failed
-/// payment path.
+/// Passed to [`find_route`] and [`build_route_from_hops`], but also provided in
+/// [`Event::PaymentPathFailed`] for retrying a failed payment path.
///
/// [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
#[must_use]
}
/// The fees which must be paid to use this channel
#[no_mangle]
-pub extern "C" fn RouteHintHop_get_fees(this_ptr: &RouteHintHop) -> crate::lightning::routing::network_graph::RoutingFees {
+pub extern "C" fn RouteHintHop_get_fees(this_ptr: &RouteHintHop) -> crate::lightning::routing::gossip::RoutingFees {
let mut inner_val = &mut this_ptr.get_native_mut_ref().fees;
- crate::lightning::routing::network_graph::RoutingFees { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::routing::network_graph::RoutingFees<>) as *mut _) }, is_owned: false }
+ crate::lightning::routing::gossip::RoutingFees { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::routing::gossip::RoutingFees<>) as *mut _) }, is_owned: false }
}
/// The fees which must be paid to use this channel
#[no_mangle]
-pub extern "C" fn RouteHintHop_set_fees(this_ptr: &mut RouteHintHop, mut val: crate::lightning::routing::network_graph::RoutingFees) {
+pub extern "C" fn RouteHintHop_set_fees(this_ptr: &mut RouteHintHop, mut val: crate::lightning::routing::gossip::RoutingFees) {
unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.fees = *unsafe { Box::from_raw(val.take_inner()) };
}
/// The difference in CLTV values between this node and the next node.
/// Constructs a new RouteHintHop given each field
#[must_use]
#[no_mangle]
-pub extern "C" fn RouteHintHop_new(mut src_node_id_arg: crate::c_types::PublicKey, mut short_channel_id_arg: u64, mut fees_arg: crate::lightning::routing::network_graph::RoutingFees, mut cltv_expiry_delta_arg: u16, mut htlc_minimum_msat_arg: crate::c_types::derived::COption_u64Z, mut htlc_maximum_msat_arg: crate::c_types::derived::COption_u64Z) -> RouteHintHop {
+pub extern "C" fn RouteHintHop_new(mut src_node_id_arg: crate::c_types::PublicKey, mut short_channel_id_arg: u64, mut fees_arg: crate::lightning::routing::gossip::RoutingFees, mut cltv_expiry_delta_arg: u16, mut htlc_minimum_msat_arg: crate::c_types::derived::COption_u64Z, mut htlc_maximum_msat_arg: crate::c_types::derived::COption_u64Z) -> RouteHintHop {
let mut local_htlc_minimum_msat_arg = if htlc_minimum_msat_arg.is_some() { Some( { htlc_minimum_msat_arg.take() }) } else { None };
let mut local_htlc_maximum_msat_arg = if htlc_maximum_msat_arg.is_some() { Some( { htlc_maximum_msat_arg.take() }) } else { None };
RouteHintHop { inner: ObjOps::heap_alloc(nativeRouteHintHop {
/// Private routing paths between a public node and the target may be included in `params.payee`.
///
/// If some channels aren't announced, it may be useful to fill in `first_hops` with the results
-/// from [`ChannelManager::list_usable_channels`]. If it is filled in, the view of our local
-/// channels from [`NetworkGraph`] will be ignored, and only those in `first_hops` will be used.
+/// from [`ChannelManager::list_usable_channels`]. If it is filled in, the view of these channels
+/// from `network_graph` will be ignored, and only those in `first_hops` will be used.
///
/// The fees on channels from us to the next hop are ignored as they are assumed to all be equal.
/// However, the enabled/disabled bit on such channels as well as the `htlc_minimum_msat` /
///
/// [`ChannelManager::list_usable_channels`]: crate::ln::channelmanager::ChannelManager::list_usable_channels
/// [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
+/// [`NetworkGraph`]: crate::routing::gossip::NetworkGraph
///
/// Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
#[no_mangle]
-pub extern "C" fn find_route(mut our_node_pubkey: crate::c_types::PublicKey, route_params: &crate::lightning::routing::router::RouteParameters, network: &crate::lightning::routing::network_graph::NetworkGraph, first_hops: *mut crate::c_types::derived::CVec_ChannelDetailsZ, mut logger: crate::lightning::util::logger::Logger, scorer: &crate::lightning::routing::scoring::Score, random_seed_bytes: *const [u8; 32]) -> crate::c_types::derived::CResult_RouteLightningErrorZ {
+pub extern "C" fn find_route(mut our_node_pubkey: crate::c_types::PublicKey, route_params: &crate::lightning::routing::router::RouteParameters, network_graph: &crate::lightning::routing::gossip::ReadOnlyNetworkGraph, first_hops: *mut crate::c_types::derived::CVec_ChannelDetailsZ, mut logger: crate::lightning::util::logger::Logger, scorer: &crate::lightning::routing::scoring::Score, random_seed_bytes: *const [u8; 32]) -> crate::c_types::derived::CResult_RouteLightningErrorZ {
let mut local_first_hops_base = if first_hops == core::ptr::null_mut() { None } else { Some( { let mut local_first_hops_0 = Vec::new(); for mut item in unsafe { &mut *first_hops }.as_slice().iter() { local_first_hops_0.push( { item.get_native_ref() }); }; local_first_hops_0 }) }; let mut local_first_hops = local_first_hops_base.as_ref().map(|a| &a[..]);
- let mut ret = lightning::routing::router::find_route::<crate::lightning::util::logger::Logger, crate::lightning::routing::scoring::Score>(&our_node_pubkey.into_rust(), route_params.get_native_ref(), network.get_native_ref(), local_first_hops, logger, scorer, unsafe { &*random_seed_bytes});
+ let mut ret = lightning::routing::router::find_route::<crate::lightning::util::logger::Logger, crate::lightning::routing::scoring::Score>(&our_node_pubkey.into_rust(), route_params.get_native_ref(), network_graph.get_native_ref(), local_first_hops, logger, scorer, unsafe { &*random_seed_bytes});
+ let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::router::Route { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::LightningError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+ local_ret
+}
+
+/// Construct a route from us (payer) to the target node (payee) via the given hops (which should
+/// exclude the payer, but include the payee). This may be useful, e.g., for probing the chosen path.
+///
+/// Re-uses logic from `find_route`, so the restrictions described there also apply here.
+#[no_mangle]
+pub extern "C" fn build_route_from_hops(mut our_node_pubkey: crate::c_types::PublicKey, mut hops: crate::c_types::derived::CVec_PublicKeyZ, route_params: &crate::lightning::routing::router::RouteParameters, network_graph: &crate::lightning::routing::gossip::ReadOnlyNetworkGraph, mut logger: crate::lightning::util::logger::Logger, random_seed_bytes: *const [u8; 32]) -> crate::c_types::derived::CResult_RouteLightningErrorZ {
+ let mut local_hops = Vec::new(); for mut item in hops.into_rust().drain(..) { local_hops.push( { item.into_rust() }); };
+ let mut ret = lightning::routing::router::build_route_from_hops::<crate::lightning::util::logger::Logger>(&our_node_pubkey.into_rust(), &local_hops[..], route_params.get_native_ref(), network_graph.get_native_ref(), logger, unsafe { &*random_seed_bytes});
let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::router::Route { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::LightningError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
local_ret
}
//! # Example
//!
//! ```
-//! # extern crate secp256k1;
+//! # extern crate bitcoin;
//! #
-//! # use lightning::routing::network_graph::NetworkGraph;
+//! # use lightning::routing::gossip::NetworkGraph;
//! # use lightning::routing::router::{RouteParameters, find_route};
-//! # use lightning::routing::scoring::{ProbabilisticScorer, ProbabilisticScoringParameters, Scorer, ScoringParameters};
+//! # use lightning::routing::scoring::{ProbabilisticScorer, ProbabilisticScoringParameters};
//! # use lightning::chain::keysinterface::{KeysManager, KeysInterface};
//! # use lightning::util::logger::{Logger, Record};
-//! # use secp256k1::key::PublicKey;
+//! # use bitcoin::secp256k1::PublicKey;
//! #
//! # struct FakeLogger {};
//! # impl Logger for FakeLogger {
//! # fn log(&self, record: &Record) { unimplemented!() }
//! # }
-//! # fn find_scored_route(payer: PublicKey, route_params: RouteParameters, network_graph: NetworkGraph) {
+//! # fn find_scored_route(payer: PublicKey, route_params: RouteParameters, network_graph: NetworkGraph<&FakeLogger>) {
//! # let logger = FakeLogger {};
//! #
//! // Use the default channel penalties.
//! let params = ProbabilisticScoringParameters::default();
-//! let scorer = ProbabilisticScorer::new(params, &network_graph);
+//! let scorer = ProbabilisticScorer::new(params, &network_graph, &logger);
//!
//! // Or use custom channel penalties.
//! let params = ProbabilisticScoringParameters {
//! liquidity_penalty_multiplier_msat: 2 * 1000,
//! ..ProbabilisticScoringParameters::default()
//! };
-//! let scorer = ProbabilisticScorer::new(params, &network_graph);
+//! let scorer = ProbabilisticScorer::new(params, &network_graph, &logger);
//! # let random_seed_bytes = [42u8; 32];
//!
-//! let route = find_route(&payer, &route_params, &network_graph, None, &logger, &scorer, &random_seed_bytes);
+//! let route = find_route(&payer, &route_params, &network_graph.read_only(), None, &logger, &scorer, &random_seed_bytes);
//! # }
//! ```
//!
/// [`u64::max_value`] is given to indicate sufficient capacity for the invoice's full amount.
/// Thus, implementations should be overflow-safe.
#[must_use]
- pub channel_penalty_msat: extern "C" fn (this_arg: *const c_void, short_channel_id: u64, send_amt_msat: u64, capacity_msat: u64, source: &crate::lightning::routing::network_graph::NodeId, target: &crate::lightning::routing::network_graph::NodeId) -> u64,
+ pub channel_penalty_msat: extern "C" fn (this_arg: *const c_void, short_channel_id: u64, source: &crate::lightning::routing::gossip::NodeId, target: &crate::lightning::routing::gossip::NodeId, usage: crate::lightning::routing::scoring::ChannelUsage) -> u64,
/// Handles updating channel penalties after failing to route through a channel.
pub payment_path_failed: extern "C" fn (this_arg: *mut c_void, path: crate::c_types::derived::CVec_RouteHopZ, short_channel_id: u64),
/// Handles updating channel penalties after successfully routing along a path.
use lightning::routing::scoring::Score as rustScore;
impl rustScore for Score {
- fn channel_penalty_msat(&self, mut short_channel_id: u64, mut send_amt_msat: u64, mut capacity_msat: u64, mut source: &lightning::routing::network_graph::NodeId, mut target: &lightning::routing::network_graph::NodeId) -> u64 {
- let mut ret = (self.channel_penalty_msat)(self.this_arg, short_channel_id, send_amt_msat, capacity_msat, &crate::lightning::routing::network_graph::NodeId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((source as *const lightning::routing::network_graph::NodeId<>) as *mut _) }, is_owned: false }, &crate::lightning::routing::network_graph::NodeId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((target as *const lightning::routing::network_graph::NodeId<>) as *mut _) }, is_owned: false });
+ fn channel_penalty_msat(&self, mut short_channel_id: u64, mut source: &lightning::routing::gossip::NodeId, mut target: &lightning::routing::gossip::NodeId, mut usage: lightning::routing::scoring::ChannelUsage) -> u64 {
+ let mut ret = (self.channel_penalty_msat)(self.this_arg, short_channel_id, &crate::lightning::routing::gossip::NodeId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((source as *const lightning::routing::gossip::NodeId<>) as *mut _) }, is_owned: false }, &crate::lightning::routing::gossip::NodeId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((target as *const lightning::routing::gossip::NodeId<>) as *mut _) }, is_owned: false }, crate::lightning::routing::scoring::ChannelUsage { inner: ObjOps::heap_alloc(usage), is_owned: true });
ret
}
fn payment_path_failed(&mut self, mut path: &[&lightning::routing::router::RouteHop], mut short_channel_id: u64) {
ret
}
}
+#[no_mangle]
+/// Serialize the MultiThreadedLockableScore object into a byte array which can be read by MultiThreadedLockableScore_read
+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]
+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) })
+}
/// Creates a new [`MultiThreadedLockableScore`] given an underlying [`Score`].
#[must_use]
#[no_mangle]
}
-use lightning::routing::scoring::FixedPenaltyScorer as nativeFixedPenaltyScorerImport;
-pub(crate) type nativeFixedPenaltyScorer = nativeFixedPenaltyScorerImport;
+use lightning::routing::scoring::ChannelUsage as nativeChannelUsageImport;
+pub(crate) type nativeChannelUsage = nativeChannelUsageImport;
-/// [`Score`] implementation that uses a fixed penalty.
+/// Proposed use of a channel passed as a parameter to [`Score::channel_penalty_msat`].
#[must_use]
#[repr(C)]
-pub struct FixedPenaltyScorer {
+pub struct ChannelUsage {
/// 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 nativeFixedPenaltyScorer,
+ pub inner: *mut nativeChannelUsage,
/// 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
pub is_owned: bool,
}
-impl Drop for FixedPenaltyScorer {
+impl Drop for ChannelUsage {
fn drop(&mut self) {
- if self.is_owned && !<*mut nativeFixedPenaltyScorer>::is_null(self.inner) {
+ if self.is_owned && !<*mut nativeChannelUsage>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
}
}
}
-/// Frees any resources used by the FixedPenaltyScorer, if is_owned is set and inner is non-NULL.
+/// Frees any resources used by the ChannelUsage, if is_owned is set and inner is non-NULL.
#[no_mangle]
-pub extern "C" fn FixedPenaltyScorer_free(this_obj: FixedPenaltyScorer) { }
+pub extern "C" fn ChannelUsage_free(this_obj: 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_free_void(this_ptr: *mut c_void) {
- unsafe { let _ = Box::from_raw(this_ptr as *mut nativeFixedPenaltyScorer); }
+pub(crate) extern "C" fn ChannelUsage_free_void(this_ptr: *mut c_void) {
+ unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelUsage); }
}
#[allow(unused)]
-impl FixedPenaltyScorer {
- pub(crate) fn get_native_ref(&self) -> &'static nativeFixedPenaltyScorer {
+impl ChannelUsage {
+ pub(crate) fn get_native_ref(&self) -> &'static nativeChannelUsage {
unsafe { &*ObjOps::untweak_ptr(self.inner) }
}
- pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeFixedPenaltyScorer {
+ pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeChannelUsage {
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 nativeFixedPenaltyScorer {
+ pub(crate) fn take_inner(mut self) -> *mut nativeChannelUsage {
assert!(self.is_owned);
let ret = ObjOps::untweak_ptr(self.inner);
self.inner = core::ptr::null_mut();
ret
}
}
-impl Clone for FixedPenaltyScorer {
- fn clone(&self) -> Self {
- Self {
- inner: if <*mut nativeFixedPenaltyScorer>::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 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
-}
+/// The amount to send through the channel, denominated in millisatoshis.
#[no_mangle]
-/// Creates a copy of the FixedPenaltyScorer
-pub extern "C" fn FixedPenaltyScorer_clone(orig: &FixedPenaltyScorer) -> FixedPenaltyScorer {
- orig.clone()
+pub extern "C" fn ChannelUsage_get_amount_msat(this_ptr: &ChannelUsage) -> u64 {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().amount_msat;
+ *inner_val
}
-/// Creates a new scorer using `penalty_msat`.
-#[must_use]
+/// The amount to send through the channel, denominated in millisatoshis.
#[no_mangle]
-pub extern "C" fn FixedPenaltyScorer_with_penalty(mut penalty_msat: u64) -> crate::lightning::routing::scoring::FixedPenaltyScorer {
- let mut ret = lightning::routing::scoring::FixedPenaltyScorer::with_penalty(penalty_msat);
- crate::lightning::routing::scoring::FixedPenaltyScorer { inner: ObjOps::heap_alloc(ret), is_owned: true }
+pub extern "C" fn ChannelUsage_set_amount_msat(this_ptr: &mut ChannelUsage, mut val: u64) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.amount_msat = val;
}
-
-impl From<nativeFixedPenaltyScorer> for crate::lightning::routing::scoring::Score {
- fn from(obj: nativeFixedPenaltyScorer) -> Self {
- let mut rust_obj = FixedPenaltyScorer { inner: ObjOps::heap_alloc(obj), is_owned: true };
- let mut ret = FixedPenaltyScorer_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();
- ret.free = Some(FixedPenaltyScorer_free_void);
- ret
- }
-}
-/// Constructs a new Score which calls the relevant methods on this_arg.
-/// This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is
+/// Total amount, denominated in millisatoshis, already allocated to send through the channel
+/// as part of a multi-path payment.
#[no_mangle]
-pub extern "C" fn FixedPenaltyScorer_as_Score(this_arg: &FixedPenaltyScorer) -> crate::lightning::routing::scoring::Score {
- crate::lightning::routing::scoring::Score {
- this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void },
- free: None,
- channel_penalty_msat: FixedPenaltyScorer_Score_channel_penalty_msat,
- payment_path_failed: FixedPenaltyScorer_Score_payment_path_failed,
- payment_path_successful: FixedPenaltyScorer_Score_payment_path_successful,
- write: FixedPenaltyScorer_write_void,
- }
-}
-
-#[must_use]
-extern "C" fn FixedPenaltyScorer_Score_channel_penalty_msat(this_arg: *const c_void, unused_0: u64, unused_1: u64, unused_2: u64, unused_3: &crate::lightning::routing::network_graph::NodeId, unused_4: &crate::lightning::routing::network_graph::NodeId) -> u64 {
- let mut ret = <nativeFixedPenaltyScorer as lightning::routing::scoring::Score<>>::channel_penalty_msat(unsafe { &mut *(this_arg as *mut nativeFixedPenaltyScorer) }, unused_0, unused_1, unused_2, unused_3.get_native_ref(), unused_4.get_native_ref());
- ret
-}
-extern "C" fn FixedPenaltyScorer_Score_payment_path_failed(this_arg: *mut c_void, mut _path: crate::c_types::derived::CVec_RouteHopZ, mut _short_channel_id: u64) {
- let mut local__path = Vec::new(); for mut item in _path.as_slice().iter() { local__path.push( { item.get_native_ref() }); };
- <nativeFixedPenaltyScorer as lightning::routing::scoring::Score<>>::payment_path_failed(unsafe { &mut *(this_arg as *mut nativeFixedPenaltyScorer) }, &local__path[..], _short_channel_id)
-}
-extern "C" fn FixedPenaltyScorer_Score_payment_path_successful(this_arg: *mut c_void, mut _path: crate::c_types::derived::CVec_RouteHopZ) {
- let mut local__path = Vec::new(); for mut item in _path.as_slice().iter() { local__path.push( { item.get_native_ref() }); };
- <nativeFixedPenaltyScorer as lightning::routing::scoring::Score<>>::payment_path_successful(unsafe { &mut *(this_arg as *mut nativeFixedPenaltyScorer) }, &local__path[..])
+pub extern "C" fn ChannelUsage_get_inflight_htlc_msat(this_ptr: &ChannelUsage) -> u64 {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().inflight_htlc_msat;
+ *inner_val
}
-
+/// Total amount, denominated in millisatoshis, already allocated to send through the channel
+/// as part of a multi-path payment.
#[no_mangle]
-/// Serialize the FixedPenaltyScorer object into a byte array which can be read by FixedPenaltyScorer_read
-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())
+pub extern "C" fn ChannelUsage_set_inflight_htlc_msat(this_ptr: &mut ChannelUsage, mut val: u64) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.inflight_htlc_msat = val;
}
+/// The effective capacity of the channel.
#[no_mangle]
-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) })
+pub extern "C" fn ChannelUsage_get_effective_capacity(this_ptr: &ChannelUsage) -> crate::lightning::routing::gossip::EffectiveCapacity {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().effective_capacity;
+ crate::lightning::routing::gossip::EffectiveCapacity::from_native(inner_val)
}
+/// The effective capacity of the channel.
#[no_mangle]
-/// Read a FixedPenaltyScorer from a byte array, created by FixedPenaltyScorer_write
-pub extern "C" fn FixedPenaltyScorer_read(ser: crate::c_types::u8slice, arg: u64) -> crate::c_types::derived::CResult_FixedPenaltyScorerDecodeErrorZ {
- let arg_conv = arg;
- let res: Result<lightning::routing::scoring::FixedPenaltyScorer, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj_arg(ser, arg_conv);
- let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::scoring::FixedPenaltyScorer { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
- local_res
+pub extern "C" fn ChannelUsage_set_effective_capacity(this_ptr: &mut ChannelUsage, mut val: crate::lightning::routing::gossip::EffectiveCapacity) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.effective_capacity = val.into_native();
}
-
-use lightning::routing::scoring::Scorer as nativeScorerImport;
-pub(crate) type nativeScorer = nativeScorerImport;
-
-/// [`Score`] implementation that provides reasonable default behavior.
-///
-/// Used to apply a fixed penalty to each channel, thus avoiding long paths when shorter paths with
-/// slightly higher fees are available. Will further penalize channels that fail to relay payments.
-///
-/// See [module-level documentation] for usage and [`ScoringParameters`] for customization.
-///
-/// # Note
-///
-/// Mixing the `no-std` feature between serialization and deserialization results in undefined
-/// behavior.
-///
-/// [module-level documentation]: crate::routing::scoring
+/// Constructs a new ChannelUsage given each field
#[must_use]
-#[repr(C)]
-pub struct Scorer {
- /// A pointer to the opaque Rust object.
-
- /// Nearly everywhere, inner must be non-null, however in places where
- /// the Rust equivalent takes an Option, it may be set to null to indicate None.
- pub inner: *mut nativeScorer,
- /// Indicates that this is the only struct which contains the same pointer.
-
- /// Rust functions which take ownership of an object provided via an argument require
- /// this to be true and invalidate the object pointed to by inner.
- pub is_owned: bool,
+#[no_mangle]
+pub extern "C" fn ChannelUsage_new(mut amount_msat_arg: u64, mut inflight_htlc_msat_arg: u64, mut effective_capacity_arg: crate::lightning::routing::gossip::EffectiveCapacity) -> ChannelUsage {
+ ChannelUsage { inner: ObjOps::heap_alloc(nativeChannelUsage {
+ amount_msat: amount_msat_arg,
+ inflight_htlc_msat: inflight_htlc_msat_arg,
+ effective_capacity: effective_capacity_arg.into_native(),
+ }), is_owned: true }
}
-
-impl Drop for Scorer {
- fn drop(&mut self) {
- if self.is_owned && !<*mut nativeScorer>::is_null(self.inner) {
- let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+impl Clone for ChannelUsage {
+ fn clone(&self) -> Self {
+ Self {
+ inner: if <*mut nativeChannelUsage>::is_null(self.inner) { core::ptr::null_mut() } else {
+ ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
+ is_owned: true,
}
}
}
-/// Frees any resources used by the Scorer, if is_owned is set and inner is non-NULL.
-#[no_mangle]
-pub extern "C" fn Scorer_free(this_obj: Scorer) { }
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
-pub(crate) extern "C" fn Scorer_free_void(this_ptr: *mut c_void) {
- unsafe { let _ = Box::from_raw(this_ptr as *mut nativeScorer); }
+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
}
-#[allow(unused)]
-impl Scorer {
- pub(crate) fn get_native_ref(&self) -> &'static nativeScorer {
- unsafe { &*ObjOps::untweak_ptr(self.inner) }
- }
- pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeScorer {
- unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
- }
- /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
- pub(crate) fn take_inner(mut self) -> *mut nativeScorer {
- assert!(self.is_owned);
- let ret = ObjOps::untweak_ptr(self.inner);
- self.inner = core::ptr::null_mut();
- ret
- }
+#[no_mangle]
+/// Creates a copy of the ChannelUsage
+pub extern "C" fn ChannelUsage_clone(orig: &ChannelUsage) -> ChannelUsage {
+ orig.clone()
}
-use lightning::routing::scoring::ScoringParameters as nativeScoringParametersImport;
-pub(crate) type nativeScoringParameters = nativeScoringParametersImport;
+use lightning::routing::scoring::FixedPenaltyScorer as nativeFixedPenaltyScorerImport;
+pub(crate) type nativeFixedPenaltyScorer = nativeFixedPenaltyScorerImport;
-/// Parameters for configuring [`Scorer`].
+/// [`Score`] implementation that uses a fixed penalty.
#[must_use]
#[repr(C)]
-pub struct ScoringParameters {
+pub struct FixedPenaltyScorer {
/// A pointer to the opaque Rust object.
/// Nearly everywhere, inner must be non-null, however in places where
/// the Rust equivalent takes an Option, it may be set to null to indicate None.
- pub inner: *mut nativeScoringParameters,
+ pub inner: *mut nativeFixedPenaltyScorer,
/// 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
pub is_owned: bool,
}
-impl Drop for ScoringParameters {
+impl Drop for FixedPenaltyScorer {
fn drop(&mut self) {
- if self.is_owned && !<*mut nativeScoringParameters>::is_null(self.inner) {
+ if self.is_owned && !<*mut nativeFixedPenaltyScorer>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
}
}
}
-/// Frees any resources used by the ScoringParameters, if is_owned is set and inner is non-NULL.
+/// Frees any resources used by the FixedPenaltyScorer, if is_owned is set and inner is non-NULL.
#[no_mangle]
-pub extern "C" fn ScoringParameters_free(this_obj: ScoringParameters) { }
+pub extern "C" fn FixedPenaltyScorer_free(this_obj: FixedPenaltyScorer) { }
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
-pub(crate) extern "C" fn ScoringParameters_free_void(this_ptr: *mut c_void) {
- unsafe { let _ = Box::from_raw(this_ptr as *mut nativeScoringParameters); }
+pub(crate) extern "C" fn FixedPenaltyScorer_free_void(this_ptr: *mut c_void) {
+ unsafe { let _ = Box::from_raw(this_ptr as *mut nativeFixedPenaltyScorer); }
}
#[allow(unused)]
-impl ScoringParameters {
- pub(crate) fn get_native_ref(&self) -> &'static nativeScoringParameters {
+impl FixedPenaltyScorer {
+ pub(crate) fn get_native_ref(&self) -> &'static nativeFixedPenaltyScorer {
unsafe { &*ObjOps::untweak_ptr(self.inner) }
}
- pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeScoringParameters {
+ pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeFixedPenaltyScorer {
unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
}
/// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
- pub(crate) fn take_inner(mut self) -> *mut nativeScoringParameters {
+ pub(crate) fn take_inner(mut self) -> *mut nativeFixedPenaltyScorer {
assert!(self.is_owned);
let ret = ObjOps::untweak_ptr(self.inner);
self.inner = core::ptr::null_mut();
ret
}
}
-/// A fixed penalty in msats to apply to each channel.
-///
-/// Default value: 500 msat
-#[no_mangle]
-pub extern "C" fn ScoringParameters_get_base_penalty_msat(this_ptr: &ScoringParameters) -> u64 {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().base_penalty_msat;
- *inner_val
-}
-/// A fixed penalty in msats to apply to each channel.
-///
-/// Default value: 500 msat
-#[no_mangle]
-pub extern "C" fn ScoringParameters_set_base_penalty_msat(this_ptr: &mut ScoringParameters, mut val: u64) {
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.base_penalty_msat = val;
-}
-/// A penalty in msats to apply to a channel upon failing to relay a payment.
-///
-/// This accumulates for each failure but may be reduced over time based on
-/// [`failure_penalty_half_life`] or when successfully routing through a channel.
-///
-/// Default value: 1,024,000 msat
-///
-/// [`failure_penalty_half_life`]: Self::failure_penalty_half_life
-#[no_mangle]
-pub extern "C" fn ScoringParameters_get_failure_penalty_msat(this_ptr: &ScoringParameters) -> u64 {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().failure_penalty_msat;
- *inner_val
-}
-/// A penalty in msats to apply to a channel upon failing to relay a payment.
-///
-/// This accumulates for each failure but may be reduced over time based on
-/// [`failure_penalty_half_life`] or when successfully routing through a channel.
-///
-/// Default value: 1,024,000 msat
-///
-/// [`failure_penalty_half_life`]: Self::failure_penalty_half_life
-#[no_mangle]
-pub extern "C" fn ScoringParameters_set_failure_penalty_msat(this_ptr: &mut ScoringParameters, mut val: u64) {
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.failure_penalty_msat = val;
-}
-/// When the amount being sent over a channel is this many 1024ths of the total channel
-/// capacity, we begin applying [`overuse_penalty_msat_per_1024th`].
-///
-/// Default value: 128 1024ths (i.e. begin penalizing when an HTLC uses 1/8th of a channel)
-///
-/// [`overuse_penalty_msat_per_1024th`]: Self::overuse_penalty_msat_per_1024th
-#[no_mangle]
-pub extern "C" fn ScoringParameters_get_overuse_penalty_start_1024th(this_ptr: &ScoringParameters) -> u16 {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().overuse_penalty_start_1024th;
- *inner_val
-}
-/// When the amount being sent over a channel is this many 1024ths of the total channel
-/// capacity, we begin applying [`overuse_penalty_msat_per_1024th`].
-///
-/// Default value: 128 1024ths (i.e. begin penalizing when an HTLC uses 1/8th of a channel)
-///
-/// [`overuse_penalty_msat_per_1024th`]: Self::overuse_penalty_msat_per_1024th
-#[no_mangle]
-pub extern "C" fn ScoringParameters_set_overuse_penalty_start_1024th(this_ptr: &mut ScoringParameters, mut val: u16) {
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.overuse_penalty_start_1024th = val;
-}
-/// A penalty applied, per whole 1024ths of the channel capacity which the amount being sent
-/// over the channel exceeds [`overuse_penalty_start_1024th`] by.
-///
-/// Default value: 20 msat (i.e. 2560 msat penalty to use 1/4th of a channel, 7680 msat penalty
-/// to use half a channel, and 12,560 msat penalty to use 3/4ths of a channel)
-///
-/// [`overuse_penalty_start_1024th`]: Self::overuse_penalty_start_1024th
-#[no_mangle]
-pub extern "C" fn ScoringParameters_get_overuse_penalty_msat_per_1024th(this_ptr: &ScoringParameters) -> u64 {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().overuse_penalty_msat_per_1024th;
- *inner_val
-}
-/// A penalty applied, per whole 1024ths of the channel capacity which the amount being sent
-/// over the channel exceeds [`overuse_penalty_start_1024th`] by.
-///
-/// Default value: 20 msat (i.e. 2560 msat penalty to use 1/4th of a channel, 7680 msat penalty
-/// to use half a channel, and 12,560 msat penalty to use 3/4ths of a channel)
-///
-/// [`overuse_penalty_start_1024th`]: Self::overuse_penalty_start_1024th
-#[no_mangle]
-pub extern "C" fn ScoringParameters_set_overuse_penalty_msat_per_1024th(this_ptr: &mut ScoringParameters, mut val: u64) {
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.overuse_penalty_msat_per_1024th = val;
-}
-/// The time required to elapse before any accumulated [`failure_penalty_msat`] penalties are
-/// cut in half.
-///
-/// Successfully routing through a channel will immediately cut the penalty in half as well.
-///
-/// Default value: 1 hour
-///
-/// # Note
-///
-/// When built with the `no-std` feature, time will never elapse. Therefore, this penalty will
-/// never decay.
-///
-/// [`failure_penalty_msat`]: Self::failure_penalty_msat
-#[no_mangle]
-pub extern "C" fn ScoringParameters_get_failure_penalty_half_life(this_ptr: &ScoringParameters) -> u64 {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().failure_penalty_half_life;
- inner_val.as_secs()
-}
-/// The time required to elapse before any accumulated [`failure_penalty_msat`] penalties are
-/// cut in half.
-///
-/// Successfully routing through a channel will immediately cut the penalty in half as well.
-///
-/// Default value: 1 hour
-///
-/// # Note
-///
-/// When built with the `no-std` feature, time will never elapse. Therefore, this penalty will
-/// never decay.
-///
-/// [`failure_penalty_msat`]: Self::failure_penalty_msat
-#[no_mangle]
-pub extern "C" fn ScoringParameters_set_failure_penalty_half_life(this_ptr: &mut ScoringParameters, mut val: u64) {
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.failure_penalty_half_life = core::time::Duration::from_secs(val);
-}
-/// Constructs a new ScoringParameters given each field
-#[must_use]
-#[no_mangle]
-pub extern "C" fn ScoringParameters_new(mut base_penalty_msat_arg: u64, mut failure_penalty_msat_arg: u64, mut overuse_penalty_start_1024th_arg: u16, mut overuse_penalty_msat_per_1024th_arg: u64, mut failure_penalty_half_life_arg: u64) -> ScoringParameters {
- ScoringParameters { inner: ObjOps::heap_alloc(nativeScoringParameters {
- base_penalty_msat: base_penalty_msat_arg,
- failure_penalty_msat: failure_penalty_msat_arg,
- overuse_penalty_start_1024th: overuse_penalty_start_1024th_arg,
- overuse_penalty_msat_per_1024th: overuse_penalty_msat_per_1024th_arg,
- failure_penalty_half_life: core::time::Duration::from_secs(failure_penalty_half_life_arg),
- }), is_owned: true }
-}
-impl Clone for ScoringParameters {
+impl Clone for FixedPenaltyScorer {
fn clone(&self) -> Self {
Self {
- inner: if <*mut nativeScoringParameters>::is_null(self.inner) { core::ptr::null_mut() } else {
+ inner: if <*mut nativeFixedPenaltyScorer>::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 ScoringParameters_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeScoringParameters)).clone() })) as *mut c_void
+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
}
#[no_mangle]
-/// Creates a copy of the ScoringParameters
-pub extern "C" fn ScoringParameters_clone(orig: &ScoringParameters) -> ScoringParameters {
+/// Creates a copy of the FixedPenaltyScorer
+pub extern "C" fn FixedPenaltyScorer_clone(orig: &FixedPenaltyScorer) -> FixedPenaltyScorer {
orig.clone()
}
-#[no_mangle]
-/// Serialize the ScoringParameters object into a byte array which can be read by ScoringParameters_read
-pub extern "C" fn ScoringParameters_write(obj: &crate::lightning::routing::scoring::ScoringParameters) -> crate::c_types::derived::CVec_u8Z {
- crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
-}
-#[no_mangle]
-pub(crate) extern "C" fn ScoringParameters_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
- crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeScoringParameters) })
-}
-#[no_mangle]
-/// Read a ScoringParameters from a byte array, created by ScoringParameters_write
-pub extern "C" fn ScoringParameters_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ScoringParametersDecodeErrorZ {
- let res: Result<lightning::routing::scoring::ScoringParameters, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
- let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::scoring::ScoringParameters { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
- local_res
-}
-/// Creates a new scorer using the given scoring parameters.
+/// Creates a new scorer using `penalty_msat`.
#[must_use]
#[no_mangle]
-pub extern "C" fn Scorer_new(mut params: crate::lightning::routing::scoring::ScoringParameters) -> crate::lightning::routing::scoring::Scorer {
- let mut ret = lightning::routing::scoring::Scorer::new(*unsafe { Box::from_raw(params.take_inner()) });
- crate::lightning::routing::scoring::Scorer { inner: ObjOps::heap_alloc(ret), is_owned: true }
+pub extern "C" fn FixedPenaltyScorer_with_penalty(mut penalty_msat: u64) -> crate::lightning::routing::scoring::FixedPenaltyScorer {
+ let mut ret = lightning::routing::scoring::FixedPenaltyScorer::with_penalty(penalty_msat);
+ crate::lightning::routing::scoring::FixedPenaltyScorer { inner: ObjOps::heap_alloc(ret), is_owned: true }
}
-/// Creates a "default" Scorer. See struct and individual field documentaiton for details on which values are used.
-#[must_use]
-#[no_mangle]
-pub extern "C" fn Scorer_default() -> Scorer {
- Scorer { inner: ObjOps::heap_alloc(Default::default()), is_owned: true }
-}
-/// Creates a "default" ScoringParameters. See struct and individual field documentaiton for details on which values are used.
-#[must_use]
-#[no_mangle]
-pub extern "C" fn ScoringParameters_default() -> ScoringParameters {
- ScoringParameters { inner: ObjOps::heap_alloc(Default::default()), is_owned: true }
-}
-impl From<nativeScorer> for crate::lightning::routing::scoring::Score {
- fn from(obj: nativeScorer) -> Self {
- let mut rust_obj = Scorer { inner: ObjOps::heap_alloc(obj), is_owned: true };
- let mut ret = Scorer_as_Score(&rust_obj);
+impl From<nativeFixedPenaltyScorer> for crate::lightning::routing::scoring::Score {
+ fn from(obj: nativeFixedPenaltyScorer) -> Self {
+ let mut rust_obj = FixedPenaltyScorer { inner: ObjOps::heap_alloc(obj), is_owned: true };
+ let mut ret = FixedPenaltyScorer_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();
- ret.free = Some(Scorer_free_void);
+ ret.free = Some(FixedPenaltyScorer_free_void);
ret
}
}
/// Constructs a new Score which calls the relevant methods on this_arg.
/// This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is
#[no_mangle]
-pub extern "C" fn Scorer_as_Score(this_arg: &Scorer) -> crate::lightning::routing::scoring::Score {
+pub extern "C" fn FixedPenaltyScorer_as_Score(this_arg: &FixedPenaltyScorer) -> crate::lightning::routing::scoring::Score {
crate::lightning::routing::scoring::Score {
this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void },
free: None,
- channel_penalty_msat: Scorer_Score_channel_penalty_msat,
- payment_path_failed: Scorer_Score_payment_path_failed,
- payment_path_successful: Scorer_Score_payment_path_successful,
- write: Scorer_write_void,
+ channel_penalty_msat: FixedPenaltyScorer_Score_channel_penalty_msat,
+ payment_path_failed: FixedPenaltyScorer_Score_payment_path_failed,
+ payment_path_successful: FixedPenaltyScorer_Score_payment_path_successful,
+ write: FixedPenaltyScorer_write_void,
}
}
#[must_use]
-extern "C" fn Scorer_Score_channel_penalty_msat(this_arg: *const c_void, mut short_channel_id: u64, mut send_amt_msat: u64, mut capacity_msat: u64, _source: &crate::lightning::routing::network_graph::NodeId, _target: &crate::lightning::routing::network_graph::NodeId) -> u64 {
- let mut ret = <nativeScorer as lightning::routing::scoring::Score<>>::channel_penalty_msat(unsafe { &mut *(this_arg as *mut nativeScorer) }, short_channel_id, send_amt_msat, capacity_msat, _source.get_native_ref(), _target.get_native_ref());
+extern "C" fn FixedPenaltyScorer_Score_channel_penalty_msat(this_arg: *const c_void, unused_0: u64, unused_1: &crate::lightning::routing::gossip::NodeId, unused_2: &crate::lightning::routing::gossip::NodeId, unused_3: crate::lightning::routing::scoring::ChannelUsage) -> u64 {
+ let mut ret = <nativeFixedPenaltyScorer as lightning::routing::scoring::Score<>>::channel_penalty_msat(unsafe { &mut *(this_arg as *mut nativeFixedPenaltyScorer) }, unused_0, unused_1.get_native_ref(), unused_2.get_native_ref(), *unsafe { Box::from_raw(unused_3.take_inner()) });
ret
}
-extern "C" fn Scorer_Score_payment_path_failed(this_arg: *mut c_void, mut _path: crate::c_types::derived::CVec_RouteHopZ, mut short_channel_id: u64) {
+extern "C" fn FixedPenaltyScorer_Score_payment_path_failed(this_arg: *mut c_void, mut _path: crate::c_types::derived::CVec_RouteHopZ, mut _short_channel_id: u64) {
let mut local__path = Vec::new(); for mut item in _path.as_slice().iter() { local__path.push( { item.get_native_ref() }); };
- <nativeScorer as lightning::routing::scoring::Score<>>::payment_path_failed(unsafe { &mut *(this_arg as *mut nativeScorer) }, &local__path[..], short_channel_id)
+ <nativeFixedPenaltyScorer as lightning::routing::scoring::Score<>>::payment_path_failed(unsafe { &mut *(this_arg as *mut nativeFixedPenaltyScorer) }, &local__path[..], _short_channel_id)
}
-extern "C" fn Scorer_Score_payment_path_successful(this_arg: *mut c_void, mut path: crate::c_types::derived::CVec_RouteHopZ) {
- let mut local_path = Vec::new(); for mut item in path.as_slice().iter() { local_path.push( { item.get_native_ref() }); };
- <nativeScorer as lightning::routing::scoring::Score<>>::payment_path_successful(unsafe { &mut *(this_arg as *mut nativeScorer) }, &local_path[..])
+extern "C" fn FixedPenaltyScorer_Score_payment_path_successful(this_arg: *mut c_void, mut _path: crate::c_types::derived::CVec_RouteHopZ) {
+ let mut local__path = Vec::new(); for mut item in _path.as_slice().iter() { local__path.push( { item.get_native_ref() }); };
+ <nativeFixedPenaltyScorer as lightning::routing::scoring::Score<>>::payment_path_successful(unsafe { &mut *(this_arg as *mut nativeFixedPenaltyScorer) }, &local__path[..])
}
#[no_mangle]
-/// Serialize the Scorer object into a byte array which can be read by Scorer_read
-pub extern "C" fn Scorer_write(obj: &crate::lightning::routing::scoring::Scorer) -> crate::c_types::derived::CVec_u8Z {
+/// Serialize the FixedPenaltyScorer object into a byte array which can be read by FixedPenaltyScorer_read
+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]
-pub(crate) extern "C" fn Scorer_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
- crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeScorer) })
+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) })
}
#[no_mangle]
-/// Read a Scorer from a byte array, created by Scorer_write
-pub extern "C" fn Scorer_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ScorerDecodeErrorZ {
- let res: Result<lightning::routing::scoring::Scorer, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
- let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::scoring::Scorer { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+/// Read a FixedPenaltyScorer from a byte array, created by FixedPenaltyScorer_write
+pub extern "C" fn FixedPenaltyScorer_read(ser: crate::c_types::u8slice, arg: u64) -> crate::c_types::derived::CResult_FixedPenaltyScorerDecodeErrorZ {
+ let arg_conv = arg;
+ let res: Result<lightning::routing::scoring::FixedPenaltyScorer, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj_arg(ser, arg_conv);
+ let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::scoring::FixedPenaltyScorer { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
local_res
}
use lightning::routing::scoring::ProbabilisticScorer as nativeProbabilisticScorerImport;
-pub(crate) type nativeProbabilisticScorer = nativeProbabilisticScorerImport<&'static lightning::routing::network_graph::NetworkGraph>;
+pub(crate) type nativeProbabilisticScorer = nativeProbabilisticScorerImport<&'static lightning::routing::gossip::NetworkGraph<crate::lightning::util::logger::Logger>, crate::lightning::util::logger::Logger>;
/// [`Score`] implementation using channel success probability distributions.
///
/// through a network graph.
#[must_use]
#[no_mangle]
-pub extern "C" fn ProbabilisticScorer_new(mut params: crate::lightning::routing::scoring::ProbabilisticScoringParameters, network_graph: &crate::lightning::routing::network_graph::NetworkGraph) -> crate::lightning::routing::scoring::ProbabilisticScorer {
- let mut ret = lightning::routing::scoring::ProbabilisticScorer::new(*unsafe { Box::from_raw(params.take_inner()) }, network_graph.get_native_ref());
+pub extern "C" fn ProbabilisticScorer_new(mut params: crate::lightning::routing::scoring::ProbabilisticScoringParameters, network_graph: &crate::lightning::routing::gossip::NetworkGraph, mut logger: crate::lightning::util::logger::Logger) -> crate::lightning::routing::scoring::ProbabilisticScorer {
+ let mut ret = lightning::routing::scoring::ProbabilisticScorer::new(*unsafe { Box::from_raw(params.take_inner()) }, network_graph.get_native_ref(), logger);
crate::lightning::routing::scoring::ProbabilisticScorer { inner: ObjOps::heap_alloc(ret), is_owned: true }
}
+/// Dump the contents of this scorer into the configured logger.
+///
+/// Note that this writes roughly one line per channel for which we have a liquidity estimate,
+/// which may be a substantial amount of log output.
+#[no_mangle]
+pub extern "C" fn ProbabilisticScorer_debug_log_liquidity_stats(this_arg: &crate::lightning::routing::scoring::ProbabilisticScorer) {
+ unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.debug_log_liquidity_stats()
+}
+
/// Creates a "default" ProbabilisticScoringParameters. See struct and individual field documentaiton for details on which values are used.
#[must_use]
#[no_mangle]
}
#[must_use]
-extern "C" fn ProbabilisticScorer_Score_channel_penalty_msat(this_arg: *const c_void, mut short_channel_id: u64, mut amount_msat: u64, mut capacity_msat: u64, source: &crate::lightning::routing::network_graph::NodeId, target: &crate::lightning::routing::network_graph::NodeId) -> u64 {
- let mut ret = <nativeProbabilisticScorer as lightning::routing::scoring::Score<>>::channel_penalty_msat(unsafe { &mut *(this_arg as *mut nativeProbabilisticScorer) }, short_channel_id, amount_msat, capacity_msat, source.get_native_ref(), target.get_native_ref());
+extern "C" fn ProbabilisticScorer_Score_channel_penalty_msat(this_arg: *const c_void, mut short_channel_id: u64, source: &crate::lightning::routing::gossip::NodeId, target: &crate::lightning::routing::gossip::NodeId, mut usage: crate::lightning::routing::scoring::ChannelUsage) -> u64 {
+ let mut ret = <nativeProbabilisticScorer as lightning::routing::scoring::Score<>>::channel_penalty_msat(unsafe { &mut *(this_arg as *mut nativeProbabilisticScorer) }, short_channel_id, source.get_native_ref(), target.get_native_ref(), *unsafe { Box::from_raw(usage.take_inner()) });
ret
}
extern "C" fn ProbabilisticScorer_Score_payment_path_failed(this_arg: *mut c_void, mut path: crate::c_types::derived::CVec_RouteHopZ, mut short_channel_id: u64) {
}
#[no_mangle]
/// Read a ProbabilisticScorer from a byte array, created by ProbabilisticScorer_write
-pub extern "C" fn ProbabilisticScorer_read(ser: crate::c_types::u8slice, arg_a: crate::lightning::routing::scoring::ProbabilisticScoringParameters, arg_b: &crate::lightning::routing::network_graph::NetworkGraph) -> crate::c_types::derived::CResult_ProbabilisticScorerDecodeErrorZ {
+pub extern "C" fn ProbabilisticScorer_read(ser: crate::c_types::u8slice, arg_a: crate::lightning::routing::scoring::ProbabilisticScoringParameters, arg_b: &crate::lightning::routing::gossip::NetworkGraph, arg_c: crate::lightning::util::logger::Logger) -> crate::c_types::derived::CResult_ProbabilisticScorerDecodeErrorZ {
let arg_a_conv = *unsafe { Box::from_raw(arg_a.take_inner()) };
let arg_b_conv = arg_b.get_native_ref();
- let arg_conv = (arg_a_conv, arg_b_conv);
- let res: Result<lightning::routing::scoring::ProbabilisticScorer<&lightning::routing::network_graph::NetworkGraph>, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj_arg(ser, arg_conv);
+ let arg_c_conv = arg_c;
+ let arg_conv = (arg_a_conv, arg_b_conv, arg_c_conv);
+ let res: Result<lightning::routing::scoring::ProbabilisticScorer<&lightning::routing::gossip::NetworkGraph<crate::lightning::util::logger::Logger>, crate::lightning::util::logger::Logger>, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj_arg(ser, arg_conv);
let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::scoring::ProbabilisticScorer { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
local_res
}
-mod time {
-
-use alloc::str::FromStr;
-use core::ffi::c_void;
-use core::convert::Infallible;
-use bitcoin::hashes::Hash;
-use crate::c_types::*;
-#[cfg(feature="no-std")]
-use alloc::{vec::Vec, boxed::Box};
-
-}
/// Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
/// equivalent limit applied to outbound channels).
///
+/// A lower-bound of 1 is applied, requiring all channels to have a confirmed commitment
+/// transaction before operation. If you wish to accept channels with zero confirmations, see
+/// [`UserConfig::manually_accept_inbound_channels`] and
+/// [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`].
+///
/// Default value: 6.
+///
+/// [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
+/// [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf
#[no_mangle]
pub extern "C" fn ChannelHandshakeConfig_get_minimum_depth(this_ptr: &ChannelHandshakeConfig) -> u32 {
let mut inner_val = &mut this_ptr.get_native_mut_ref().minimum_depth;
/// Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
/// equivalent limit applied to outbound channels).
///
+/// A lower-bound of 1 is applied, requiring all channels to have a confirmed commitment
+/// transaction before operation. If you wish to accept channels with zero confirmations, see
+/// [`UserConfig::manually_accept_inbound_channels`] and
+/// [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`].
+///
/// Default value: 6.
+///
+/// [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
+/// [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf
#[no_mangle]
pub extern "C" fn ChannelHandshakeConfig_set_minimum_depth(this_ptr: &mut ChannelHandshakeConfig, mut val: u32) {
unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.minimum_depth = val;
pub extern "C" fn ChannelHandshakeConfig_set_our_htlc_minimum_msat(this_ptr: &mut ChannelHandshakeConfig, mut val: u64) {
unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.our_htlc_minimum_msat = val;
}
+/// Sets the percentage of the channel value we will cap the total value of outstanding inbound
+/// HTLCs to.
+///
+/// This can be set to a value between 1-100, where the value corresponds to the percent of the
+/// channel value in whole percentages.
+///
+/// Note that:
+/// * If configured to another value than the default value 10, any new channels created with
+/// the non default value will cause versions of LDK prior to 0.0.104 to refuse to read the
+/// `ChannelManager`.
+///
+/// * This caps the total value for inbound HTLCs in-flight only, and there's currently
+/// no way to configure the cap for the total value of outbound HTLCs in-flight.
+///
+/// * The requirements for your node being online to ensure the safety of HTLC-encumbered funds
+/// are different from the non-HTLC-encumbered funds. This makes this an important knob to
+/// restrict exposure to loss due to being offline for too long.
+/// See [`ChannelHandshakeConfig::our_to_self_delay`] and [`ChannelConfig::cltv_expiry_delta`]
+/// for more information.
+///
+/// Default value: 10.
+/// Minimum value: 1, any values less than 1 will be treated as 1 instead.
+/// Maximum value: 100, any values larger than 100 will be treated as 100 instead.
+#[no_mangle]
+pub extern "C" fn ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(this_ptr: &ChannelHandshakeConfig) -> u8 {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().max_inbound_htlc_value_in_flight_percent_of_channel;
+ *inner_val
+}
+/// Sets the percentage of the channel value we will cap the total value of outstanding inbound
+/// HTLCs to.
+///
+/// This can be set to a value between 1-100, where the value corresponds to the percent of the
+/// channel value in whole percentages.
+///
+/// Note that:
+/// * If configured to another value than the default value 10, any new channels created with
+/// the non default value will cause versions of LDK prior to 0.0.104 to refuse to read the
+/// `ChannelManager`.
+///
+/// * This caps the total value for inbound HTLCs in-flight only, and there's currently
+/// no way to configure the cap for the total value of outbound HTLCs in-flight.
+///
+/// * The requirements for your node being online to ensure the safety of HTLC-encumbered funds
+/// are different from the non-HTLC-encumbered funds. This makes this an important knob to
+/// restrict exposure to loss due to being offline for too long.
+/// See [`ChannelHandshakeConfig::our_to_self_delay`] and [`ChannelConfig::cltv_expiry_delta`]
+/// for more information.
+///
+/// Default value: 10.
+/// Minimum value: 1, any values less than 1 will be treated as 1 instead.
+/// Maximum value: 100, any values larger than 100 will be treated as 100 instead.
+#[no_mangle]
+pub extern "C" fn ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(this_ptr: &mut ChannelHandshakeConfig, mut val: u8) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.max_inbound_htlc_value_in_flight_percent_of_channel = val;
+}
/// If set, we attempt to negotiate the `scid_privacy` (referred to as `scid_alias` in the
/// BOLTs) option for outbound private channels. This provides better privacy by not including
/// our real on-chain channel UTXO in each invoice and requiring that our counterparty only
/// Constructs a new ChannelHandshakeConfig given each field
#[must_use]
#[no_mangle]
-pub extern "C" fn ChannelHandshakeConfig_new(mut minimum_depth_arg: u32, mut our_to_self_delay_arg: u16, mut our_htlc_minimum_msat_arg: u64, mut negotiate_scid_privacy_arg: bool) -> ChannelHandshakeConfig {
+pub extern "C" fn ChannelHandshakeConfig_new(mut minimum_depth_arg: u32, mut our_to_self_delay_arg: u16, mut our_htlc_minimum_msat_arg: u64, mut max_inbound_htlc_value_in_flight_percent_of_channel_arg: u8, mut negotiate_scid_privacy_arg: bool) -> ChannelHandshakeConfig {
ChannelHandshakeConfig { inner: ObjOps::heap_alloc(nativeChannelHandshakeConfig {
minimum_depth: minimum_depth_arg,
our_to_self_delay: our_to_self_delay_arg,
our_htlc_minimum_msat: our_htlc_minimum_msat_arg,
+ max_inbound_htlc_value_in_flight_percent_of_channel: max_inbound_htlc_value_in_flight_percent_of_channel_arg,
negotiate_scid_privacy: negotiate_scid_privacy_arg,
}), is_owned: true }
}
ret
}
}
-/// Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
+/// Minimum allowed satoshis when a channel is funded. This is supplied by the sender and so
/// only applies to inbound channels.
///
/// Default value: 0.
let mut inner_val = &mut this_ptr.get_native_mut_ref().min_funding_satoshis;
*inner_val
}
-/// Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
+/// Minimum allowed satoshis when a channel is funded. This is supplied by the sender and so
/// only applies to inbound channels.
///
/// Default value: 0.
pub extern "C" fn ChannelHandshakeLimits_set_min_funding_satoshis(this_ptr: &mut ChannelHandshakeLimits, mut val: u64) {
unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.min_funding_satoshis = val;
}
+/// Maximum allowed satoshis when a channel is funded. This is supplied by the sender and so
+/// only applies to inbound channels.
+///
+/// Default value: 2^24 - 1.
+#[no_mangle]
+pub extern "C" fn ChannelHandshakeLimits_get_max_funding_satoshis(this_ptr: &ChannelHandshakeLimits) -> u64 {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().max_funding_satoshis;
+ *inner_val
+}
+/// Maximum allowed satoshis when a channel is funded. This is supplied by the sender and so
+/// only applies to inbound channels.
+///
+/// Default value: 2^24 - 1.
+#[no_mangle]
+pub extern "C" fn ChannelHandshakeLimits_set_max_funding_satoshis(this_ptr: &mut ChannelHandshakeLimits, mut val: u64) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.max_funding_satoshis = val;
+}
/// The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
/// you to limit the maximum minimum-size they can require.
///
pub extern "C" fn ChannelHandshakeLimits_set_max_minimum_depth(this_ptr: &mut ChannelHandshakeLimits, mut val: u32) {
unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.max_minimum_depth = val;
}
+/// Whether we implicitly trust funding transactions generated by us for our own outbound
+/// channels to not be double-spent.
+///
+/// If this is set, we assume that our own funding transactions are *never* double-spent, and
+/// thus we can trust them without any confirmations. This is generally a reasonable
+/// assumption, given we're the only ones who could ever double-spend it (assuming we have sole
+/// control of the signing keys).
+///
+/// You may wish to un-set this if you allow the user to (or do in an automated fashion)
+/// double-spend the funding transaction to RBF with an alternative channel open.
+///
+/// This only applies if our counterparty set their confirmations-required value to 0, and we
+/// always trust our own funding transaction at 1 confirmation irrespective of this value.
+/// Thus, this effectively acts as a `min_minimum_depth`, with the only possible values being
+/// `true` (0) and `false` (1).
+///
+/// Default value: true
+#[no_mangle]
+pub extern "C" fn ChannelHandshakeLimits_get_trust_own_funding_0conf(this_ptr: &ChannelHandshakeLimits) -> bool {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().trust_own_funding_0conf;
+ *inner_val
+}
+/// Whether we implicitly trust funding transactions generated by us for our own outbound
+/// channels to not be double-spent.
+///
+/// If this is set, we assume that our own funding transactions are *never* double-spent, and
+/// thus we can trust them without any confirmations. This is generally a reasonable
+/// assumption, given we're the only ones who could ever double-spend it (assuming we have sole
+/// control of the signing keys).
+///
+/// You may wish to un-set this if you allow the user to (or do in an automated fashion)
+/// double-spend the funding transaction to RBF with an alternative channel open.
+///
+/// This only applies if our counterparty set their confirmations-required value to 0, and we
+/// always trust our own funding transaction at 1 confirmation irrespective of this value.
+/// Thus, this effectively acts as a `min_minimum_depth`, with the only possible values being
+/// `true` (0) and `false` (1).
+///
+/// Default value: true
+#[no_mangle]
+pub extern "C" fn ChannelHandshakeLimits_set_trust_own_funding_0conf(this_ptr: &mut ChannelHandshakeLimits, mut val: bool) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.trust_own_funding_0conf = val;
+}
/// Set to force an incoming channel to match our announced channel preference in
/// [`ChannelConfig::announced_channel`].
///
/// Constructs a new ChannelHandshakeLimits given each field
#[must_use]
#[no_mangle]
-pub extern "C" fn ChannelHandshakeLimits_new(mut min_funding_satoshis_arg: u64, mut max_htlc_minimum_msat_arg: u64, mut min_max_htlc_value_in_flight_msat_arg: u64, mut max_channel_reserve_satoshis_arg: u64, mut min_max_accepted_htlcs_arg: u16, mut max_minimum_depth_arg: u32, mut force_announced_channel_preference_arg: bool, mut their_to_self_delay_arg: u16) -> ChannelHandshakeLimits {
+pub extern "C" fn ChannelHandshakeLimits_new(mut min_funding_satoshis_arg: u64, mut max_funding_satoshis_arg: u64, mut max_htlc_minimum_msat_arg: u64, mut min_max_htlc_value_in_flight_msat_arg: u64, mut max_channel_reserve_satoshis_arg: u64, mut min_max_accepted_htlcs_arg: u16, mut max_minimum_depth_arg: u32, mut trust_own_funding_0conf_arg: bool, mut force_announced_channel_preference_arg: bool, mut their_to_self_delay_arg: u16) -> ChannelHandshakeLimits {
ChannelHandshakeLimits { inner: ObjOps::heap_alloc(nativeChannelHandshakeLimits {
min_funding_satoshis: min_funding_satoshis_arg,
+ max_funding_satoshis: max_funding_satoshis_arg,
max_htlc_minimum_msat: max_htlc_minimum_msat_arg,
min_max_htlc_value_in_flight_msat: min_max_htlc_value_in_flight_msat_arg,
max_channel_reserve_satoshis: max_channel_reserve_satoshis_arg,
min_max_accepted_htlcs: min_max_accepted_htlcs_arg,
max_minimum_depth: max_minimum_depth_arg,
+ trust_own_funding_0conf: trust_own_funding_0conf_arg,
force_announced_channel_preference: force_announced_channel_preference_arg,
their_to_self_delay: their_to_self_delay_arg,
}), is_owned: true }
/// Indicates an error on the client's part (usually some variant of attempting to use too-low or
/// too-high values)
-#[must_use]
#[derive(Clone)]
+#[must_use]
#[repr(C)]
pub enum APIError {
/// Indicates the API was wholly misused (see err for more). Cases where these can be returned
script: crate::lightning::ln::script::ShutdownScript,
},
}
-use lightning::util::errors::APIError as nativeAPIError;
+use lightning::util::errors::APIError as APIErrorImport;
+pub(crate) type nativeAPIError = APIErrorImport;
+
impl APIError {
#[allow(unused)]
pub(crate) fn to_native(&self) -> nativeAPIError {
/// Some information provided on receipt of payment depends on whether the payment received is a
/// spontaneous payment or a \"conventional\" lightning payment that's paying an invoice.
-#[must_use]
#[derive(Clone)]
+#[must_use]
#[repr(C)]
pub enum PaymentPurpose {
/// Information for receiving a payment that we generated an invoice for.
},
/// Because this is a spontaneous payment, the payer generated their own preimage rather than us
/// (the payee) providing a preimage.
- SpontaneousPayment(crate::c_types::ThirtyTwoBytes),
+ SpontaneousPayment(
+ crate::c_types::ThirtyTwoBytes),
}
-use lightning::util::events::PaymentPurpose as nativePaymentPurpose;
+use lightning::util::events::PaymentPurpose as PaymentPurposeImport;
+pub(crate) type nativePaymentPurpose = PaymentPurposeImport;
+
impl PaymentPurpose {
#[allow(unused)]
pub(crate) fn to_native(&self) -> nativePaymentPurpose {
pub extern "C" fn PaymentPurpose_spontaneous_payment(a: crate::c_types::ThirtyTwoBytes) -> PaymentPurpose {
PaymentPurpose::SpontaneousPayment(a, )
}
+#[no_mangle]
+/// Serialize the PaymentPurpose object into a byte array which can be read by PaymentPurpose_read
+pub extern "C" fn PaymentPurpose_write(obj: &crate::lightning::util::events::PaymentPurpose) -> crate::c_types::derived::CVec_u8Z {
+ crate::c_types::serialize_obj(&unsafe { &*obj }.to_native())
+}
+#[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 {
+ let res: Result<lightning::util::events::PaymentPurpose, 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::util::events::PaymentPurpose::native_into(o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+ local_res
+}
/// The reason the channel was closed. See individual variants more details.
-#[must_use]
#[derive(Clone)]
+#[must_use]
#[repr(C)]
pub enum ClosureReason {
/// Closure generated from receiving a peer error message.
/// A developer-readable error message which we generated.
err: crate::c_types::Str,
},
- /// The `PeerManager` informed us that we've disconnected from the peer. We close channels
- /// if the `PeerManager` informed us that it is unlikely we'll be able to connect to the
- /// peer again in the future or if the peer disconnected before we finished negotiating
- /// the channel open. The first case may be caused by incompatible features which our
- /// counterparty, or we, require.
+ /// The peer disconnected prior to funding completing. In this case the spec mandates that we
+ /// forget the channel entirely - we can attempt again if the peer reconnects.
+ ///
+ /// In LDK versions prior to 0.0.107 this could also occur if we were unable to connect to the
+ /// peer because of mutual incompatibility between us and our channel counterparty.
DisconnectedPeer,
/// Closure generated from `ChannelManager::read` if the ChannelMonitor is newer than
/// the ChannelManager deserialized.
OutdatedChannelManager,
}
-use lightning::util::events::ClosureReason as nativeClosureReason;
+use lightning::util::events::ClosureReason as ClosureReasonImport;
+pub(crate) type nativeClosureReason = ClosureReasonImport;
+
impl ClosureReason {
#[allow(unused)]
pub(crate) fn to_native(&self) -> nativeClosureReason {
/// Note that while Writeable and Readable are implemented for Event, you probably shouldn't use
/// them directly as they don't round-trip exactly (for example FundingGenerationReady is never
/// written as it makes no sense to respond to it after reconnecting to peers).
-#[must_use]
#[derive(Clone)]
+#[must_use]
#[repr(C)]
pub enum Event {
/// Used to indicate that the client should generate a funding transaction with the given
/// [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
FundingGenerationReady {
/// The random channel_id we picked which you'll need to pass into
- /// ChannelManager::funding_transaction_generated.
+ /// [`ChannelManager::funding_transaction_generated`].
+ ///
+ /// [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
temporary_channel_id: crate::c_types::ThirtyTwoBytes,
+ /// The counterparty's node_id, which you'll need to pass back into
+ /// [`ChannelManager::funding_transaction_generated`].
+ ///
+ /// [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
+ counterparty_node_id: crate::c_types::PublicKey,
/// The value, in satoshis, that the output should have.
channel_value_satoshis: u64,
/// The script which should be used in the transaction output.
/// [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
user_channel_id: u64,
},
- /// Indicates we've received money! Just gotta dig out that payment preimage and feed it to
- /// [`ChannelManager::claim_funds`] to get it....
+ /// Indicates we've received (an offer of) money! Just gotta dig out that payment preimage and
+ /// feed it to [`ChannelManager::claim_funds`] to get it....
+ ///
/// Note that if the preimage is not known, you should call
/// [`ChannelManager::fail_htlc_backwards`] to free up resources for this HTLC and avoid
/// network congestion.
/// not stop you from registering duplicate payment hashes for inbound payments.
payment_hash: crate::c_types::ThirtyTwoBytes,
/// The value, in thousandths of a satoshi, that this payment is for.
- amt: u64,
+ amount_msat: u64,
/// Information for claiming this received payment, based on whether the purpose of the
/// payment is to pay an invoice or to send a spontaneous payment.
purpose: crate::lightning::util::events::PaymentPurpose,
},
+ /// Indicates a payment has been claimed and we've received money!
+ ///
+ /// This most likely occurs when [`ChannelManager::claim_funds`] has been called in response
+ /// to an [`Event::PaymentReceived`]. However, if we previously crashed during a
+ /// [`ChannelManager::claim_funds`] call you may see this event without a corresponding
+ /// [`Event::PaymentReceived`] event.
+ ///
+ /// # Note
+ /// LDK will not stop an inbound payment from being paid multiple times, so multiple
+ /// `PaymentReceived` events may be generated for the same payment. If you then call
+ /// [`ChannelManager::claim_funds`] twice for the same [`Event::PaymentReceived`] you may get
+ /// multiple `PaymentClaimed` events.
+ ///
+ /// [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
+ PaymentClaimed {
+ /// The payment hash of the claimed payment. Note that LDK will not stop you from
+ /// registering duplicate payment hashes for inbound payments.
+ payment_hash: crate::c_types::ThirtyTwoBytes,
+ /// The value, in thousandths of a satoshi, that this payment is for.
+ amount_msat: u64,
+ /// The purpose of this claimed payment, i.e. whether the payment was for an invoice or a
+ /// spontaneous payment.
+ purpose: crate::lightning::util::events::PaymentPurpose,
+ },
/// 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).
///
/// [`Route::get_total_fees`]: crate::routing::router::Route::get_total_fees
fee_paid_msat: crate::c_types::derived::COption_u64Z,
},
+ /// Indicates an outbound payment failed. Individual [`Event::PaymentPathFailed`] events
+ /// provide failure information for each MPP part in the payment.
+ ///
+ /// This event is provided once there are no further pending HTLCs for the payment and the
+ /// payment is no longer retryable, either due to a several-block timeout or because
+ /// [`ChannelManager::abandon_payment`] was previously called for the corresponding payment.
+ ///
+ /// [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
+ PaymentFailed {
+ /// The id returned by [`ChannelManager::send_payment`] and used with
+ /// [`ChannelManager::retry_payment`] and [`ChannelManager::abandon_payment`].
+ ///
+ /// [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
+ /// [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
+ /// [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
+ payment_id: crate::c_types::ThirtyTwoBytes,
+ /// The hash that was given to [`ChannelManager::send_payment`].
+ ///
+ /// [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
+ payment_hash: crate::c_types::ThirtyTwoBytes,
+ },
+ /// Indicates that a path for an outbound payment was successful.
+ ///
+ /// Always generated after [`Event::PaymentSent`] and thus useful for scoring channels. See
+ /// [`Event::PaymentSent`] for obtaining the payment preimage.
+ PaymentPathSuccessful {
+ /// The id returned by [`ChannelManager::send_payment`] and used with
+ /// [`ChannelManager::retry_payment`].
+ ///
+ /// [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
+ /// [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
+ payment_id: crate::c_types::ThirtyTwoBytes,
+ /// The hash that was given to [`ChannelManager::send_payment`].
+ ///
+ /// [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
+ ///
+ /// Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
+ payment_hash: crate::c_types::ThirtyTwoBytes,
+ /// The payment path that was successful.
+ ///
+ /// May contain a closed channel if the HTLC sent along the path was fulfilled on chain.
+ path: crate::c_types::derived::CVec_RouteHopZ,
+ },
/// Indicates an outbound HTLC we sent failed. Probably some intermediary node dropped
/// something. You may wish to retry with a different route.
///
/// payment route.
///
/// Should be applied to the [`NetworkGraph`] so that routing decisions can take into
- /// account the update. [`NetGraphMsgHandler`] is capable of doing this.
+ /// account the update.
///
- /// [`NetworkGraph`]: crate::routing::network_graph::NetworkGraph
- /// [`NetGraphMsgHandler`]: crate::routing::network_graph::NetGraphMsgHandler
+ /// [`NetworkGraph`]: crate::routing::gossip::NetworkGraph
network_update: crate::c_types::derived::COption_NetworkUpdateZ,
/// For both single-path and multi-path payments, this is set if all paths of the payment have
/// failed. This will be set to false if (1) this is an MPP payment and (2) other parts of the
path: crate::c_types::derived::CVec_RouteHopZ,
/// The channel responsible for the failed payment path.
///
+ /// Note that for route hints or for the first hop in a path this may be an SCID alias and
+ /// may not refer to a channel in the public network graph. These aliases may also collide
+ /// with channels in the public network graph.
+ ///
/// If this is `Some`, then the corresponding channel should be avoided when the payment is
/// retried. May be `None` for older [`Event`] serializations.
short_channel_id: crate::c_types::derived::COption_u64Z,
/// Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
retry: crate::lightning::routing::router::RouteParameters,
},
- /// Indicates an outbound payment failed. Individual [`Event::PaymentPathFailed`] events
- /// provide failure information for each MPP part in the payment.
- ///
- /// This event is provided once there are no further pending HTLCs for the payment and the
- /// payment is no longer retryable, either due to a several-block timeout or because
- /// [`ChannelManager::abandon_payment`] was previously called for the corresponding payment.
- ///
- /// [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
- PaymentFailed {
- /// The id returned by [`ChannelManager::send_payment`] and used with
- /// [`ChannelManager::retry_payment`] and [`ChannelManager::abandon_payment`].
- ///
- /// [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
- /// [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
- /// [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
- payment_id: crate::c_types::ThirtyTwoBytes,
- /// The hash that was given to [`ChannelManager::send_payment`].
- ///
- /// [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
- payment_hash: crate::c_types::ThirtyTwoBytes,
- },
/// Used to indicate that [`ChannelManager::process_pending_htlc_forwards`] should be called at
/// a time in the future.
///
/// This event is generated when a payment has been successfully forwarded through us and a
/// forwarding fee earned.
PaymentForwarded {
+ /// The incoming channel between the previous node and us. This is only `None` for events
+ /// generated or serialized by versions prior to 0.0.107.
+ ///
+ /// Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
+ prev_channel_id: crate::c_types::ThirtyTwoBytes,
+ /// The outgoing channel between the next node and us. This is only `None` for events
+ /// generated or serialized by versions prior to 0.0.107.
+ ///
+ /// Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
+ next_channel_id: crate::c_types::ThirtyTwoBytes,
/// The fee, in milli-satoshis, which was earned as a result of the payment.
///
/// Note that if we force-closed the channel over which we forwarded an HTLC while the HTLC
/// transaction.
claim_from_onchain_tx: bool,
},
- /// Used to indicate that a channel with the given `channel_id` is in the process of closure.
+ /// Used to indicate that a previously opened channel with the given `channel_id` is in the
+ /// process of closure.
ChannelClosed {
/// The channel_id of the channel which has been closed. Note that on-chain transactions
/// resolving the channel are likely still awaiting confirmation.
/// The full transaction received from the user
transaction: crate::c_types::Transaction,
},
- /// Indicates that a path for an outbound payment was successful.
- ///
- /// Always generated after [`Event::PaymentSent`] and thus useful for scoring channels. See
- /// [`Event::PaymentSent`] for obtaining the payment preimage.
- PaymentPathSuccessful {
- /// The id returned by [`ChannelManager::send_payment`] and used with
- /// [`ChannelManager::retry_payment`].
- ///
- /// [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
- /// [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
- payment_id: crate::c_types::ThirtyTwoBytes,
- /// The hash that was given to [`ChannelManager::send_payment`].
- ///
- /// [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
- ///
- /// Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
- payment_hash: crate::c_types::ThirtyTwoBytes,
- /// The payment path that was successful.
- ///
- /// May contain a closed channel if the HTLC sent along the path was fulfilled on chain.
- path: crate::c_types::derived::CVec_RouteHopZ,
- },
/// Indicates a request to open a new channel by a peer.
///
/// To accept the request, call [`ChannelManager::accept_inbound_channel`]. To reject the
/// The temporary channel ID of the channel requested to be opened.
///
/// When responding to the request, the `temporary_channel_id` should be passed
- /// back to the ChannelManager with [`ChannelManager::accept_inbound_channel`] to accept,
- /// or to [`ChannelManager::force_close_channel`] to reject.
+ /// back to the ChannelManager through [`ChannelManager::accept_inbound_channel`] to accept,
+ /// or through [`ChannelManager::force_close_channel`] to reject.
///
/// [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
/// [`ChannelManager::force_close_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel
temporary_channel_id: crate::c_types::ThirtyTwoBytes,
/// The node_id of the counterparty requesting to open the channel.
+ ///
+ /// When responding to the request, the `counterparty_node_id` should be passed
+ /// back to the `ChannelManager` through [`ChannelManager::accept_inbound_channel`] to
+ /// accept the request, or through [`ChannelManager::force_close_channel`] to reject the
+ /// request.
+ ///
+ /// [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
+ /// [`ChannelManager::force_close_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel
counterparty_node_id: crate::c_types::PublicKey,
/// The channel value of the requested channel.
funding_satoshis: u64,
/// the resulting [`ChannelManager`] will not be readable by versions of LDK prior to
/// 0.0.106.
///
+ /// Furthermore, note that if [`ChannelTypeFeatures::supports_zero_conf`] returns true on this type,
+ /// the resulting [`ChannelManager`] will not be readable by versions of LDK prior to
+ /// 0.0.107. Channels setting this type also need to get manually accepted via
+ /// [`crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`],
+ /// or will be rejected otherwise.
+ ///
/// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
channel_type: crate::lightning::ln::features::ChannelTypeFeatures,
},
}
-use lightning::util::events::Event as nativeEvent;
+use lightning::util::events::Event as EventImport;
+pub(crate) type nativeEvent = EventImport;
+
impl Event {
#[allow(unused)]
pub(crate) fn to_native(&self) -> nativeEvent {
match self {
- Event::FundingGenerationReady {ref temporary_channel_id, ref channel_value_satoshis, ref output_script, ref user_channel_id, } => {
+ Event::FundingGenerationReady {ref temporary_channel_id, ref counterparty_node_id, ref channel_value_satoshis, ref output_script, ref user_channel_id, } => {
let mut temporary_channel_id_nonref = (*temporary_channel_id).clone();
+ let mut counterparty_node_id_nonref = (*counterparty_node_id).clone();
let mut channel_value_satoshis_nonref = (*channel_value_satoshis).clone();
let mut output_script_nonref = (*output_script).clone();
let mut user_channel_id_nonref = (*user_channel_id).clone();
nativeEvent::FundingGenerationReady {
temporary_channel_id: temporary_channel_id_nonref.data,
+ counterparty_node_id: counterparty_node_id_nonref.into_rust(),
channel_value_satoshis: channel_value_satoshis_nonref,
output_script: ::bitcoin::blockdata::script::Script::from(output_script_nonref.into_rust()),
user_channel_id: user_channel_id_nonref,
}
},
- Event::PaymentReceived {ref payment_hash, ref amt, ref purpose, } => {
+ Event::PaymentReceived {ref payment_hash, ref amount_msat, ref purpose, } => {
let mut payment_hash_nonref = (*payment_hash).clone();
- let mut amt_nonref = (*amt).clone();
+ let mut amount_msat_nonref = (*amount_msat).clone();
let mut purpose_nonref = (*purpose).clone();
nativeEvent::PaymentReceived {
payment_hash: ::lightning::ln::PaymentHash(payment_hash_nonref.data),
- amt: amt_nonref,
+ amount_msat: amount_msat_nonref,
+ purpose: purpose_nonref.into_native(),
+ }
+ },
+ Event::PaymentClaimed {ref payment_hash, ref amount_msat, ref purpose, } => {
+ let mut payment_hash_nonref = (*payment_hash).clone();
+ let mut amount_msat_nonref = (*amount_msat).clone();
+ let mut purpose_nonref = (*purpose).clone();
+ nativeEvent::PaymentClaimed {
+ payment_hash: ::lightning::ln::PaymentHash(payment_hash_nonref.data),
+ amount_msat: amount_msat_nonref,
purpose: purpose_nonref.into_native(),
}
},
fee_paid_msat: local_fee_paid_msat_nonref,
}
},
+ Event::PaymentFailed {ref payment_id, ref payment_hash, } => {
+ let mut payment_id_nonref = (*payment_id).clone();
+ let mut payment_hash_nonref = (*payment_hash).clone();
+ nativeEvent::PaymentFailed {
+ payment_id: ::lightning::ln::channelmanager::PaymentId(payment_id_nonref.data),
+ payment_hash: ::lightning::ln::PaymentHash(payment_hash_nonref.data),
+ }
+ },
+ Event::PaymentPathSuccessful {ref payment_id, ref payment_hash, ref path, } => {
+ let mut payment_id_nonref = (*payment_id).clone();
+ let mut payment_hash_nonref = (*payment_hash).clone();
+ let mut local_payment_hash_nonref = if payment_hash_nonref.data == [0; 32] { None } else { Some( { ::lightning::ln::PaymentHash(payment_hash_nonref.data) }) };
+ let mut path_nonref = (*path).clone();
+ let mut local_path_nonref = Vec::new(); for mut item in path_nonref.into_rust().drain(..) { local_path_nonref.push( { *unsafe { Box::from_raw(item.take_inner()) } }); };
+ nativeEvent::PaymentPathSuccessful {
+ payment_id: ::lightning::ln::channelmanager::PaymentId(payment_id_nonref.data),
+ payment_hash: local_payment_hash_nonref,
+ path: local_path_nonref,
+ }
+ },
Event::PaymentPathFailed {ref payment_id, ref payment_hash, ref rejected_by_dest, ref network_update, ref all_paths_failed, ref path, ref short_channel_id, ref retry, } => {
let mut payment_id_nonref = (*payment_id).clone();
let mut local_payment_id_nonref = if payment_id_nonref.data == [0; 32] { None } else { Some( { ::lightning::ln::channelmanager::PaymentId(payment_id_nonref.data) }) };
retry: local_retry_nonref,
}
},
- Event::PaymentFailed {ref payment_id, ref payment_hash, } => {
- let mut payment_id_nonref = (*payment_id).clone();
- let mut payment_hash_nonref = (*payment_hash).clone();
- nativeEvent::PaymentFailed {
- payment_id: ::lightning::ln::channelmanager::PaymentId(payment_id_nonref.data),
- payment_hash: ::lightning::ln::PaymentHash(payment_hash_nonref.data),
- }
- },
Event::PendingHTLCsForwardable {ref time_forwardable, } => {
let mut time_forwardable_nonref = (*time_forwardable).clone();
nativeEvent::PendingHTLCsForwardable {
outputs: local_outputs_nonref,
}
},
- Event::PaymentForwarded {ref fee_earned_msat, ref claim_from_onchain_tx, } => {
+ Event::PaymentForwarded {ref prev_channel_id, ref next_channel_id, ref fee_earned_msat, ref claim_from_onchain_tx, } => {
+ let mut prev_channel_id_nonref = (*prev_channel_id).clone();
+ let mut local_prev_channel_id_nonref = if prev_channel_id_nonref.data == [0; 32] { None } else { Some( { prev_channel_id_nonref.data }) };
+ let mut next_channel_id_nonref = (*next_channel_id).clone();
+ let mut local_next_channel_id_nonref = if next_channel_id_nonref.data == [0; 32] { None } else { Some( { next_channel_id_nonref.data }) };
let mut fee_earned_msat_nonref = (*fee_earned_msat).clone();
let mut local_fee_earned_msat_nonref = if fee_earned_msat_nonref.is_some() { Some( { fee_earned_msat_nonref.take() }) } else { None };
let mut claim_from_onchain_tx_nonref = (*claim_from_onchain_tx).clone();
nativeEvent::PaymentForwarded {
+ prev_channel_id: local_prev_channel_id_nonref,
+ next_channel_id: local_next_channel_id_nonref,
fee_earned_msat: local_fee_earned_msat_nonref,
claim_from_onchain_tx: claim_from_onchain_tx_nonref,
}
transaction: transaction_nonref.into_bitcoin(),
}
},
- Event::PaymentPathSuccessful {ref payment_id, ref payment_hash, ref path, } => {
- let mut payment_id_nonref = (*payment_id).clone();
- let mut payment_hash_nonref = (*payment_hash).clone();
- let mut local_payment_hash_nonref = if payment_hash_nonref.data == [0; 32] { None } else { Some( { ::lightning::ln::PaymentHash(payment_hash_nonref.data) }) };
- let mut path_nonref = (*path).clone();
- let mut local_path_nonref = Vec::new(); for mut item in path_nonref.into_rust().drain(..) { local_path_nonref.push( { *unsafe { Box::from_raw(item.take_inner()) } }); };
- nativeEvent::PaymentPathSuccessful {
- payment_id: ::lightning::ln::channelmanager::PaymentId(payment_id_nonref.data),
- payment_hash: local_payment_hash_nonref,
- path: local_path_nonref,
- }
- },
Event::OpenChannelRequest {ref temporary_channel_id, ref counterparty_node_id, ref funding_satoshis, ref push_msat, ref channel_type, } => {
let mut temporary_channel_id_nonref = (*temporary_channel_id).clone();
let mut counterparty_node_id_nonref = (*counterparty_node_id).clone();
#[allow(unused)]
pub(crate) fn into_native(self) -> nativeEvent {
match self {
- Event::FundingGenerationReady {mut temporary_channel_id, mut channel_value_satoshis, mut output_script, mut user_channel_id, } => {
+ Event::FundingGenerationReady {mut temporary_channel_id, mut counterparty_node_id, mut channel_value_satoshis, mut output_script, mut user_channel_id, } => {
nativeEvent::FundingGenerationReady {
temporary_channel_id: temporary_channel_id.data,
+ counterparty_node_id: counterparty_node_id.into_rust(),
channel_value_satoshis: channel_value_satoshis,
output_script: ::bitcoin::blockdata::script::Script::from(output_script.into_rust()),
user_channel_id: user_channel_id,
}
},
- Event::PaymentReceived {mut payment_hash, mut amt, mut purpose, } => {
+ Event::PaymentReceived {mut payment_hash, mut amount_msat, mut purpose, } => {
nativeEvent::PaymentReceived {
payment_hash: ::lightning::ln::PaymentHash(payment_hash.data),
- amt: amt,
+ amount_msat: amount_msat,
+ purpose: purpose.into_native(),
+ }
+ },
+ Event::PaymentClaimed {mut payment_hash, mut amount_msat, mut purpose, } => {
+ nativeEvent::PaymentClaimed {
+ payment_hash: ::lightning::ln::PaymentHash(payment_hash.data),
+ amount_msat: amount_msat,
purpose: purpose.into_native(),
}
},
fee_paid_msat: local_fee_paid_msat,
}
},
+ Event::PaymentFailed {mut payment_id, mut payment_hash, } => {
+ nativeEvent::PaymentFailed {
+ payment_id: ::lightning::ln::channelmanager::PaymentId(payment_id.data),
+ payment_hash: ::lightning::ln::PaymentHash(payment_hash.data),
+ }
+ },
+ Event::PaymentPathSuccessful {mut payment_id, mut payment_hash, mut path, } => {
+ let mut local_payment_hash = if payment_hash.data == [0; 32] { None } else { Some( { ::lightning::ln::PaymentHash(payment_hash.data) }) };
+ let mut local_path = Vec::new(); for mut item in path.into_rust().drain(..) { local_path.push( { *unsafe { Box::from_raw(item.take_inner()) } }); };
+ nativeEvent::PaymentPathSuccessful {
+ payment_id: ::lightning::ln::channelmanager::PaymentId(payment_id.data),
+ payment_hash: local_payment_hash,
+ path: local_path,
+ }
+ },
Event::PaymentPathFailed {mut payment_id, mut payment_hash, mut rejected_by_dest, mut network_update, mut all_paths_failed, mut path, mut short_channel_id, mut retry, } => {
let mut local_payment_id = if payment_id.data == [0; 32] { None } else { Some( { ::lightning::ln::channelmanager::PaymentId(payment_id.data) }) };
let mut local_network_update = { /* network_update*/ let network_update_opt = network_update; { } if network_update_opt.is_none() { None } else { Some({ network_update_opt.take().into_native() }) } };
retry: local_retry,
}
},
- Event::PaymentFailed {mut payment_id, mut payment_hash, } => {
- nativeEvent::PaymentFailed {
- payment_id: ::lightning::ln::channelmanager::PaymentId(payment_id.data),
- payment_hash: ::lightning::ln::PaymentHash(payment_hash.data),
- }
- },
Event::PendingHTLCsForwardable {mut time_forwardable, } => {
nativeEvent::PendingHTLCsForwardable {
time_forwardable: core::time::Duration::from_secs(time_forwardable),
outputs: local_outputs,
}
},
- Event::PaymentForwarded {mut fee_earned_msat, mut claim_from_onchain_tx, } => {
+ Event::PaymentForwarded {mut prev_channel_id, mut next_channel_id, mut fee_earned_msat, mut claim_from_onchain_tx, } => {
+ let mut local_prev_channel_id = if prev_channel_id.data == [0; 32] { None } else { Some( { prev_channel_id.data }) };
+ let mut local_next_channel_id = if next_channel_id.data == [0; 32] { None } else { Some( { next_channel_id.data }) };
let mut local_fee_earned_msat = if fee_earned_msat.is_some() { Some( { fee_earned_msat.take() }) } else { None };
nativeEvent::PaymentForwarded {
+ prev_channel_id: local_prev_channel_id,
+ next_channel_id: local_next_channel_id,
fee_earned_msat: local_fee_earned_msat,
claim_from_onchain_tx: claim_from_onchain_tx,
}
transaction: transaction.into_bitcoin(),
}
},
- Event::PaymentPathSuccessful {mut payment_id, mut payment_hash, mut path, } => {
- let mut local_payment_hash = if payment_hash.data == [0; 32] { None } else { Some( { ::lightning::ln::PaymentHash(payment_hash.data) }) };
- let mut local_path = Vec::new(); for mut item in path.into_rust().drain(..) { local_path.push( { *unsafe { Box::from_raw(item.take_inner()) } }); };
- nativeEvent::PaymentPathSuccessful {
- payment_id: ::lightning::ln::channelmanager::PaymentId(payment_id.data),
- payment_hash: local_payment_hash,
- path: local_path,
- }
- },
Event::OpenChannelRequest {mut temporary_channel_id, mut counterparty_node_id, mut funding_satoshis, mut push_msat, mut channel_type, } => {
nativeEvent::OpenChannelRequest {
temporary_channel_id: temporary_channel_id.data,
#[allow(unused)]
pub(crate) fn from_native(native: &nativeEvent) -> Self {
match native {
- nativeEvent::FundingGenerationReady {ref temporary_channel_id, ref channel_value_satoshis, ref output_script, ref user_channel_id, } => {
+ nativeEvent::FundingGenerationReady {ref temporary_channel_id, ref counterparty_node_id, ref channel_value_satoshis, ref output_script, ref user_channel_id, } => {
let mut temporary_channel_id_nonref = (*temporary_channel_id).clone();
+ let mut counterparty_node_id_nonref = (*counterparty_node_id).clone();
let mut channel_value_satoshis_nonref = (*channel_value_satoshis).clone();
let mut output_script_nonref = (*output_script).clone();
let mut user_channel_id_nonref = (*user_channel_id).clone();
Event::FundingGenerationReady {
temporary_channel_id: crate::c_types::ThirtyTwoBytes { data: temporary_channel_id_nonref },
+ counterparty_node_id: crate::c_types::PublicKey::from_rust(&counterparty_node_id_nonref),
channel_value_satoshis: channel_value_satoshis_nonref,
output_script: output_script_nonref.into_bytes().into(),
user_channel_id: user_channel_id_nonref,
}
},
- nativeEvent::PaymentReceived {ref payment_hash, ref amt, ref purpose, } => {
+ nativeEvent::PaymentReceived {ref payment_hash, ref amount_msat, ref purpose, } => {
let mut payment_hash_nonref = (*payment_hash).clone();
- let mut amt_nonref = (*amt).clone();
+ let mut amount_msat_nonref = (*amount_msat).clone();
let mut purpose_nonref = (*purpose).clone();
Event::PaymentReceived {
payment_hash: crate::c_types::ThirtyTwoBytes { data: payment_hash_nonref.0 },
- amt: amt_nonref,
+ amount_msat: amount_msat_nonref,
+ purpose: crate::lightning::util::events::PaymentPurpose::native_into(purpose_nonref),
+ }
+ },
+ nativeEvent::PaymentClaimed {ref payment_hash, ref amount_msat, ref purpose, } => {
+ let mut payment_hash_nonref = (*payment_hash).clone();
+ let mut amount_msat_nonref = (*amount_msat).clone();
+ let mut purpose_nonref = (*purpose).clone();
+ Event::PaymentClaimed {
+ payment_hash: crate::c_types::ThirtyTwoBytes { data: payment_hash_nonref.0 },
+ amount_msat: amount_msat_nonref,
purpose: crate::lightning::util::events::PaymentPurpose::native_into(purpose_nonref),
}
},
fee_paid_msat: local_fee_paid_msat_nonref,
}
},
+ nativeEvent::PaymentFailed {ref payment_id, ref payment_hash, } => {
+ let mut payment_id_nonref = (*payment_id).clone();
+ let mut payment_hash_nonref = (*payment_hash).clone();
+ Event::PaymentFailed {
+ payment_id: crate::c_types::ThirtyTwoBytes { data: payment_id_nonref.0 },
+ payment_hash: crate::c_types::ThirtyTwoBytes { data: payment_hash_nonref.0 },
+ }
+ },
+ nativeEvent::PaymentPathSuccessful {ref payment_id, ref payment_hash, ref path, } => {
+ let mut payment_id_nonref = (*payment_id).clone();
+ let mut payment_hash_nonref = (*payment_hash).clone();
+ let mut local_payment_hash_nonref = if payment_hash_nonref.is_none() { crate::c_types::ThirtyTwoBytes::null() } else { { crate::c_types::ThirtyTwoBytes { data: (payment_hash_nonref.unwrap()).0 } } };
+ let mut path_nonref = (*path).clone();
+ let mut local_path_nonref = Vec::new(); for mut item in path_nonref.drain(..) { local_path_nonref.push( { crate::lightning::routing::router::RouteHop { inner: ObjOps::heap_alloc(item), is_owned: true } }); };
+ Event::PaymentPathSuccessful {
+ payment_id: crate::c_types::ThirtyTwoBytes { data: payment_id_nonref.0 },
+ payment_hash: local_payment_hash_nonref,
+ path: local_path_nonref.into(),
+ }
+ },
nativeEvent::PaymentPathFailed {ref payment_id, ref payment_hash, ref rejected_by_dest, ref network_update, ref all_paths_failed, ref path, ref short_channel_id, ref retry, } => {
let mut payment_id_nonref = (*payment_id).clone();
let mut local_payment_id_nonref = if payment_id_nonref.is_none() { crate::c_types::ThirtyTwoBytes::null() } else { { crate::c_types::ThirtyTwoBytes { data: (payment_id_nonref.unwrap()).0 } } };
let mut payment_hash_nonref = (*payment_hash).clone();
let mut rejected_by_dest_nonref = (*rejected_by_dest).clone();
let mut network_update_nonref = (*network_update).clone();
- let mut local_network_update_nonref = if network_update_nonref.is_none() { crate::c_types::derived::COption_NetworkUpdateZ::None } else { crate::c_types::derived::COption_NetworkUpdateZ::Some( { crate::lightning::routing::network_graph::NetworkUpdate::native_into(network_update_nonref.unwrap()) }) };
+ let mut local_network_update_nonref = if network_update_nonref.is_none() { crate::c_types::derived::COption_NetworkUpdateZ::None } else { crate::c_types::derived::COption_NetworkUpdateZ::Some( { crate::lightning::routing::gossip::NetworkUpdate::native_into(network_update_nonref.unwrap()) }) };
let mut all_paths_failed_nonref = (*all_paths_failed).clone();
let mut path_nonref = (*path).clone();
let mut local_path_nonref = Vec::new(); for mut item in path_nonref.drain(..) { local_path_nonref.push( { crate::lightning::routing::router::RouteHop { inner: ObjOps::heap_alloc(item), is_owned: true } }); };
retry: local_retry_nonref,
}
},
- nativeEvent::PaymentFailed {ref payment_id, ref payment_hash, } => {
- let mut payment_id_nonref = (*payment_id).clone();
- let mut payment_hash_nonref = (*payment_hash).clone();
- Event::PaymentFailed {
- payment_id: crate::c_types::ThirtyTwoBytes { data: payment_id_nonref.0 },
- payment_hash: crate::c_types::ThirtyTwoBytes { data: payment_hash_nonref.0 },
- }
- },
nativeEvent::PendingHTLCsForwardable {ref time_forwardable, } => {
let mut time_forwardable_nonref = (*time_forwardable).clone();
Event::PendingHTLCsForwardable {
outputs: local_outputs_nonref.into(),
}
},
- nativeEvent::PaymentForwarded {ref fee_earned_msat, ref claim_from_onchain_tx, } => {
+ nativeEvent::PaymentForwarded {ref prev_channel_id, ref next_channel_id, ref fee_earned_msat, ref claim_from_onchain_tx, } => {
+ let mut prev_channel_id_nonref = (*prev_channel_id).clone();
+ let mut local_prev_channel_id_nonref = if prev_channel_id_nonref.is_none() { crate::c_types::ThirtyTwoBytes { data: [0; 32] } } else { { crate::c_types::ThirtyTwoBytes { data: (prev_channel_id_nonref.unwrap()) } } };
+ let mut next_channel_id_nonref = (*next_channel_id).clone();
+ let mut local_next_channel_id_nonref = if next_channel_id_nonref.is_none() { crate::c_types::ThirtyTwoBytes { data: [0; 32] } } else { { crate::c_types::ThirtyTwoBytes { data: (next_channel_id_nonref.unwrap()) } } };
let mut fee_earned_msat_nonref = (*fee_earned_msat).clone();
let mut local_fee_earned_msat_nonref = if fee_earned_msat_nonref.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { fee_earned_msat_nonref.unwrap() }) };
let mut claim_from_onchain_tx_nonref = (*claim_from_onchain_tx).clone();
Event::PaymentForwarded {
+ prev_channel_id: local_prev_channel_id_nonref,
+ next_channel_id: local_next_channel_id_nonref,
fee_earned_msat: local_fee_earned_msat_nonref,
claim_from_onchain_tx: claim_from_onchain_tx_nonref,
}
transaction: crate::c_types::Transaction::from_bitcoin(&transaction_nonref),
}
},
- nativeEvent::PaymentPathSuccessful {ref payment_id, ref payment_hash, ref path, } => {
- let mut payment_id_nonref = (*payment_id).clone();
- let mut payment_hash_nonref = (*payment_hash).clone();
- let mut local_payment_hash_nonref = if payment_hash_nonref.is_none() { crate::c_types::ThirtyTwoBytes::null() } else { { crate::c_types::ThirtyTwoBytes { data: (payment_hash_nonref.unwrap()).0 } } };
- let mut path_nonref = (*path).clone();
- let mut local_path_nonref = Vec::new(); for mut item in path_nonref.drain(..) { local_path_nonref.push( { crate::lightning::routing::router::RouteHop { inner: ObjOps::heap_alloc(item), is_owned: true } }); };
- Event::PaymentPathSuccessful {
- payment_id: crate::c_types::ThirtyTwoBytes { data: payment_id_nonref.0 },
- payment_hash: local_payment_hash_nonref,
- path: local_path_nonref.into(),
- }
- },
nativeEvent::OpenChannelRequest {ref temporary_channel_id, ref counterparty_node_id, ref funding_satoshis, ref push_msat, ref channel_type, } => {
let mut temporary_channel_id_nonref = (*temporary_channel_id).clone();
let mut counterparty_node_id_nonref = (*counterparty_node_id).clone();
#[allow(unused)]
pub(crate) fn native_into(native: nativeEvent) -> Self {
match native {
- nativeEvent::FundingGenerationReady {mut temporary_channel_id, mut channel_value_satoshis, mut output_script, mut user_channel_id, } => {
+ nativeEvent::FundingGenerationReady {mut temporary_channel_id, mut counterparty_node_id, mut channel_value_satoshis, mut output_script, mut user_channel_id, } => {
Event::FundingGenerationReady {
temporary_channel_id: crate::c_types::ThirtyTwoBytes { data: temporary_channel_id },
+ counterparty_node_id: crate::c_types::PublicKey::from_rust(&counterparty_node_id),
channel_value_satoshis: channel_value_satoshis,
output_script: output_script.into_bytes().into(),
user_channel_id: user_channel_id,
}
},
- nativeEvent::PaymentReceived {mut payment_hash, mut amt, mut purpose, } => {
+ nativeEvent::PaymentReceived {mut payment_hash, mut amount_msat, mut purpose, } => {
Event::PaymentReceived {
payment_hash: crate::c_types::ThirtyTwoBytes { data: payment_hash.0 },
- amt: amt,
+ amount_msat: amount_msat,
+ purpose: crate::lightning::util::events::PaymentPurpose::native_into(purpose),
+ }
+ },
+ nativeEvent::PaymentClaimed {mut payment_hash, mut amount_msat, mut purpose, } => {
+ Event::PaymentClaimed {
+ payment_hash: crate::c_types::ThirtyTwoBytes { data: payment_hash.0 },
+ amount_msat: amount_msat,
purpose: crate::lightning::util::events::PaymentPurpose::native_into(purpose),
}
},
fee_paid_msat: local_fee_paid_msat,
}
},
+ nativeEvent::PaymentFailed {mut payment_id, mut payment_hash, } => {
+ Event::PaymentFailed {
+ payment_id: crate::c_types::ThirtyTwoBytes { data: payment_id.0 },
+ payment_hash: crate::c_types::ThirtyTwoBytes { data: payment_hash.0 },
+ }
+ },
+ nativeEvent::PaymentPathSuccessful {mut payment_id, mut payment_hash, mut path, } => {
+ let mut local_payment_hash = if payment_hash.is_none() { crate::c_types::ThirtyTwoBytes::null() } else { { crate::c_types::ThirtyTwoBytes { data: (payment_hash.unwrap()).0 } } };
+ let mut local_path = Vec::new(); for mut item in path.drain(..) { local_path.push( { crate::lightning::routing::router::RouteHop { inner: ObjOps::heap_alloc(item), is_owned: true } }); };
+ Event::PaymentPathSuccessful {
+ payment_id: crate::c_types::ThirtyTwoBytes { data: payment_id.0 },
+ payment_hash: local_payment_hash,
+ path: local_path.into(),
+ }
+ },
nativeEvent::PaymentPathFailed {mut payment_id, mut payment_hash, mut rejected_by_dest, mut network_update, mut all_paths_failed, mut path, mut short_channel_id, mut retry, } => {
let mut local_payment_id = if payment_id.is_none() { crate::c_types::ThirtyTwoBytes::null() } else { { crate::c_types::ThirtyTwoBytes { data: (payment_id.unwrap()).0 } } };
- let mut local_network_update = if network_update.is_none() { crate::c_types::derived::COption_NetworkUpdateZ::None } else { crate::c_types::derived::COption_NetworkUpdateZ::Some( { crate::lightning::routing::network_graph::NetworkUpdate::native_into(network_update.unwrap()) }) };
+ let mut local_network_update = if network_update.is_none() { crate::c_types::derived::COption_NetworkUpdateZ::None } else { crate::c_types::derived::COption_NetworkUpdateZ::Some( { crate::lightning::routing::gossip::NetworkUpdate::native_into(network_update.unwrap()) }) };
let mut local_path = Vec::new(); for mut item in path.drain(..) { local_path.push( { crate::lightning::routing::router::RouteHop { inner: ObjOps::heap_alloc(item), is_owned: true } }); };
let mut local_short_channel_id = if short_channel_id.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { short_channel_id.unwrap() }) };
let mut local_retry = crate::lightning::routing::router::RouteParameters { inner: if retry.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((retry.unwrap())) } }, is_owned: true };
retry: local_retry,
}
},
- nativeEvent::PaymentFailed {mut payment_id, mut payment_hash, } => {
- Event::PaymentFailed {
- payment_id: crate::c_types::ThirtyTwoBytes { data: payment_id.0 },
- payment_hash: crate::c_types::ThirtyTwoBytes { data: payment_hash.0 },
- }
- },
nativeEvent::PendingHTLCsForwardable {mut time_forwardable, } => {
Event::PendingHTLCsForwardable {
time_forwardable: time_forwardable.as_secs(),
outputs: local_outputs.into(),
}
},
- nativeEvent::PaymentForwarded {mut fee_earned_msat, mut claim_from_onchain_tx, } => {
+ nativeEvent::PaymentForwarded {mut prev_channel_id, mut next_channel_id, mut fee_earned_msat, mut claim_from_onchain_tx, } => {
+ let mut local_prev_channel_id = if prev_channel_id.is_none() { crate::c_types::ThirtyTwoBytes { data: [0; 32] } } else { { crate::c_types::ThirtyTwoBytes { data: (prev_channel_id.unwrap()) } } };
+ let mut local_next_channel_id = if next_channel_id.is_none() { crate::c_types::ThirtyTwoBytes { data: [0; 32] } } else { { crate::c_types::ThirtyTwoBytes { data: (next_channel_id.unwrap()) } } };
let mut local_fee_earned_msat = if fee_earned_msat.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { fee_earned_msat.unwrap() }) };
Event::PaymentForwarded {
+ prev_channel_id: local_prev_channel_id,
+ next_channel_id: local_next_channel_id,
fee_earned_msat: local_fee_earned_msat,
claim_from_onchain_tx: claim_from_onchain_tx,
}
transaction: crate::c_types::Transaction::from_bitcoin(&transaction),
}
},
- nativeEvent::PaymentPathSuccessful {mut payment_id, mut payment_hash, mut path, } => {
- let mut local_payment_hash = if payment_hash.is_none() { crate::c_types::ThirtyTwoBytes::null() } else { { crate::c_types::ThirtyTwoBytes { data: (payment_hash.unwrap()).0 } } };
- let mut local_path = Vec::new(); for mut item in path.drain(..) { local_path.push( { crate::lightning::routing::router::RouteHop { inner: ObjOps::heap_alloc(item), is_owned: true } }); };
- Event::PaymentPathSuccessful {
- payment_id: crate::c_types::ThirtyTwoBytes { data: payment_id.0 },
- payment_hash: local_payment_hash,
- path: local_path.into(),
- }
- },
nativeEvent::OpenChannelRequest {mut temporary_channel_id, mut counterparty_node_id, mut funding_satoshis, mut push_msat, mut channel_type, } => {
Event::OpenChannelRequest {
temporary_channel_id: crate::c_types::ThirtyTwoBytes { data: temporary_channel_id },
}
#[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, channel_value_satoshis: u64, output_script: crate::c_types::derived::CVec_u8Z, user_channel_id: u64) -> 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: u64) -> Event {
Event::FundingGenerationReady {
temporary_channel_id,
+ counterparty_node_id,
channel_value_satoshis,
output_script,
user_channel_id,
}
#[no_mangle]
/// Utility method to constructs a new PaymentReceived-variant Event
-pub extern "C" fn Event_payment_received(payment_hash: crate::c_types::ThirtyTwoBytes, amt: u64, purpose: crate::lightning::util::events::PaymentPurpose) -> Event {
+pub extern "C" fn Event_payment_received(payment_hash: crate::c_types::ThirtyTwoBytes, amount_msat: u64, purpose: crate::lightning::util::events::PaymentPurpose) -> Event {
Event::PaymentReceived {
payment_hash,
- amt,
+ amount_msat,
+ purpose,
+ }
+}
+#[no_mangle]
+/// Utility method to constructs a new PaymentClaimed-variant Event
+pub extern "C" fn Event_payment_claimed(payment_hash: crate::c_types::ThirtyTwoBytes, amount_msat: u64, purpose: crate::lightning::util::events::PaymentPurpose) -> Event {
+ Event::PaymentClaimed {
+ payment_hash,
+ amount_msat,
purpose,
}
}
}
}
#[no_mangle]
+/// Utility method to constructs a new PaymentFailed-variant Event
+pub extern "C" fn Event_payment_failed(payment_id: crate::c_types::ThirtyTwoBytes, payment_hash: crate::c_types::ThirtyTwoBytes) -> Event {
+ Event::PaymentFailed {
+ payment_id,
+ payment_hash,
+ }
+}
+#[no_mangle]
+/// Utility method to constructs a new PaymentPathSuccessful-variant Event
+pub extern "C" fn Event_payment_path_successful(payment_id: crate::c_types::ThirtyTwoBytes, payment_hash: crate::c_types::ThirtyTwoBytes, path: crate::c_types::derived::CVec_RouteHopZ) -> Event {
+ Event::PaymentPathSuccessful {
+ payment_id,
+ payment_hash,
+ path,
+ }
+}
+#[no_mangle]
/// Utility method to constructs a new PaymentPathFailed-variant Event
pub extern "C" fn Event_payment_path_failed(payment_id: crate::c_types::ThirtyTwoBytes, payment_hash: crate::c_types::ThirtyTwoBytes, rejected_by_dest: bool, network_update: crate::c_types::derived::COption_NetworkUpdateZ, all_paths_failed: bool, path: crate::c_types::derived::CVec_RouteHopZ, short_channel_id: crate::c_types::derived::COption_u64Z, retry: crate::lightning::routing::router::RouteParameters) -> Event {
Event::PaymentPathFailed {
}
}
#[no_mangle]
-/// Utility method to constructs a new PaymentFailed-variant Event
-pub extern "C" fn Event_payment_failed(payment_id: crate::c_types::ThirtyTwoBytes, payment_hash: crate::c_types::ThirtyTwoBytes) -> Event {
- Event::PaymentFailed {
- payment_id,
- payment_hash,
- }
-}
-#[no_mangle]
/// Utility method to constructs a new PendingHTLCsForwardable-variant Event
pub extern "C" fn Event_pending_htlcs_forwardable(time_forwardable: u64) -> Event {
Event::PendingHTLCsForwardable {
}
#[no_mangle]
/// Utility method to constructs a new PaymentForwarded-variant Event
-pub extern "C" fn Event_payment_forwarded(fee_earned_msat: crate::c_types::derived::COption_u64Z, claim_from_onchain_tx: bool) -> Event {
+pub extern "C" fn Event_payment_forwarded(prev_channel_id: crate::c_types::ThirtyTwoBytes, next_channel_id: crate::c_types::ThirtyTwoBytes, fee_earned_msat: crate::c_types::derived::COption_u64Z, claim_from_onchain_tx: bool) -> Event {
Event::PaymentForwarded {
+ prev_channel_id,
+ next_channel_id,
fee_earned_msat,
claim_from_onchain_tx,
}
}
}
#[no_mangle]
-/// Utility method to constructs a new PaymentPathSuccessful-variant Event
-pub extern "C" fn Event_payment_path_successful(payment_id: crate::c_types::ThirtyTwoBytes, payment_hash: crate::c_types::ThirtyTwoBytes, path: crate::c_types::derived::CVec_RouteHopZ) -> Event {
- Event::PaymentPathSuccessful {
- payment_id,
- payment_hash,
- path,
- }
-}
-#[no_mangle]
/// Utility method to constructs a new OpenChannelRequest-variant Event
pub extern "C" fn Event_open_channel_request(temporary_channel_id: crate::c_types::ThirtyTwoBytes, counterparty_node_id: crate::c_types::PublicKey, funding_satoshis: u64, push_msat: u64, channel_type: crate::lightning::ln::features::ChannelTypeFeatures) -> Event {
Event::OpenChannelRequest {
/// An event generated by ChannelManager which indicates a message should be sent to a peer (or
/// broadcast to most peers).
/// These events are handled by PeerManager::process_events if you are using a PeerManager.
-#[must_use]
#[derive(Clone)]
+#[must_use]
#[repr(C)]
pub enum MessageSendEvent {
/// Used to indicate that we've accepted a channel open and should send the accept_channel
/// The message which should be sent.
msg: crate::lightning::ln::msgs::FundingSigned,
},
- /// Used to indicate that a funding_locked message should be sent to the peer with the given node_id.
- SendFundingLocked {
+ /// Used to indicate that a channel_ready message should be sent to the peer with the given node_id.
+ SendChannelReady {
/// The node_id of the node which should receive these message(s)
node_id: crate::c_types::PublicKey,
- /// The funding_locked message which should be sent.
- msg: crate::lightning::ln::msgs::FundingLocked,
+ /// The channel_ready message which should be sent.
+ msg: crate::lightning::ln::msgs::ChannelReady,
},
/// Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id.
SendAnnouncementSignatures {
msg: crate::lightning::ln::msgs::GossipTimestampFilter,
},
}
-use lightning::util::events::MessageSendEvent as nativeMessageSendEvent;
+use lightning::util::events::MessageSendEvent as MessageSendEventImport;
+pub(crate) type nativeMessageSendEvent = MessageSendEventImport;
+
impl MessageSendEvent {
#[allow(unused)]
pub(crate) fn to_native(&self) -> nativeMessageSendEvent {
msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) },
}
},
- MessageSendEvent::SendFundingLocked {ref node_id, ref msg, } => {
+ MessageSendEvent::SendChannelReady {ref node_id, ref msg, } => {
let mut node_id_nonref = (*node_id).clone();
let mut msg_nonref = (*msg).clone();
- nativeMessageSendEvent::SendFundingLocked {
+ nativeMessageSendEvent::SendChannelReady {
node_id: node_id_nonref.into_rust(),
msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) },
}
msg: *unsafe { Box::from_raw(msg.take_inner()) },
}
},
- MessageSendEvent::SendFundingLocked {mut node_id, mut msg, } => {
- nativeMessageSendEvent::SendFundingLocked {
+ MessageSendEvent::SendChannelReady {mut node_id, mut msg, } => {
+ nativeMessageSendEvent::SendChannelReady {
node_id: node_id.into_rust(),
msg: *unsafe { Box::from_raw(msg.take_inner()) },
}
msg: crate::lightning::ln::msgs::FundingSigned { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true },
}
},
- nativeMessageSendEvent::SendFundingLocked {ref node_id, ref msg, } => {
+ nativeMessageSendEvent::SendChannelReady {ref node_id, ref msg, } => {
let mut node_id_nonref = (*node_id).clone();
let mut msg_nonref = (*msg).clone();
- MessageSendEvent::SendFundingLocked {
+ MessageSendEvent::SendChannelReady {
node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref),
- msg: crate::lightning::ln::msgs::FundingLocked { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true },
+ msg: crate::lightning::ln::msgs::ChannelReady { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true },
}
},
nativeMessageSendEvent::SendAnnouncementSignatures {ref node_id, ref msg, } => {
msg: crate::lightning::ln::msgs::FundingSigned { inner: ObjOps::heap_alloc(msg), is_owned: true },
}
},
- nativeMessageSendEvent::SendFundingLocked {mut node_id, mut msg, } => {
- MessageSendEvent::SendFundingLocked {
+ nativeMessageSendEvent::SendChannelReady {mut node_id, mut msg, } => {
+ MessageSendEvent::SendChannelReady {
node_id: crate::c_types::PublicKey::from_rust(&node_id),
- msg: crate::lightning::ln::msgs::FundingLocked { inner: ObjOps::heap_alloc(msg), is_owned: true },
+ msg: crate::lightning::ln::msgs::ChannelReady { inner: ObjOps::heap_alloc(msg), is_owned: true },
}
},
nativeMessageSendEvent::SendAnnouncementSignatures {mut node_id, mut msg, } => {
}
}
#[no_mangle]
-/// Utility method to constructs a new SendFundingLocked-variant MessageSendEvent
-pub extern "C" fn MessageSendEvent_send_funding_locked(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::FundingLocked) -> MessageSendEvent {
- MessageSendEvent::SendFundingLocked {
+/// Utility method to constructs a new SendChannelReady-variant MessageSendEvent
+pub extern "C" fn MessageSendEvent_send_channel_ready(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::ChannelReady) -> MessageSendEvent {
+ MessageSendEvent::SendChannelReady {
node_id,
msg,
}
use alloc::{vec::Vec, boxed::Box};
/// An enum representing the available verbosity levels of the logger.
-#[must_use]
#[derive(Clone)]
+#[must_use]
#[repr(C)]
pub enum Level {
/// Designates extremely verbose information, including gossip-induced messages
/// Designates very serious errors
Error,
}
-use lightning::util::logger::Level as nativeLevel;
+use lightning::util::logger::Level as LevelImport;
+pub(crate) type nativeLevel = LevelImport;
+
impl Level {
#[allow(unused)]
pub(crate) fn to_native(&self) -> nativeLevel {
/// Signatures are EC recoverable, meaning that given the message and the signature the PublicKey of the signer can be extracted.
#[no_mangle]
pub extern "C" fn sign(mut msg: crate::c_types::u8slice, sk: *const [u8; 32]) -> crate::c_types::derived::CResult_StringErrorZ {
- let mut ret = lightning::util::message_signing::sign(msg.to_slice(), &::bitcoin::secp256k1::key::SecretKey::from_slice(&unsafe { *sk}[..]).unwrap());
+ let mut ret = lightning::util::message_signing::sign(msg.to_slice(), &::bitcoin::secp256k1::SecretKey::from_slice(&unsafe { *sk}[..]).unwrap());
let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { o.into() }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::c_types::Secp256k1Error::from_rust(e) }).into() };
local_ret
}
pub mod ser;
pub mod message_signing;
pub mod invoice;
+pub mod persist;
pub mod logger;
pub mod config;
mod fuzz_wrappers {
use alloc::{vec::Vec, boxed::Box};
}
+}
+mod fairrwlock {
+
+use alloc::str::FromStr;
+use core::ffi::c_void;
+use core::convert::Infallible;
+use bitcoin::hashes::Hash;
+use crate::c_types::*;
+#[cfg(feature="no-std")]
+use alloc::{vec::Vec, boxed::Box};
+
}
mod zbase32 {
use alloc::{vec::Vec, boxed::Box};
}
+}
+mod time {
+
+use alloc::str::FromStr;
+use core::ffi::c_void;
+use core::convert::Infallible;
+use bitcoin::hashes::Hash;
+use crate::c_types::*;
+#[cfg(feature="no-std")]
+use alloc::{vec::Vec, boxed::Box};
+
}
mod macro_logger {
--- /dev/null
+// This file is Copyright its original authors, visible in version control
+// history and in the source files from which this was generated.
+//
+// This file is licensed under the license available in the LICENSE or LICENSE.md
+// file in the root of this repository or, if no such file exists, the same
+// license as that which applies to the original source files from which this
+// source was automatically generated.
+
+//! This module contains a simple key-value store trait KVStorePersister that
+//! allows one to implement the persistence for [`ChannelManager`], [`NetworkGraph`],
+//! and [`ChannelMonitor`] all in one place.
+
+use alloc::str::FromStr;
+use core::ffi::c_void;
+use core::convert::Infallible;
+use bitcoin::hashes::Hash;
+use crate::c_types::*;
+#[cfg(feature="no-std")]
+use alloc::{vec::Vec, boxed::Box};
+
+/// Trait that handles persisting a [`ChannelManager`], [`NetworkGraph`], and [`MultiThreadedLockableScore`] to disk.
+#[repr(C)]
+pub struct Persister {
+ /// 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,
+ /// Persist the given ['ChannelManager'] to disk, returning an error if persistence failed.
+ #[must_use]
+ pub persist_manager: extern "C" fn (this_arg: *const c_void, channel_manager: &crate::lightning::ln::channelmanager::ChannelManager) -> crate::c_types::derived::CResult_NoneErrorZ,
+ /// Persist the given [`NetworkGraph`] to disk, returning an error if persistence failed.
+ #[must_use]
+ pub persist_graph: extern "C" fn (this_arg: *const c_void, network_graph: &crate::lightning::routing::gossip::NetworkGraph) -> crate::c_types::derived::CResult_NoneErrorZ,
+ /// Persist the given [`MultiThreadedLockableScore`] to disk, returning an error if persistence failed.
+ #[must_use]
+ pub persist_scorer: extern "C" fn (this_arg: *const c_void, scorer: &crate::lightning::routing::scoring::MultiThreadedLockableScore) -> crate::c_types::derived::CResult_NoneErrorZ,
+ /// 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 Persister {}
+unsafe impl Sync for Persister {}
+#[no_mangle]
+pub(crate) extern "C" fn Persister_clone_fields(orig: &Persister) -> Persister {
+ Persister {
+ this_arg: orig.this_arg,
+ persist_manager: Clone::clone(&orig.persist_manager),
+ persist_graph: Clone::clone(&orig.persist_graph),
+ persist_scorer: Clone::clone(&orig.persist_scorer),
+ free: Clone::clone(&orig.free),
+ }
+}
+
+use lightning::util::persist::Persister as rustPersister;
+impl<'a> rustPersister<'a, crate::lightning::chain::keysinterface::Sign, crate::lightning::chain::Watch, crate::lightning::chain::chaininterface::BroadcasterInterface, crate::lightning::chain::keysinterface::KeysInterface, crate::lightning::chain::chaininterface::FeeEstimator, crate::lightning::util::logger::Logger, crate::lightning::routing::scoring::Score> for Persister {
+ fn persist_manager(&self, mut channel_manager: &lightning::ln::channelmanager::ChannelManager<crate::lightning::chain::keysinterface::Sign, crate::lightning::chain::Watch, crate::lightning::chain::chaininterface::BroadcasterInterface, crate::lightning::chain::keysinterface::KeysInterface, crate::lightning::chain::chaininterface::FeeEstimator, crate::lightning::util::logger::Logger>) -> Result<(), lightning::io::Error> {
+ let mut ret = (self.persist_manager)(self.this_arg, &crate::lightning::ln::channelmanager::ChannelManager { inner: unsafe { ObjOps::nonnull_ptr_to_inner((channel_manager as *const lightning::ln::channelmanager::ChannelManager<_, _, _, _, _, _, >) 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)) })*/ }), false => Err( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).to_rust() })};
+ local_ret
+ }
+ fn persist_graph(&self, mut network_graph: &lightning::routing::gossip::NetworkGraph<crate::lightning::util::logger::Logger>) -> Result<(), lightning::io::Error> {
+ let mut ret = (self.persist_graph)(self.this_arg, &crate::lightning::routing::gossip::NetworkGraph { inner: unsafe { ObjOps::nonnull_ptr_to_inner((network_graph as *const lightning::routing::gossip::NetworkGraph<_, >) 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)) })*/ }), false => Err( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).to_rust() })};
+ local_ret
+ }
+ fn persist_scorer(&self, mut scorer: &lightning::routing::scoring::MultiThreadedLockableScore<crate::lightning::routing::scoring::Score>) -> Result<(), lightning::io::Error> {
+ let mut ret = (self.persist_scorer)(self.this_arg, &crate::lightning::routing::scoring::MultiThreadedLockableScore { inner: unsafe { ObjOps::nonnull_ptr_to_inner((scorer as *const lightning::routing::scoring::MultiThreadedLockableScore<_, >) 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)) })*/ }), false => Err( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).to_rust() })};
+ 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 Persister {
+ type Target = Self;
+ fn deref(&self) -> &Self {
+ self
+ }
+}
+/// Calls the free function if one is set
+#[no_mangle]
+pub extern "C" fn Persister_free(this_ptr: Persister) { }
+impl Drop for Persister {
+ fn drop(&mut self) {
+ if let Some(f) = self.free {
+ f(self.this_arg);
+ }
+ }
+}
#[no_mangle]
pub static MAX_BUF_SIZE: usize = lightning::util::ser::MAX_BUF_SIZE;
+
+use lightning::util::ser::BigSize as nativeBigSizeImport;
+pub(crate) type nativeBigSize = nativeBigSizeImport;
+
+/// Lightning TLV uses a custom variable-length integer called BigSize. It is similar to Bitcoin's
+/// variable-length integers except that it is serialized in big-endian instead of little-endian.
+///
+/// Like Bitcoin's variable-length integer, it exhibits ambiguity in that certain values can be
+/// encoded in several different ways, which we must check for at deserialization-time. Thus, if
+/// you're looking for an example of a variable-length integer to use for your own project, move
+/// along, this is a rather poor design.
+#[must_use]
+#[repr(C)]
+pub struct BigSize {
+ /// 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 nativeBigSize,
+ /// 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 BigSize {
+ fn drop(&mut self) {
+ if self.is_owned && !<*mut nativeBigSize>::is_null(self.inner) {
+ let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+ }
+ }
+}
+/// Frees any resources used by the BigSize, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn BigSize_free(this_obj: BigSize) { }
+#[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_free_void(this_ptr: *mut c_void) {
+ unsafe { let _ = Box::from_raw(this_ptr as *mut nativeBigSize); }
+}
+#[allow(unused)]
+impl BigSize {
+ pub(crate) fn get_native_ref(&self) -> &'static nativeBigSize {
+ unsafe { &*ObjOps::untweak_ptr(self.inner) }
+ }
+ pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeBigSize {
+ 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 nativeBigSize {
+ assert!(self.is_owned);
+ let ret = ObjOps::untweak_ptr(self.inner);
+ self.inner = core::ptr::null_mut();
+ ret
+ }
+}
+#[no_mangle]
+pub extern "C" fn BigSize_get_a(this_ptr: &BigSize) -> u64 {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().0;
+ *inner_val
+}
+#[no_mangle]
+pub extern "C" fn BigSize_set_a(this_ptr: &mut BigSize, mut val: u64) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.0 = val;
+}
+/// Constructs a new BigSize given each field
+#[must_use]
+#[no_mangle]
+pub extern "C" fn BigSize_new(mut a_arg: u64) -> BigSize {
+ BigSize { inner: ObjOps::heap_alloc(lightning::util::ser::BigSize (
+ a_arg,
+ )), is_owned: true }
+}
/// [`ChannelManager`] persistence should be done in the background.
/// * Calling [`ChannelManager::timer_tick_occurred`] and [`PeerManager::timer_tick_occurred`]
/// at the appropriate intervals.
-/// * Calling [`NetworkGraph::remove_stale_channels`] (if a [`NetGraphMsgHandler`] is provided to
-/// [`BackgroundProcessor::start`]).
+/// * Calling [`NetworkGraph::remove_stale_channels`] (if a [`GossipSync`] with a [`NetworkGraph`]
+/// is provided to [`BackgroundProcessor::start`]).
///
/// It will also call [`PeerManager::process_events`] periodically though this shouldn't be relied
/// upon as doing so may result in high latency.
ret
}
}
-/// Trait that handles persisting a [`ChannelManager`] and [`NetworkGraph`] to disk.
+/// Either [`P2PGossipSync`] or [`RapidGossipSync`].
+#[must_use]
#[repr(C)]
-pub struct Persister {
- /// 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,
- /// Persist the given [`ChannelManager`] to disk, returning an error if persistence failed
- /// (which will cause the [`BackgroundProcessor`] which called this method to exit).
- #[must_use]
- pub persist_manager: extern "C" fn (this_arg: *const c_void, channel_manager: &crate::lightning::ln::channelmanager::ChannelManager) -> crate::c_types::derived::CResult_NoneErrorZ,
- /// Persist the given [`NetworkGraph`] to disk, returning an error if persistence failed.
- #[must_use]
- pub persist_graph: extern "C" fn (this_arg: *const c_void, network_graph: &crate::lightning::routing::network_graph::NetworkGraph) -> crate::c_types::derived::CResult_NoneErrorZ,
- /// 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 Persister {}
-unsafe impl Sync for Persister {}
-#[no_mangle]
-pub(crate) extern "C" fn Persister_clone_fields(orig: &Persister) -> Persister {
- Persister {
- this_arg: orig.this_arg,
- persist_manager: Clone::clone(&orig.persist_manager),
- persist_graph: Clone::clone(&orig.persist_graph),
- free: Clone::clone(&orig.free),
- }
+pub enum GossipSync {
+ /// Gossip sync via the lightning peer-to-peer network as defined by BOLT 7.
+ P2P(
+ /// Note that this field is expected to be a reference.
+ crate::lightning::routing::gossip::P2PGossipSync),
+ /// Rapid gossip sync from a trusted server.
+ Rapid(
+ /// Note that this field is expected to be a reference.
+ crate::lightning_rapid_gossip_sync::RapidGossipSync),
+ /// No gossip sync.
+ None,
}
+use lightning_background_processor::GossipSync as GossipSyncImport;
+pub(crate) type nativeGossipSync = GossipSyncImport<&'static lightning::routing::gossip::P2PGossipSync<&'static lightning::routing::gossip::NetworkGraph<crate::lightning::util::logger::Logger>, crate::lightning::chain::Access, crate::lightning::util::logger::Logger>, &'static lightning_rapid_gossip_sync::RapidGossipSync<&'static lightning::routing::gossip::NetworkGraph<crate::lightning::util::logger::Logger>, crate::lightning::util::logger::Logger>, &'static lightning::routing::gossip::NetworkGraph<crate::lightning::util::logger::Logger>, crate::lightning::chain::Access, crate::lightning::util::logger::Logger>;
-use lightning_background_processor::Persister as rustPersister;
-impl rustPersister<crate::lightning::chain::keysinterface::Sign, crate::lightning::chain::Watch, crate::lightning::chain::chaininterface::BroadcasterInterface, crate::lightning::chain::keysinterface::KeysInterface, crate::lightning::chain::chaininterface::FeeEstimator, crate::lightning::util::logger::Logger> for Persister {
- fn persist_manager(&self, mut channel_manager: &lightning::ln::channelmanager::ChannelManager<crate::lightning::chain::keysinterface::Sign, crate::lightning::chain::Watch, crate::lightning::chain::chaininterface::BroadcasterInterface, crate::lightning::chain::keysinterface::KeysInterface, crate::lightning::chain::chaininterface::FeeEstimator, crate::lightning::util::logger::Logger>) -> Result<(), std::io::Error> {
- let mut ret = (self.persist_manager)(self.this_arg, &crate::lightning::ln::channelmanager::ChannelManager { inner: unsafe { ObjOps::nonnull_ptr_to_inner((channel_manager as *const lightning::ln::channelmanager::ChannelManager<_, _, _, _, _, _, >) 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)) })*/ }), false => Err( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).to_rust() })};
- local_ret
+impl GossipSync {
+ #[allow(unused)]
+ pub(crate) fn into_native(self) -> nativeGossipSync {
+ match self {
+ GossipSync::P2P (mut a, ) => {
+ nativeGossipSync::P2P (
+ a.get_native_ref(),
+ )
+ },
+ GossipSync::Rapid (mut a, ) => {
+ nativeGossipSync::Rapid (
+ a.get_native_ref(),
+ )
+ },
+ GossipSync::None => nativeGossipSync::None,
+ }
}
- fn persist_graph(&self, mut network_graph: &lightning::routing::network_graph::NetworkGraph) -> Result<(), std::io::Error> {
- let mut ret = (self.persist_graph)(self.this_arg, &crate::lightning::routing::network_graph::NetworkGraph { inner: unsafe { ObjOps::nonnull_ptr_to_inner((network_graph as *const lightning::routing::network_graph::NetworkGraph<>) 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)) })*/ }), false => Err( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).to_rust() })};
- local_ret
+ #[allow(unused)]
+ pub(crate) fn native_into(native: nativeGossipSync) -> Self {
+ match native {
+ nativeGossipSync::P2P (mut a, ) => {
+ GossipSync::P2P (
+ crate::lightning::routing::gossip::P2PGossipSync { inner: unsafe { ObjOps::nonnull_ptr_to_inner((a as *const lightning::routing::gossip::P2PGossipSync<_, _, _, >) as *mut _) }, is_owned: false },
+ )
+ },
+ nativeGossipSync::Rapid (mut a, ) => {
+ GossipSync::Rapid (
+ crate::lightning_rapid_gossip_sync::RapidGossipSync { inner: unsafe { ObjOps::nonnull_ptr_to_inner((a as *const lightning_rapid_gossip_sync::RapidGossipSync<_, _, >) as *mut _) }, is_owned: false },
+ )
+ },
+ nativeGossipSync::None => GossipSync::None,
+ }
}
}
-
-// 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 Persister {
- type Target = Self;
- fn deref(&self) -> &Self {
- self
- }
+/// Frees any resources used by the GossipSync
+#[no_mangle]
+pub extern "C" fn GossipSync_free(this_ptr: 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 {
+ GossipSync::P2P(crate::lightning::routing::gossip::P2PGossipSync { inner: a.inner, is_owned: false }, )
}
-/// Calls the free function if one is set
#[no_mangle]
-pub extern "C" fn Persister_free(this_ptr: Persister) { }
-impl Drop for Persister {
- fn drop(&mut self) {
- if let Some(f) = self.free {
- f(self.this_arg);
- }
- }
+/// Utility method to constructs a new Rapid-variant GossipSync
+pub extern "C" fn GossipSync_rapid(a: &crate::lightning_rapid_gossip_sync::RapidGossipSync) -> GossipSync {
+ GossipSync::Rapid(crate::lightning_rapid_gossip_sync::RapidGossipSync { inner: a.inner, is_owned: false }, )
}
+#[no_mangle]
+/// Utility method to constructs a new None-variant GossipSync
+pub extern "C" fn GossipSync_none() -> GossipSync {
+ GossipSync::None}
/// Start a background thread that takes care of responsibilities enumerated in the [top-level
/// documentation].
///
///
/// [`Persister::persist_manager`] is responsible for writing out the [`ChannelManager`] to disk, and/or
/// uploading to one or more backup services. See [`ChannelManager::write`] for writing out a
-/// [`ChannelManager`]. See [`FilesystemPersister::persist_manager`] for Rust-Lightning's
+/// [`ChannelManager`]. See the `lightning-persister` crate for LDK's
/// provided implementation.
///
-/// [`Persister::persist_graph`] is responsible for writing out the [`NetworkGraph`] to disk. See
-/// [`NetworkGraph::write`] for writing out a [`NetworkGraph`]. See [`FilesystemPersister::persist_network_graph`]
-/// for Rust-Lightning's provided implementation.
+/// [`Persister::persist_graph`] is responsible for writing out the [`NetworkGraph`] to disk, if
+/// [`GossipSync`] is supplied. See [`NetworkGraph::write`] for writing out a [`NetworkGraph`].
+/// See the `lightning-persister` crate for LDK's provided implementation.
///
/// Typically, users should either implement [`Persister::persist_manager`] to never return an
/// error or call [`join`] and handle any error that may arise. For the latter case,
/// `event_handler` is responsible for handling events that users should be notified of (e.g.,
/// payment failed). [`BackgroundProcessor`] may decorate the given [`EventHandler`] with common
/// functionality implemented by other handlers.
-/// * [`NetGraphMsgHandler`] if given will update the [`NetworkGraph`] based on payment failures.
+/// * [`P2PGossipSync`] if given will update the [`NetworkGraph`] based on payment failures.
+///
+/// # Rapid Gossip Sync
+///
+/// If rapid gossip sync is meant to run at startup, pass a [`RapidGossipSync`] to `gossip_sync`
+/// to indicate that the [`BackgroundProcessor`] should not prune the [`NetworkGraph`] instance
+/// until the [`RapidGossipSync`] instance completes its first sync.
///
/// [top-level documentation]: BackgroundProcessor
/// [`join`]: Self::join
/// [`stop`]: Self::stop
/// [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
/// [`ChannelManager::write`]: lightning::ln::channelmanager::ChannelManager#impl-Writeable
-/// [`FilesystemPersister::persist_manager`]: lightning_persister::FilesystemPersister::persist_manager
-/// [`FilesystemPersister::persist_network_graph`]: lightning_persister::FilesystemPersister::persist_network_graph
-/// [`NetworkGraph`]: lightning::routing::network_graph::NetworkGraph
-/// [`NetworkGraph::write`]: lightning::routing::network_graph::NetworkGraph#impl-Writeable
+/// [`Persister::persist_manager`]: lightning::util::persist::Persister::persist_manager
+/// [`Persister::persist_graph`]: lightning::util::persist::Persister::persist_graph
+/// [`NetworkGraph`]: lightning::routing::gossip::NetworkGraph
+/// [`NetworkGraph::write`]: lightning::routing::gossip::NetworkGraph#impl-Writeable
///
-/// Note that net_graph_msg_handler (or a relevant inner pointer) may be NULL or all-0s to represent None
+/// Note that scorer (or a relevant inner pointer) may be NULL or all-0s to represent None
#[must_use]
#[no_mangle]
-pub extern "C" fn BackgroundProcessor_start(mut persister: crate::lightning_background_processor::Persister, mut event_handler: crate::lightning::util::events::EventHandler, chain_monitor: &crate::lightning::chain::chainmonitor::ChainMonitor, channel_manager: &crate::lightning::ln::channelmanager::ChannelManager, mut net_graph_msg_handler: crate::lightning::routing::network_graph::NetGraphMsgHandler, peer_manager: &crate::lightning::ln::peer_handler::PeerManager, mut logger: crate::lightning::util::logger::Logger) -> crate::lightning_background_processor::BackgroundProcessor {
- let mut local_net_graph_msg_handler = if net_graph_msg_handler.inner.is_null() { None } else { Some( { net_graph_msg_handler.get_native_ref() }) };
- let mut ret = lightning_background_processor::BackgroundProcessor::start(persister, event_handler, chain_monitor.get_native_ref(), channel_manager.get_native_ref(), local_net_graph_msg_handler, peer_manager.get_native_ref(), logger);
+pub extern "C" fn BackgroundProcessor_start(mut persister: crate::lightning::util::persist::Persister, mut event_handler: crate::lightning::util::events::EventHandler, chain_monitor: &crate::lightning::chain::chainmonitor::ChainMonitor, channel_manager: &crate::lightning::ln::channelmanager::ChannelManager, mut gossip_sync: crate::lightning_background_processor::GossipSync, peer_manager: &crate::lightning::ln::peer_handler::PeerManager, mut logger: crate::lightning::util::logger::Logger, mut scorer: crate::lightning::routing::scoring::MultiThreadedLockableScore) -> crate::lightning_background_processor::BackgroundProcessor {
+ let mut local_scorer = if scorer.inner.is_null() { None } else { Some( { scorer.get_native_ref() }) };
+ let mut ret = lightning_background_processor::BackgroundProcessor::start(persister, event_handler, chain_monitor.get_native_ref(), channel_manager.get_native_ref(), gossip_sync.into_native(), peer_manager.get_native_ref(), logger, local_scorer);
crate::lightning_background_processor::BackgroundProcessor { inner: ObjOps::heap_alloc(ret), is_owned: true }
}
// source was automatically generated.
//! This crate provides data structures to represent
-//! [lightning BOLT11](https://github.com/lightningnetwork/lightning-rfc/blob/master/11-payment-encoding.md)
+//! [lightning BOLT11](https://github.com/lightning/bolts/blob/master/11-payment-encoding.md)
//! invoices and functions to create, encode and decode these. If you just want to use the standard
//! en-/decoding functionality this should get you started:
//!
pub mod payment;
pub mod utils;
pub mod constants;
+mod time_utils {
+
+use alloc::str::FromStr;
+use core::ffi::c_void;
+use core::convert::Infallible;
+use bitcoin::hashes::Hash;
+use crate::c_types::*;
+#[cfg(feature="no-std")]
+use alloc::{vec::Vec, boxed::Box};
+
+}
mod de {
use alloc::str::FromStr;
}
/// Errors that indicate what is wrong with the invoice. They have some granularity for debug
/// reasons, but should generally result in an \"invalid BOLT11 invoice\" message for the user.
-#[must_use]
#[derive(Clone)]
+#[must_use]
#[repr(C)]
pub enum ParseError {
- Bech32Error(crate::c_types::Bech32Error),
- ParseAmountError(crate::c_types::Error),
- MalformedSignature(crate::c_types::Secp256k1Error),
+ Bech32Error(
+ crate::c_types::Bech32Error),
+ ParseAmountError(
+ crate::c_types::Error),
+ MalformedSignature(
+ crate::c_types::Secp256k1Error),
BadPrefix,
UnknownCurrency,
UnknownSiPrefix,
MalformedHRP,
TooShortDataPart,
UnexpectedEndOfTaggedFields,
- DescriptionDecodeError(crate::c_types::Error),
+ DescriptionDecodeError(
+ crate::c_types::Error),
PaddingError,
IntegerOverflowError,
InvalidSegWitProgramLength,
InvalidPubKeyHashLength,
InvalidScriptHashLength,
InvalidRecoveryId,
- InvalidSliceLength(crate::c_types::Str),
+ InvalidSliceLength(
+ crate::c_types::Str),
/// Not an error, but used internally to signal that a part of the invoice should be ignored
/// according to BOLT11
Skip,
}
-use lightning_invoice::ParseError as nativeParseError;
+use lightning_invoice::ParseError as ParseErrorImport;
+pub(crate) type nativeParseError = ParseErrorImport;
+
impl ParseError {
#[allow(unused)]
pub(crate) fn to_native(&self) -> nativeParseError {
/// Indicates that something went wrong while parsing or validating the invoice. Parsing errors
/// should be mostly seen as opaque and are only there for debugging reasons. Semantic errors
/// like wrong signatures, missing fields etc. could mean that someone tampered with the invoice.
-#[must_use]
#[derive(Clone)]
+#[must_use]
#[repr(C)]
pub enum ParseOrSemanticError {
/// The invoice couldn't be decoded
- ParseError(crate::lightning_invoice::ParseError),
+ ParseError(
+ crate::lightning_invoice::ParseError),
/// The invoice could be decoded but violates the BOLT11 standard
- SemanticError(crate::lightning_invoice::SemanticError),
+ SemanticError(
+ crate::lightning_invoice::SemanticError),
}
-use lightning_invoice::ParseOrSemanticError as nativeParseOrSemanticError;
+use lightning_invoice::ParseOrSemanticError as ParseOrSemanticErrorImport;
+pub(crate) type nativeParseOrSemanticError = ParseOrSemanticErrorImport;
+
impl ParseOrSemanticError {
#[allow(unused)]
pub(crate) fn to_native(&self) -> nativeParseOrSemanticError {
orig.clone()
}
/// SI prefixes for the human readable part
-#[must_use]
#[derive(Clone)]
+#[must_use]
#[repr(C)]
pub enum SiPrefix {
/// 10^-3
/// 10^-12
Pico,
}
-use lightning_invoice::SiPrefix as nativeSiPrefix;
+use lightning_invoice::SiPrefix as SiPrefixImport;
+pub(crate) type nativeSiPrefix = SiPrefixImport;
+
impl SiPrefix {
#[allow(unused)]
pub(crate) fn to_native(&self) -> nativeSiPrefix {
}
/// Enum representing the crypto currencies (or networks) supported by this library
-#[must_use]
#[derive(Clone)]
+#[must_use]
#[repr(C)]
pub enum Currency {
/// Bitcoin mainnet
/// Bitcoin signet
Signet,
}
-use lightning_invoice::Currency as nativeCurrency;
+use lightning_invoice::Currency as CurrencyImport;
+pub(crate) type nativeCurrency = CurrencyImport;
+
impl Currency {
#[allow(unused)]
pub(crate) fn to_native(&self) -> nativeCurrency {
if a.get_native_ref() == b.get_native_ref() { true } else { false }
}
/// Fallback address in case no LN payment is possible
-#[must_use]
#[derive(Clone)]
+#[must_use]
#[repr(C)]
pub enum Fallback {
SegWitProgram {
version: crate::c_types::u5,
program: crate::c_types::derived::CVec_u8Z,
},
- PubKeyHash(crate::c_types::TwentyBytes),
- ScriptHash(crate::c_types::TwentyBytes),
+ PubKeyHash(
+ crate::c_types::TwentyBytes),
+ ScriptHash(
+ crate::c_types::TwentyBytes),
}
-use lightning_invoice::Fallback as nativeFallback;
+use lightning_invoice::Fallback as FallbackImport;
+pub(crate) type nativeFallback = FallbackImport;
+
impl Fallback {
#[allow(unused)]
pub(crate) fn to_native(&self) -> nativeFallback {
}
/// Errors that may occur when constructing a new `RawInvoice` or `Invoice`
-#[must_use]
#[derive(Clone)]
+#[must_use]
#[repr(C)]
pub enum CreationError {
/// The supplied description string was longer than 639 __bytes__ (see [`Description::new(…)`](./struct.Description.html#method.new))
/// [phantom invoices]: crate::utils::create_phantom_invoice
MissingRouteHints,
}
-use lightning_invoice::CreationError as nativeCreationError;
+use lightning_invoice::CreationError as CreationErrorImport;
+pub(crate) type nativeCreationError = CreationErrorImport;
+
impl CreationError {
#[allow(unused)]
pub(crate) fn to_native(&self) -> nativeCreationError {
}
/// Errors that may occur when converting a `RawInvoice` to an `Invoice`. They relate to the
/// requirements sections in BOLT #11
-#[must_use]
#[derive(Clone)]
+#[must_use]
#[repr(C)]
pub enum SemanticError {
/// The invoice is missing the mandatory payment hash
/// The invoice's amount was not a whole number of millisatoshis
ImpreciseAmount,
}
-use lightning_invoice::SemanticError as nativeSemanticError;
+use lightning_invoice::SemanticError as SemanticErrorImport;
+pub(crate) type nativeSemanticError = SemanticErrorImport;
+
impl SemanticError {
#[allow(unused)]
pub(crate) fn to_native(&self) -> nativeSemanticError {
}
/// When signing using a fallible method either an user-supplied `SignError` or a `CreationError`
/// may occur.
-#[must_use]
#[derive(Clone)]
+#[must_use]
#[repr(C)]
pub enum SignOrCreationError {
/// An error occurred during signing
SignError,
/// An error occurred while building the transaction
- CreationError(crate::lightning_invoice::CreationError),
+ CreationError(
+ crate::lightning_invoice::CreationError),
}
-use lightning_invoice::SignOrCreationError as nativeSignOrCreationError;
+use lightning_invoice::SignOrCreationError as SignOrCreationErrorImport;
+pub(crate) type nativeSignOrCreationError = SignOrCreationErrorImport<>;
+
impl SignOrCreationError {
#[allow(unused)]
pub(crate) fn to_native(&self) -> nativeSignOrCreationError {
//! # use lightning::ln::{PaymentHash, PaymentPreimage, PaymentSecret};
//! # use lightning::ln::channelmanager::{ChannelDetails, PaymentId, PaymentSendFailure};
//! # use lightning::ln::msgs::LightningError;
-//! # use lightning::routing::scoring::Score;
-//! # use lightning::routing::network_graph::NodeId;
+//! # use lightning::routing::gossip::NodeId;
//! # use lightning::routing::router::{Route, RouteHop, RouteParameters};
+//! # use lightning::routing::scoring::{ChannelUsage, Score};
//! # use lightning::util::events::{Event, EventHandler, EventsProvider};
//! # use lightning::util::logger::{Logger, Record};
//! # use lightning::util::ser::{Writeable, Writer};
//! # use lightning_invoice::Invoice;
-//! # use lightning_invoice::payment::{InvoicePayer, Payer, RetryAttempts, Router};
-//! # use secp256k1::key::PublicKey;
+//! # use lightning_invoice::payment::{InvoicePayer, Payer, Retry, Router};
+//! # use secp256k1::PublicKey;
//! # use std::cell::RefCell;
//! # use std::ops::Deref;
//! #
//! # }
//! # impl Score for FakeScorer {
//! # fn channel_penalty_msat(
-//! # &self, _short_channel_id: u64, _send_amt: u64, _chan_amt: u64, _source: &NodeId, _target: &NodeId
+//! # &self, _short_channel_id: u64, _source: &NodeId, _target: &NodeId, _usage: ChannelUsage
//! # ) -> u64 { 0 }
//! # fn payment_path_failed(&mut self, _path: &[&RouteHop], _short_channel_id: u64) {}
//! # fn payment_path_successful(&mut self, _path: &[&RouteHop]) {}
//! # let router = FakeRouter {};
//! # let scorer = RefCell::new(FakeScorer {});
//! # let logger = FakeLogger {};
-//! let invoice_payer = InvoicePayer::new(&payer, router, &scorer, &logger, event_handler, RetryAttempts(2));
+//! let invoice_payer = InvoicePayer::new(&payer, router, &scorer, &logger, event_handler, Retry::Attempts(2));
//!
//! let invoice = \"...\";
//! if let Ok(invoice) = invoice.parse::<Invoice>() {
use lightning_invoice::payment::Payer as rustPayer;
impl rustPayer for Payer {
- fn node_id(&self) -> secp256k1::key::PublicKey {
+ fn node_id(&self) -> secp256k1::PublicKey {
let mut ret = (self.node_id)(self.this_arg);
ret.into_rust()
}
use lightning_invoice::payment::Router as rustRouter;
impl rustRouter<crate::lightning::routing::scoring::Score> for Router {
- fn find_route(&self, mut payer: &secp256k1::key::PublicKey, mut route_params: &lightning::routing::router::RouteParameters, mut payment_hash: &lightning::ln::PaymentHash, mut first_hops: Option<&[&lightning::ln::channelmanager::ChannelDetails]>, mut scorer: &crate::lightning::routing::scoring::Score) -> Result<lightning::routing::router::Route, lightning::ln::msgs::LightningError> {
+ fn find_route(&self, mut payer: &secp256k1::PublicKey, mut route_params: &lightning::routing::router::RouteParameters, mut payment_hash: &lightning::ln::PaymentHash, mut first_hops: Option<&[&lightning::ln::channelmanager::ChannelDetails]>, mut scorer: &crate::lightning::routing::scoring::Score) -> Result<lightning::routing::router::Route, lightning::ln::msgs::LightningError> {
let mut local_first_hops_base = if first_hops.is_none() { SmartPtr::null() } else { SmartPtr::from_obj( { let mut local_first_hops_0 = Vec::new(); for item in (first_hops.unwrap()).iter() { local_first_hops_0.push( { crate::lightning::ln::channelmanager::ChannelDetails { inner: unsafe { ObjOps::nonnull_ptr_to_inner(((*item) as *const lightning::ln::channelmanager::ChannelDetails<>) as *mut _) }, is_owned: false } }); }; local_first_hops_0.into() }) }; let mut local_first_hops = *local_first_hops_base;
let mut ret = (self.find_route)(self.this_arg, crate::c_types::PublicKey::from_rust(&payer), &crate::lightning::routing::router::RouteParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((route_params as *const lightning::routing::router::RouteParameters<>) as *mut _) }, is_owned: false }, &payment_hash.0, local_first_hops, scorer);
let mut local_ret = match ret.result_ok { true => Ok( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).take_inner()) } }), false => Err( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).take_inner()) } })};
}
}
}
-
-use lightning_invoice::payment::RetryAttempts as nativeRetryAttemptsImport;
-pub(crate) type nativeRetryAttempts = nativeRetryAttemptsImport;
-
-/// Number of attempts to retry payment path failures for an [`Invoice`].
+/// Strategies available to retry payment path failures for an [`Invoice`].
///
-/// Note that this is the number of *path* failures, not full payment retries. For multi-path
-/// payments, if this is less than the total number of paths, we will never even retry all of the
-/// payment's paths.
+#[derive(Clone)]
#[must_use]
#[repr(C)]
-pub struct RetryAttempts {
- /// 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 nativeRetryAttempts,
- /// 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,
-}
+pub enum Retry {
+ /// Max number of attempts to retry payment.
+ ///
+ /// Note that this is the number of *path* failures, not full payment retries. For multi-path
+ /// payments, if this is less than the total number of paths, we will never even retry all of the
+ /// payment's paths.
+ Attempts(
+ usize),
+ /// Time elapsed before abandoning retries for a payment.
+ Timeout(
+ u64),
+}
+use lightning_invoice::payment::Retry as RetryImport;
+pub(crate) type nativeRetry = RetryImport;
-impl Drop for RetryAttempts {
- fn drop(&mut self) {
- if self.is_owned && !<*mut nativeRetryAttempts>::is_null(self.inner) {
- let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+impl Retry {
+ #[allow(unused)]
+ pub(crate) fn to_native(&self) -> nativeRetry {
+ match self {
+ Retry::Attempts (ref a, ) => {
+ let mut a_nonref = (*a).clone();
+ nativeRetry::Attempts (
+ a_nonref,
+ )
+ },
+ Retry::Timeout (ref a, ) => {
+ let mut a_nonref = (*a).clone();
+ nativeRetry::Timeout (
+ core::time::Duration::from_secs(a_nonref),
+ )
+ },
}
}
-}
-/// Frees any resources used by the RetryAttempts, if is_owned is set and inner is non-NULL.
-#[no_mangle]
-pub extern "C" fn RetryAttempts_free(this_obj: RetryAttempts) { }
-#[allow(unused)]
-/// Used only if an object of this type is returned as a trait impl by a method
-pub(crate) extern "C" fn RetryAttempts_free_void(this_ptr: *mut c_void) {
- unsafe { let _ = Box::from_raw(this_ptr as *mut nativeRetryAttempts); }
-}
-#[allow(unused)]
-impl RetryAttempts {
- pub(crate) fn get_native_ref(&self) -> &'static nativeRetryAttempts {
- unsafe { &*ObjOps::untweak_ptr(self.inner) }
+ #[allow(unused)]
+ pub(crate) fn into_native(self) -> nativeRetry {
+ match self {
+ Retry::Attempts (mut a, ) => {
+ nativeRetry::Attempts (
+ a,
+ )
+ },
+ Retry::Timeout (mut a, ) => {
+ nativeRetry::Timeout (
+ core::time::Duration::from_secs(a),
+ )
+ },
+ }
}
- pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeRetryAttempts {
- unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
+ #[allow(unused)]
+ pub(crate) fn from_native(native: &nativeRetry) -> Self {
+ match native {
+ nativeRetry::Attempts (ref a, ) => {
+ let mut a_nonref = (*a).clone();
+ Retry::Attempts (
+ a_nonref,
+ )
+ },
+ nativeRetry::Timeout (ref a, ) => {
+ let mut a_nonref = (*a).clone();
+ Retry::Timeout (
+ a_nonref.as_secs(),
+ )
+ },
+ }
}
- /// 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 nativeRetryAttempts {
- assert!(self.is_owned);
- let ret = ObjOps::untweak_ptr(self.inner);
- self.inner = core::ptr::null_mut();
- ret
+ #[allow(unused)]
+ pub(crate) fn native_into(native: nativeRetry) -> Self {
+ match native {
+ nativeRetry::Attempts (mut a, ) => {
+ Retry::Attempts (
+ a,
+ )
+ },
+ nativeRetry::Timeout (mut a, ) => {
+ Retry::Timeout (
+ a.as_secs(),
+ )
+ },
+ }
}
}
+/// Frees any resources used by the Retry
#[no_mangle]
-pub extern "C" fn RetryAttempts_get_a(this_ptr: &RetryAttempts) -> usize {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().0;
- *inner_val
-}
+pub extern "C" fn Retry_free(this_ptr: Retry) { }
+/// Creates a copy of the Retry
#[no_mangle]
-pub extern "C" fn RetryAttempts_set_a(this_ptr: &mut RetryAttempts, mut val: usize) {
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.0 = val;
+pub extern "C" fn Retry_clone(orig: &Retry) -> Retry {
+ orig.clone()
}
-/// Constructs a new RetryAttempts given each field
-#[must_use]
#[no_mangle]
-pub extern "C" fn RetryAttempts_new(mut a_arg: usize) -> RetryAttempts {
- RetryAttempts { inner: ObjOps::heap_alloc(lightning_invoice::payment::RetryAttempts (
- a_arg,
- )), is_owned: true }
-}
-impl Clone for RetryAttempts {
- fn clone(&self) -> Self {
- Self {
- inner: if <*mut nativeRetryAttempts>::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 RetryAttempts_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeRetryAttempts)).clone() })) as *mut c_void
+/// Utility method to constructs a new Attempts-variant Retry
+pub extern "C" fn Retry_attempts(a: usize) -> Retry {
+ Retry::Attempts(a, )
}
#[no_mangle]
-/// Creates a copy of the RetryAttempts
-pub extern "C" fn RetryAttempts_clone(orig: &RetryAttempts) -> RetryAttempts {
- orig.clone()
+/// Utility method to constructs a new Timeout-variant Retry
+pub extern "C" fn Retry_timeout(a: u64) -> Retry {
+ Retry::Timeout(a, )
}
-/// Checks if two RetryAttemptss contain equal inner contents.
+/// Checks if two Retrys 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 RetryAttempts_eq(a: &RetryAttempts, b: &RetryAttempts) -> 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 }
+pub extern "C" fn Retry_eq(a: &Retry, b: &Retry) -> bool {
+ if &a.to_native() == &b.to_native() { true } else { false }
}
-/// Checks if two RetryAttemptss contain equal inner contents.
+/// Checks if two Retrys contain equal inner contents.
#[no_mangle]
-pub extern "C" fn RetryAttempts_hash(o: &RetryAttempts) -> u64 {
- if o.inner.is_null() { return 0; }
+pub extern "C" fn Retry_hash(o: &Retry) -> u64 {
// Note that we'd love to use alloc::collections::hash_map::DefaultHasher but it's not in core
#[allow(deprecated)]
let mut hasher = core::hash::SipHasher::new();
- core::hash::Hash::hash(o.get_native_ref(), &mut hasher);
+ core::hash::Hash::hash(&o.to_native(), &mut hasher);
core::hash::Hasher::finish(&hasher)
}
/// An error that may occur when making a payment.
-#[must_use]
#[derive(Clone)]
+#[must_use]
#[repr(C)]
pub enum PaymentError {
/// An error resulting from the provided [`Invoice`] or payment hash.
- Invoice(crate::c_types::Str),
+ Invoice(
+ crate::c_types::Str),
/// An error occurring when finding a route.
- Routing(crate::lightning::ln::msgs::LightningError),
+ Routing(
+ crate::lightning::ln::msgs::LightningError),
/// An error occurring when sending a payment.
- Sending(crate::lightning::ln::channelmanager::PaymentSendFailure),
+ Sending(
+ crate::lightning::ln::channelmanager::PaymentSendFailure),
}
-use lightning_invoice::payment::PaymentError as nativePaymentError;
+use lightning_invoice::payment::PaymentError as PaymentErrorImport;
+pub(crate) type nativePaymentError = PaymentErrorImport;
+
impl PaymentError {
#[allow(unused)]
pub(crate) fn to_native(&self) -> nativePaymentError {
/// Creates an invoice payer that retries failed payment paths.
///
/// Will forward any [`Event::PaymentPathFailed`] events to the decorated `event_handler` once
-/// `retry_attempts` has been exceeded for a given [`Invoice`].
+/// `retry` has been exceeded for a given [`Invoice`].
#[must_use]
#[no_mangle]
-pub extern "C" fn InvoicePayer_new(mut payer: crate::lightning_invoice::payment::Payer, mut router: crate::lightning_invoice::payment::Router, scorer: &crate::lightning::routing::scoring::MultiThreadedLockableScore, mut logger: crate::lightning::util::logger::Logger, mut event_handler: crate::lightning::util::events::EventHandler, mut retry_attempts: crate::lightning_invoice::payment::RetryAttempts) -> crate::lightning_invoice::payment::InvoicePayer {
- let mut ret = lightning_invoice::payment::InvoicePayer::new(payer, router, scorer.get_native_ref(), logger, event_handler, *unsafe { Box::from_raw(retry_attempts.take_inner()) });
+pub extern "C" fn InvoicePayer_new(mut payer: crate::lightning_invoice::payment::Payer, mut router: crate::lightning_invoice::payment::Router, scorer: &crate::lightning::routing::scoring::MultiThreadedLockableScore, mut logger: crate::lightning::util::logger::Logger, mut event_handler: crate::lightning::util::events::EventHandler, mut retry: crate::lightning_invoice::payment::Retry) -> crate::lightning_invoice::payment::InvoicePayer {
+ let mut ret = lightning_invoice::payment::InvoicePayer::new(payer, router, scorer.get_native_ref(), logger, event_handler, retry.into_native());
crate::lightning_invoice::payment::InvoicePayer { inner: ObjOps::heap_alloc(ret), is_owned: true }
}
/// may be too long for QR code scanning. To fix this, `PhantomRouteHints::channels` may be pared
/// down
///
-/// `payment_hash` and `payment_secret` come from [`ChannelManager::create_inbound_payment`] or
-/// [`ChannelManager::create_inbound_payment_for_hash`]. These values can be retrieved from any
-/// participating node.
+/// `payment_hash` can be specified if you have a specific need for a custom payment hash (see the difference
+/// between [`ChannelManager::create_inbound_payment`] and [`ChannelManager::create_inbound_payment_for_hash`]).
+/// If `None` is provided for `payment_hash`, then one will be created.
+///
+/// `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
+/// in excess of the current time.
///
/// Note that the provided `keys_manager`'s `KeysInterface` implementation must support phantom
/// invoices in its `sign_invoice` implementation ([`PhantomKeysManager`] satisfies this
///
/// [`PhantomKeysManager`]: lightning::chain::keysinterface::PhantomKeysManager
/// [`ChannelManager::get_phantom_route_hints`]: lightning::ln::channelmanager::ChannelManager::get_phantom_route_hints
+/// [`ChannelManager::create_inbound_payment`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment
+/// [`ChannelManager::create_inbound_payment_for_hash`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
/// [`PhantomRouteHints::channels`]: lightning::ln::channelmanager::PhantomRouteHints::channels
+///
+/// Note that payment_hash (or a relevant inner pointer) may be NULL or all-0s to represent None
#[no_mangle]
-pub extern "C" fn create_phantom_invoice(mut amt_msat: crate::c_types::derived::COption_u64Z, mut description: crate::c_types::Str, mut payment_hash: crate::c_types::ThirtyTwoBytes, mut payment_secret: crate::c_types::ThirtyTwoBytes, mut phantom_route_hints: crate::c_types::derived::CVec_PhantomRouteHintsZ, mut keys_manager: crate::lightning::chain::keysinterface::KeysInterface, mut network: crate::lightning_invoice::Currency) -> crate::c_types::derived::CResult_InvoiceSignOrCreationErrorZ {
+pub extern "C" fn create_phantom_invoice(mut amt_msat: crate::c_types::derived::COption_u64Z, mut payment_hash: crate::c_types::ThirtyTwoBytes, mut description: crate::c_types::Str, mut invoice_expiry_delta_secs: u32, mut phantom_route_hints: crate::c_types::derived::CVec_PhantomRouteHintsZ, mut keys_manager: crate::lightning::chain::keysinterface::KeysInterface, mut network: crate::lightning_invoice::Currency) -> crate::c_types::derived::CResult_InvoiceSignOrCreationErrorZ {
let mut local_amt_msat = if amt_msat.is_some() { Some( { amt_msat.take() }) } else { None };
+ let mut local_payment_hash = if payment_hash.data == [0; 32] { None } else { Some( { ::lightning::ln::PaymentHash(payment_hash.data) }) };
let mut local_phantom_route_hints = Vec::new(); for mut item in phantom_route_hints.into_rust().drain(..) { local_phantom_route_hints.push( { *unsafe { Box::from_raw(item.take_inner()) } }); };
- let mut ret = lightning_invoice::utils::create_phantom_invoice::<crate::lightning::chain::keysinterface::Sign, crate::lightning::chain::keysinterface::KeysInterface>(local_amt_msat, description.into_string(), ::lightning::ln::PaymentHash(payment_hash.data), ::lightning::ln::PaymentSecret(payment_secret.data), local_phantom_route_hints, keys_manager, network.into_native());
+ let mut ret = lightning_invoice::utils::create_phantom_invoice::<crate::lightning::chain::keysinterface::Sign, crate::lightning::chain::keysinterface::KeysInterface>(local_amt_msat, local_payment_hash, description.into_string(), invoice_expiry_delta_secs, local_phantom_route_hints, keys_manager, network.into_native());
let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning_invoice::Invoice { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning_invoice::SignOrCreationError::native_into(e) }).into() };
local_ret
}
///
/// `description_hash` is a SHA-256 hash of the description text
///
-/// `payment_hash` and `payment_secret` come from [`ChannelManager::create_inbound_payment`] or
-/// [`ChannelManager::create_inbound_payment_for_hash`]. These values can be retrieved from any
-/// participating node.
+/// `payment_hash` can be specified if you have a specific need for a custom payment hash (see the difference
+/// between [`ChannelManager::create_inbound_payment`] and [`ChannelManager::create_inbound_payment_for_hash`]).
+/// If `None` is provided for `payment_hash`, then one will be created.
+///
+/// `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
+/// in excess of the current time.
///
/// Note that the provided `keys_manager`'s `KeysInterface` implementation must support phantom
/// invoices in its `sign_invoice` implementation ([`PhantomKeysManager`] satisfies this
///
/// [`PhantomKeysManager`]: lightning::chain::keysinterface::PhantomKeysManager
/// [`ChannelManager::get_phantom_route_hints`]: lightning::ln::channelmanager::ChannelManager::get_phantom_route_hints
+/// [`ChannelManager::create_inbound_payment`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment
+/// [`ChannelManager::create_inbound_payment_for_hash`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
/// [`PhantomRouteHints::channels`]: lightning::ln::channelmanager::PhantomRouteHints::channels
+///
+/// Note that payment_hash (or a relevant inner pointer) may be NULL or all-0s to represent None
#[no_mangle]
-pub extern "C" fn create_phantom_invoice_with_description_hash(mut amt_msat: crate::c_types::derived::COption_u64Z, mut description_hash: crate::lightning_invoice::Sha256, mut payment_hash: crate::c_types::ThirtyTwoBytes, mut payment_secret: crate::c_types::ThirtyTwoBytes, mut phantom_route_hints: crate::c_types::derived::CVec_PhantomRouteHintsZ, mut keys_manager: crate::lightning::chain::keysinterface::KeysInterface, mut network: crate::lightning_invoice::Currency) -> crate::c_types::derived::CResult_InvoiceSignOrCreationErrorZ {
+pub extern "C" fn create_phantom_invoice_with_description_hash(mut amt_msat: crate::c_types::derived::COption_u64Z, mut payment_hash: crate::c_types::ThirtyTwoBytes, mut invoice_expiry_delta_secs: u32, mut description_hash: crate::lightning_invoice::Sha256, mut phantom_route_hints: crate::c_types::derived::CVec_PhantomRouteHintsZ, mut keys_manager: crate::lightning::chain::keysinterface::KeysInterface, mut network: crate::lightning_invoice::Currency) -> crate::c_types::derived::CResult_InvoiceSignOrCreationErrorZ {
let mut local_amt_msat = if amt_msat.is_some() { Some( { amt_msat.take() }) } else { None };
+ let mut local_payment_hash = if payment_hash.data == [0; 32] { None } else { Some( { ::lightning::ln::PaymentHash(payment_hash.data) }) };
let mut local_phantom_route_hints = Vec::new(); for mut item in phantom_route_hints.into_rust().drain(..) { local_phantom_route_hints.push( { *unsafe { Box::from_raw(item.take_inner()) } }); };
- let mut ret = lightning_invoice::utils::create_phantom_invoice_with_description_hash::<crate::lightning::chain::keysinterface::Sign, crate::lightning::chain::keysinterface::KeysInterface>(local_amt_msat, *unsafe { Box::from_raw(description_hash.take_inner()) }, ::lightning::ln::PaymentHash(payment_hash.data), ::lightning::ln::PaymentSecret(payment_secret.data), local_phantom_route_hints, keys_manager, network.into_native());
+ let mut ret = lightning_invoice::utils::create_phantom_invoice_with_description_hash::<crate::lightning::chain::keysinterface::Sign, crate::lightning::chain::keysinterface::KeysInterface>(local_amt_msat, local_payment_hash, invoice_expiry_delta_secs, *unsafe { Box::from_raw(description_hash.take_inner()) }, local_phantom_route_hints, keys_manager, network.into_native());
let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning_invoice::Invoice { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning_invoice::SignOrCreationError::native_into(e) }).into() };
local_ret
}
/// method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user
/// doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify
/// that the payment secret is valid when the invoice is paid.
+///
+/// `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
+/// in excess of the current time.
#[no_mangle]
-pub extern "C" fn create_invoice_from_channelmanager(channelmanager: &crate::lightning::ln::channelmanager::ChannelManager, mut keys_manager: crate::lightning::chain::keysinterface::KeysInterface, mut network: crate::lightning_invoice::Currency, mut amt_msat: crate::c_types::derived::COption_u64Z, mut description: crate::c_types::Str) -> crate::c_types::derived::CResult_InvoiceSignOrCreationErrorZ {
+pub extern "C" fn create_invoice_from_channelmanager(channelmanager: &crate::lightning::ln::channelmanager::ChannelManager, mut keys_manager: crate::lightning::chain::keysinterface::KeysInterface, mut network: crate::lightning_invoice::Currency, mut amt_msat: crate::c_types::derived::COption_u64Z, mut description: crate::c_types::Str, mut invoice_expiry_delta_secs: u32) -> crate::c_types::derived::CResult_InvoiceSignOrCreationErrorZ {
let mut local_amt_msat = if amt_msat.is_some() { Some( { amt_msat.take() }) } else { None };
- let mut ret = lightning_invoice::utils::create_invoice_from_channelmanager::<crate::lightning::chain::keysinterface::Sign, crate::lightning::chain::Watch, crate::lightning::chain::chaininterface::BroadcasterInterface, crate::lightning::chain::keysinterface::KeysInterface, crate::lightning::chain::chaininterface::FeeEstimator, crate::lightning::util::logger::Logger>(channelmanager.get_native_ref(), keys_manager, network.into_native(), local_amt_msat, description.into_string());
+ let mut ret = lightning_invoice::utils::create_invoice_from_channelmanager::<crate::lightning::chain::keysinterface::Sign, crate::lightning::chain::Watch, crate::lightning::chain::chaininterface::BroadcasterInterface, crate::lightning::chain::keysinterface::KeysInterface, crate::lightning::chain::chaininterface::FeeEstimator, crate::lightning::util::logger::Logger>(channelmanager.get_native_ref(), keys_manager, network.into_native(), local_amt_msat, description.into_string(), invoice_expiry_delta_secs);
let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning_invoice::Invoice { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning_invoice::SignOrCreationError::native_into(e) }).into() };
local_ret
}
/// doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify
/// that the payment secret is valid when the invoice is paid.
/// Use this variant if you want to pass the `description_hash` to the invoice.
+///
+/// `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
+/// in excess of the current time.
#[no_mangle]
-pub extern "C" fn create_invoice_from_channelmanager_with_description_hash(channelmanager: &crate::lightning::ln::channelmanager::ChannelManager, mut keys_manager: crate::lightning::chain::keysinterface::KeysInterface, mut network: crate::lightning_invoice::Currency, mut amt_msat: crate::c_types::derived::COption_u64Z, mut description_hash: crate::lightning_invoice::Sha256) -> crate::c_types::derived::CResult_InvoiceSignOrCreationErrorZ {
+pub extern "C" fn create_invoice_from_channelmanager_with_description_hash(channelmanager: &crate::lightning::ln::channelmanager::ChannelManager, mut keys_manager: crate::lightning::chain::keysinterface::KeysInterface, mut network: crate::lightning_invoice::Currency, mut amt_msat: crate::c_types::derived::COption_u64Z, mut description_hash: crate::lightning_invoice::Sha256, mut invoice_expiry_delta_secs: u32) -> crate::c_types::derived::CResult_InvoiceSignOrCreationErrorZ {
let mut local_amt_msat = if amt_msat.is_some() { Some( { amt_msat.take() }) } else { None };
- let mut ret = lightning_invoice::utils::create_invoice_from_channelmanager_with_description_hash::<crate::lightning::chain::keysinterface::Sign, crate::lightning::chain::Watch, crate::lightning::chain::chaininterface::BroadcasterInterface, crate::lightning::chain::keysinterface::KeysInterface, crate::lightning::chain::chaininterface::FeeEstimator, crate::lightning::util::logger::Logger>(channelmanager.get_native_ref(), keys_manager, network.into_native(), local_amt_msat, *unsafe { Box::from_raw(description_hash.take_inner()) });
+ let mut ret = lightning_invoice::utils::create_invoice_from_channelmanager_with_description_hash::<crate::lightning::chain::keysinterface::Sign, crate::lightning::chain::Watch, crate::lightning::chain::chaininterface::BroadcasterInterface, crate::lightning::chain::keysinterface::KeysInterface, crate::lightning::chain::chaininterface::FeeEstimator, crate::lightning::util::logger::Logger>(channelmanager.get_native_ref(), keys_manager, network.into_native(), local_amt_msat, *unsafe { Box::from_raw(description_hash.take_inner()) }, invoice_expiry_delta_secs);
let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning_invoice::Invoice { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning_invoice::SignOrCreationError::native_into(e) }).into() };
local_ret
}
/// This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not
/// available and the current time is supplied by the caller.
#[no_mangle]
-pub extern "C" fn create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(channelmanager: &crate::lightning::ln::channelmanager::ChannelManager, mut keys_manager: crate::lightning::chain::keysinterface::KeysInterface, mut network: crate::lightning_invoice::Currency, mut amt_msat: crate::c_types::derived::COption_u64Z, mut description_hash: crate::lightning_invoice::Sha256, mut duration_since_epoch: u64) -> crate::c_types::derived::CResult_InvoiceSignOrCreationErrorZ {
+pub extern "C" fn create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(channelmanager: &crate::lightning::ln::channelmanager::ChannelManager, mut keys_manager: crate::lightning::chain::keysinterface::KeysInterface, mut network: crate::lightning_invoice::Currency, mut amt_msat: crate::c_types::derived::COption_u64Z, mut description_hash: crate::lightning_invoice::Sha256, mut duration_since_epoch: u64, mut invoice_expiry_delta_secs: u32) -> crate::c_types::derived::CResult_InvoiceSignOrCreationErrorZ {
let mut local_amt_msat = if amt_msat.is_some() { Some( { amt_msat.take() }) } else { None };
- let mut ret = lightning_invoice::utils::create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch::<crate::lightning::chain::keysinterface::Sign, crate::lightning::chain::Watch, crate::lightning::chain::chaininterface::BroadcasterInterface, crate::lightning::chain::keysinterface::KeysInterface, crate::lightning::chain::chaininterface::FeeEstimator, crate::lightning::util::logger::Logger>(channelmanager.get_native_ref(), keys_manager, network.into_native(), local_amt_msat, *unsafe { Box::from_raw(description_hash.take_inner()) }, core::time::Duration::from_secs(duration_since_epoch));
+ let mut ret = lightning_invoice::utils::create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch::<crate::lightning::chain::keysinterface::Sign, crate::lightning::chain::Watch, crate::lightning::chain::chaininterface::BroadcasterInterface, crate::lightning::chain::keysinterface::KeysInterface, crate::lightning::chain::chaininterface::FeeEstimator, crate::lightning::util::logger::Logger>(channelmanager.get_native_ref(), keys_manager, network.into_native(), local_amt_msat, *unsafe { Box::from_raw(description_hash.take_inner()) }, core::time::Duration::from_secs(duration_since_epoch), invoice_expiry_delta_secs);
let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning_invoice::Invoice { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning_invoice::SignOrCreationError::native_into(e) }).into() };
local_ret
}
/// This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not
/// available and the current time is supplied by the caller.
#[no_mangle]
-pub extern "C" fn create_invoice_from_channelmanager_and_duration_since_epoch(channelmanager: &crate::lightning::ln::channelmanager::ChannelManager, mut keys_manager: crate::lightning::chain::keysinterface::KeysInterface, mut network: crate::lightning_invoice::Currency, mut amt_msat: crate::c_types::derived::COption_u64Z, mut description: crate::c_types::Str, mut duration_since_epoch: u64) -> crate::c_types::derived::CResult_InvoiceSignOrCreationErrorZ {
+pub extern "C" fn create_invoice_from_channelmanager_and_duration_since_epoch(channelmanager: &crate::lightning::ln::channelmanager::ChannelManager, mut keys_manager: crate::lightning::chain::keysinterface::KeysInterface, mut network: crate::lightning_invoice::Currency, mut amt_msat: crate::c_types::derived::COption_u64Z, mut description: crate::c_types::Str, mut duration_since_epoch: u64, mut invoice_expiry_delta_secs: u32) -> crate::c_types::derived::CResult_InvoiceSignOrCreationErrorZ {
let mut local_amt_msat = if amt_msat.is_some() { Some( { amt_msat.take() }) } else { None };
- let mut ret = lightning_invoice::utils::create_invoice_from_channelmanager_and_duration_since_epoch::<crate::lightning::chain::keysinterface::Sign, crate::lightning::chain::Watch, crate::lightning::chain::chaininterface::BroadcasterInterface, crate::lightning::chain::keysinterface::KeysInterface, crate::lightning::chain::chaininterface::FeeEstimator, crate::lightning::util::logger::Logger>(channelmanager.get_native_ref(), keys_manager, network.into_native(), local_amt_msat, description.into_string(), core::time::Duration::from_secs(duration_since_epoch));
+ let mut ret = lightning_invoice::utils::create_invoice_from_channelmanager_and_duration_since_epoch::<crate::lightning::chain::keysinterface::Sign, crate::lightning::chain::Watch, crate::lightning::chain::chaininterface::BroadcasterInterface, crate::lightning::chain::keysinterface::KeysInterface, crate::lightning::chain::chaininterface::FeeEstimator, crate::lightning::util::logger::Logger>(channelmanager.get_native_ref(), keys_manager, network.into_native(), local_amt_msat, description.into_string(), core::time::Duration::from_secs(duration_since_epoch), invoice_expiry_delta_secs);
let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning_invoice::Invoice { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning_invoice::SignOrCreationError::native_into(e) }).into() };
local_ret
}
use lightning_invoice::utils::DefaultRouter as nativeDefaultRouterImport;
-pub(crate) type nativeDefaultRouter = nativeDefaultRouterImport<&'static lightning::routing::network_graph::NetworkGraph, crate::lightning::util::logger::Logger>;
+pub(crate) type nativeDefaultRouter = nativeDefaultRouterImport<&'static lightning::routing::gossip::NetworkGraph<crate::lightning::util::logger::Logger>, crate::lightning::util::logger::Logger>;
/// A [`Router`] implemented using [`find_route`].
#[must_use]
/// `random_seed_bytes`.
#[must_use]
#[no_mangle]
-pub extern "C" fn DefaultRouter_new(network_graph: &crate::lightning::routing::network_graph::NetworkGraph, mut logger: crate::lightning::util::logger::Logger, mut random_seed_bytes: crate::c_types::ThirtyTwoBytes) -> crate::lightning_invoice::utils::DefaultRouter {
+pub extern "C" fn DefaultRouter_new(network_graph: &crate::lightning::routing::gossip::NetworkGraph, mut logger: crate::lightning::util::logger::Logger, mut random_seed_bytes: crate::c_types::ThirtyTwoBytes) -> crate::lightning_invoice::utils::DefaultRouter {
let mut ret = lightning_invoice::utils::DefaultRouter::new(network_graph.get_native_ref(), logger, random_seed_bytes.data);
crate::lightning_invoice::utils::DefaultRouter { inner: ObjOps::heap_alloc(ret), is_owned: true }
}
ret.into()
}
-/// Writes the provided `ChannelManager` to the path provided at `FilesystemPersister`
-/// initialization, within a file called \"manager\".
-#[must_use]
-#[no_mangle]
-pub extern "C" fn FilesystemPersister_persist_manager(mut data_dir: crate::c_types::Str, manager: &crate::lightning::ln::channelmanager::ChannelManager) -> crate::c_types::derived::CResult_NoneErrorZ {
- let mut ret = lightning_persister::FilesystemPersister::persist_manager(data_dir.into_string(), manager.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::c_types::IOError::from_rust(e) }).into() };
- local_ret
-}
-
-/// Write the provided `NetworkGraph` to the path provided at `FilesystemPersister`
-/// initialization, within a file called \"network_graph\"
-#[must_use]
-#[no_mangle]
-pub extern "C" fn FilesystemPersister_persist_network_graph(mut data_dir: crate::c_types::Str, network_graph: &crate::lightning::routing::network_graph::NetworkGraph) -> crate::c_types::derived::CResult_NoneErrorZ {
- let mut ret = lightning_persister::FilesystemPersister::persist_network_graph(data_dir.into_string(), network_graph.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::c_types::IOError::from_rust(e) }).into() };
- local_ret
-}
-
/// Read `ChannelMonitor`s from disk.
#[must_use]
#[no_mangle]
local_ret
}
-impl From<nativeFilesystemPersister> for crate::lightning::chain::chainmonitor::Persist {
- fn from(obj: nativeFilesystemPersister) -> Self {
- let mut rust_obj = FilesystemPersister { inner: ObjOps::heap_alloc(obj), is_owned: true };
- let mut ret = FilesystemPersister_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();
- ret.free = Some(FilesystemPersister_free_void);
- ret
- }
-}
-/// Constructs a new Persist which calls the relevant methods on this_arg.
-/// This copies the `inner` pointer in this_arg and thus the returned Persist must be freed before this_arg is
-#[no_mangle]
-pub extern "C" fn FilesystemPersister_as_Persist(this_arg: &FilesystemPersister) -> crate::lightning::chain::chainmonitor::Persist {
- crate::lightning::chain::chainmonitor::Persist {
- this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void },
- free: None,
- persist_new_channel: FilesystemPersister_Persist_persist_new_channel,
- update_persisted_channel: FilesystemPersister_Persist_update_persisted_channel,
- }
-}
-
-#[must_use]
-extern "C" fn FilesystemPersister_Persist_persist_new_channel(this_arg: *const c_void, mut funding_txo: crate::lightning::chain::transaction::OutPoint, monitor: &crate::lightning::chain::channelmonitor::ChannelMonitor, mut _update_id: crate::lightning::chain::chainmonitor::MonitorUpdateId) -> crate::c_types::derived::CResult_NoneChannelMonitorUpdateErrZ {
- let mut ret = <nativeFilesystemPersister as lightning::chain::chainmonitor::Persist<_>>::persist_new_channel(unsafe { &mut *(this_arg as *mut nativeFilesystemPersister) }, *unsafe { Box::from_raw(funding_txo.take_inner()) }, monitor.get_native_ref(), *unsafe { Box::from_raw(_update_id.take_inner()) });
- let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::chain::ChannelMonitorUpdateErr::native_into(e) }).into() };
- local_ret
-}
-#[must_use]
-extern "C" fn FilesystemPersister_Persist_update_persisted_channel(this_arg: *const c_void, mut funding_txo: crate::lightning::chain::transaction::OutPoint, _update: &crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, monitor: &crate::lightning::chain::channelmonitor::ChannelMonitor, mut _update_id: crate::lightning::chain::chainmonitor::MonitorUpdateId) -> crate::c_types::derived::CResult_NoneChannelMonitorUpdateErrZ {
- let mut local__update = if _update.inner.is_null() { None } else { Some((* { _update.get_native_ref() }).clone()) };
- let mut ret = <nativeFilesystemPersister as lightning::chain::chainmonitor::Persist<_>>::update_persisted_channel(unsafe { &mut *(this_arg as *mut nativeFilesystemPersister) }, *unsafe { Box::from_raw(funding_txo.take_inner()) }, &local__update, monitor.get_native_ref(), *unsafe { Box::from_raw(_update_id.take_inner()) });
- let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::chain::ChannelMonitorUpdateErr::native_into(e) }).into() };
- local_ret
-}
-
--- /dev/null
+// This file is Copyright its original authors, visible in version control
+// history and in the source files from which this was generated.
+//
+// This file is licensed under the license available in the LICENSE or LICENSE.md
+// file in the root of this repository or, if no such file exists, the same
+// license as that which applies to the original source files from which this
+// source was automatically generated.
+
+/// Error types that these functions can return
+
+use alloc::str::FromStr;
+use core::ffi::c_void;
+use core::convert::Infallible;
+use bitcoin::hashes::Hash;
+use crate::c_types::*;
+#[cfg(feature="no-std")]
+use alloc::{vec::Vec, boxed::Box};
+
+/// All-encompassing standard error type that processing can return
+#[derive(Clone)]
+#[must_use]
+#[repr(C)]
+pub enum GraphSyncError {
+ /// Error trying to read the update data, typically due to an erroneous data length indication
+ /// that is greater than the actual amount of data provided
+ DecodeError(
+ crate::lightning::ln::msgs::DecodeError),
+ /// Error applying the patch to the network graph, usually the result of updates that are too
+ /// old or missing prerequisite data to the application of updates out of order
+ LightningError(
+ crate::lightning::ln::msgs::LightningError),
+}
+use lightning_rapid_gossip_sync::error::GraphSyncError as GraphSyncErrorImport;
+pub(crate) type nativeGraphSyncError = GraphSyncErrorImport;
+
+impl GraphSyncError {
+ #[allow(unused)]
+ pub(crate) fn to_native(&self) -> nativeGraphSyncError {
+ match self {
+ GraphSyncError::DecodeError (ref a, ) => {
+ let mut a_nonref = (*a).clone();
+ nativeGraphSyncError::DecodeError (
+ *unsafe { Box::from_raw(a_nonref.take_inner()) },
+ )
+ },
+ GraphSyncError::LightningError (ref a, ) => {
+ let mut a_nonref = (*a).clone();
+ nativeGraphSyncError::LightningError (
+ *unsafe { Box::from_raw(a_nonref.take_inner()) },
+ )
+ },
+ }
+ }
+ #[allow(unused)]
+ pub(crate) fn into_native(self) -> nativeGraphSyncError {
+ match self {
+ GraphSyncError::DecodeError (mut a, ) => {
+ nativeGraphSyncError::DecodeError (
+ *unsafe { Box::from_raw(a.take_inner()) },
+ )
+ },
+ GraphSyncError::LightningError (mut a, ) => {
+ nativeGraphSyncError::LightningError (
+ *unsafe { Box::from_raw(a.take_inner()) },
+ )
+ },
+ }
+ }
+ #[allow(unused)]
+ pub(crate) fn from_native(native: &nativeGraphSyncError) -> Self {
+ match native {
+ nativeGraphSyncError::DecodeError (ref a, ) => {
+ let mut a_nonref = (*a).clone();
+ GraphSyncError::DecodeError (
+ crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(a_nonref), is_owned: true },
+ )
+ },
+ nativeGraphSyncError::LightningError (ref a, ) => {
+ let mut a_nonref = (*a).clone();
+ GraphSyncError::LightningError (
+ crate::lightning::ln::msgs::LightningError { inner: ObjOps::heap_alloc(a_nonref), is_owned: true },
+ )
+ },
+ }
+ }
+ #[allow(unused)]
+ pub(crate) fn native_into(native: nativeGraphSyncError) -> Self {
+ match native {
+ nativeGraphSyncError::DecodeError (mut a, ) => {
+ GraphSyncError::DecodeError (
+ crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(a), is_owned: true },
+ )
+ },
+ nativeGraphSyncError::LightningError (mut a, ) => {
+ GraphSyncError::LightningError (
+ crate::lightning::ln::msgs::LightningError { inner: ObjOps::heap_alloc(a), is_owned: true },
+ )
+ },
+ }
+ }
+}
+/// Frees any resources used by the GraphSyncError
+#[no_mangle]
+pub extern "C" fn GraphSyncError_free(this_ptr: GraphSyncError) { }
+/// Creates a copy of the GraphSyncError
+#[no_mangle]
+pub extern "C" fn GraphSyncError_clone(orig: &GraphSyncError) -> GraphSyncError {
+ orig.clone()
+}
+#[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 {
+ GraphSyncError::DecodeError(a, )
+}
+#[no_mangle]
+/// Utility method to constructs a new LightningError-variant GraphSyncError
+pub extern "C" fn GraphSyncError_lightning_error(a: crate::lightning::ln::msgs::LightningError) -> GraphSyncError {
+ GraphSyncError::LightningError(a, )
+}
--- /dev/null
+// This file is Copyright its original authors, visible in version control
+// history and in the source files from which this was generated.
+//
+// This file is licensed under the license available in the LICENSE or LICENSE.md
+// file in the root of this repository or, if no such file exists, the same
+// license as that which applies to the original source files from which this
+// source was automatically generated.
+
+//! This crate exposes functionality to rapidly sync gossip data, aimed primarily at mobile
+//! devices.
+//!
+//! The server sends a compressed response containing differential gossip data. The gossip data is
+//! formatted compactly, omitting signatures and opportunistically incremental where previous
+//! channel updates are known (a mechanism that is enabled when the timestamp of the last known
+//! channel update is communicated). A reference server implementation can be found
+//! [here](https://github.com/lightningdevkit/rapid-gossip-sync-server).
+//!
+//! An example server request could look as simple as the following. Note that the first ever rapid
+//! sync should use `0` for `last_sync_timestamp`:
+//!
+//! ```shell
+//! curl -o rapid_sync.lngossip https://rapidsync.lightningdevkit.org/snapshot/<last_sync_timestamp>
+//! ```
+//!
+//! Then, call the network processing function. In this example, we process the update by reading
+//! its contents from disk, which we do by calling the `sync_network_graph_with_file_path` method:
+//!
+//! ```
+//! use bitcoin::blockdata::constants::genesis_block;
+//! use bitcoin::Network;
+//! use lightning::routing::gossip::NetworkGraph;
+//! use lightning_rapid_gossip_sync::RapidGossipSync;
+//!
+//! # use lightning::util::logger::{Logger, Record};
+//! # struct FakeLogger {}
+//! # impl Logger for FakeLogger {
+//! # fn log(&self, record: &Record) { unimplemented!() }
+//! # }
+//! # let logger = FakeLogger {};
+//!
+//! let block_hash = genesis_block(Network::Bitcoin).header.block_hash();
+//! let network_graph = NetworkGraph::new(block_hash, &logger);
+//! let rapid_sync = RapidGossipSync::new(&network_graph);
+//! let new_last_sync_timestamp_result = rapid_sync.sync_network_graph_with_file_path(\"./rapid_sync.lngossip\");
+//! ```
+//!
+//! The primary benefit this syncing mechanism provides is that given a trusted server, a
+//! low-powered client can offload the validation of gossip signatures. This enables a client to
+//! privately calculate routes for payments, and do so much faster and earlier than requiring a full
+//! peer-to-peer gossip sync to complete.
+//!
+//! The reason the rapid sync server requires trust is that it could provide bogus data, though at
+//! worst, all that would result in is a fake network topology, which wouldn't enable the server to
+//! steal or siphon off funds. It could, however, reduce the client's privacy by forcing all
+//! payments to be routed via channels the server controls.
+//!
+//! The way a server is meant to calculate this rapid gossip sync data is by using a `latest_seen`
+//! timestamp provided by the client. It's not included in either channel announcement or update,
+//! (not least due to announcements not including any timestamps at all, but only a block height)
+//! but rather, it's a timestamp of when the server saw a particular message.
+
+use alloc::str::FromStr;
+use core::ffi::c_void;
+use core::convert::Infallible;
+use bitcoin::hashes::Hash;
+use crate::c_types::*;
+#[cfg(feature="no-std")]
+use alloc::{vec::Vec, boxed::Box};
+
+pub mod error;
+pub mod processing;
+
+use lightning_rapid_gossip_sync::RapidGossipSync as nativeRapidGossipSyncImport;
+pub(crate) type nativeRapidGossipSync = nativeRapidGossipSyncImport<&'static lightning::routing::gossip::NetworkGraph<crate::lightning::util::logger::Logger>, crate::lightning::util::logger::Logger>;
+
+/// Rapid Gossip Sync struct
+/// See [crate-level documentation] for usage.
+///
+/// [crate-level documentation]: crate
+#[must_use]
+#[repr(C)]
+pub struct RapidGossipSync {
+ /// 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 nativeRapidGossipSync,
+ /// 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 RapidGossipSync {
+ fn drop(&mut self) {
+ if self.is_owned && !<*mut nativeRapidGossipSync>::is_null(self.inner) {
+ let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+ }
+ }
+}
+/// Frees any resources used by the RapidGossipSync, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn RapidGossipSync_free(this_obj: RapidGossipSync) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn RapidGossipSync_free_void(this_ptr: *mut c_void) {
+ unsafe { let _ = Box::from_raw(this_ptr as *mut nativeRapidGossipSync); }
+}
+#[allow(unused)]
+impl RapidGossipSync {
+ pub(crate) fn get_native_ref(&self) -> &'static nativeRapidGossipSync {
+ unsafe { &*ObjOps::untweak_ptr(self.inner) }
+ }
+ pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeRapidGossipSync {
+ 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 nativeRapidGossipSync {
+ assert!(self.is_owned);
+ let ret = ObjOps::untweak_ptr(self.inner);
+ self.inner = core::ptr::null_mut();
+ ret
+ }
+}
+/// Instantiate a new [`RapidGossipSync`] instance
+#[must_use]
+#[no_mangle]
+pub extern "C" fn RapidGossipSync_new(network_graph: &crate::lightning::routing::gossip::NetworkGraph) -> crate::lightning_rapid_gossip_sync::RapidGossipSync {
+ let mut ret = lightning_rapid_gossip_sync::RapidGossipSync::new(network_graph.get_native_ref());
+ crate::lightning_rapid_gossip_sync::RapidGossipSync { inner: ObjOps::heap_alloc(ret), is_owned: true }
+}
+
+/// Sync gossip data from a file
+/// Returns the last sync timestamp to be used the next time rapid sync data is queried.
+///
+/// `network_graph`: The network graph to apply the updates to
+///
+/// `sync_path`: Path to the file where the gossip update data is located
+///
+#[must_use]
+#[no_mangle]
+pub extern "C" fn RapidGossipSync_sync_network_graph_with_file_path(this_arg: &crate::lightning_rapid_gossip_sync::RapidGossipSync, mut sync_path: crate::c_types::Str) -> crate::c_types::derived::CResult_u32GraphSyncErrorZ {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.sync_network_graph_with_file_path(sync_path.into_str());
+ 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_rapid_gossip_sync::error::GraphSyncError::native_into(e) }).into() };
+ local_ret
+}
+
+/// Returns whether a rapid gossip sync has completed at least once
+#[must_use]
+#[no_mangle]
+pub extern "C" fn RapidGossipSync_is_initial_sync_complete(this_arg: &crate::lightning_rapid_gossip_sync::RapidGossipSync) -> bool {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.is_initial_sync_complete();
+ ret
+}
+
--- /dev/null
+// This file is Copyright its original authors, visible in version control
+// history and in the source files from which this was generated.
+//
+// This file is licensed under the license available in the LICENSE or LICENSE.md
+// file in the root of this repository or, if no such file exists, the same
+// license as that which applies to the original source files from which this
+// source was automatically generated.
+
+/// Core functionality of this crate
+
+use alloc::str::FromStr;
+use core::ffi::c_void;
+use core::convert::Infallible;
+use bitcoin::hashes::Hash;
+use crate::c_types::*;
+#[cfg(feature="no-std")]
+use alloc::{vec::Vec, boxed::Box};
+
+/// Update network graph from binary data.
+/// Returns the last sync timestamp to be used the next time rapid sync data is queried.
+///
+/// `network_graph`: network graph to be updated
+///
+/// `update_data`: `&[u8]` binary stream that comprises the update data
+#[must_use]
+#[no_mangle]
+pub extern "C" fn RapidGossipSync_update_network_graph(this_arg: &crate::lightning_rapid_gossip_sync::RapidGossipSync, mut update_data: crate::c_types::u8slice) -> crate::c_types::derived::CResult_u32GraphSyncErrorZ {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.update_network_graph(update_data.to_slice());
+ 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_rapid_gossip_sync::error::GraphSyncError::native_into(e) }).into() };
+ local_ret
+}
+