Update auto-generated bindings
authorMatt Corallo <git@bluematt.me>
Fri, 13 Nov 2020 01:23:17 +0000 (20:23 -0500)
committerMatt Corallo <git@bluematt.me>
Mon, 23 Nov 2020 16:12:49 +0000 (11:12 -0500)
20 files changed:
lightning-c-bindings/include/lightning.h
lightning-c-bindings/include/lightningpp.hpp
lightning-c-bindings/include/rust_types.h
lightning-c-bindings/src/c_types/derived.rs
lightning-c-bindings/src/chain/chaininterface.rs
lightning-c-bindings/src/chain/chainmonitor.rs
lightning-c-bindings/src/chain/channelmonitor.rs
lightning-c-bindings/src/chain/keysinterface.rs
lightning-c-bindings/src/chain/mod.rs
lightning-c-bindings/src/chain/transaction.rs
lightning-c-bindings/src/ln/chan_utils.rs
lightning-c-bindings/src/ln/channelmanager.rs
lightning-c-bindings/src/ln/msgs.rs
lightning-c-bindings/src/ln/peer_handler.rs
lightning-c-bindings/src/routing/network_graph.rs
lightning-c-bindings/src/routing/router.rs
lightning-c-bindings/src/util/config.rs
lightning-c-bindings/src/util/errors.rs
lightning-c-bindings/src/util/events.rs
lightning-c-bindings/src/util/logger.rs

index cd246f92eafc6881e2c7c966a07d4d318c454092..45e4fa3ab6b72a601f0313dd0a9ced1816b233a0 100644 (file)
@@ -198,7 +198,10 @@ typedef enum LDKSecp256k1Error {
  * `data_is_owned` either set or unset at your discretion.
  */
 typedef struct LDKTransaction {
-   const uint8_t *data;
+   /**
+    * This is non-const for your convenience, an object passed to Rust is never written to.
+    */
+   uint8_t *data;
    uintptr_t datalen;
    bool data_is_owned;
 } LDKTransaction;
@@ -245,7 +248,7 @@ typedef LDKCResultTempl_u8__ChannelMonitorUpdateErr LDKCResult_NoneChannelMonito
  * inconsistent with the ChannelMonitor being called. eg for ChannelMonitor::update_monitor this
  * means you tried to update a monitor for a different channel or the ChannelMonitorUpdate was
  * corrupted.
- * Contains a human-readable error message.
+ * Contains a developer-readable error message.
  */
 typedef struct MUST_USE_STRUCT LDKMonitorUpdateError {
    /**
@@ -292,6 +295,13 @@ typedef struct LDKC2TupleTempl_OutPoint__CVec_u8Z {
 
 typedef LDKC2TupleTempl_OutPoint__CVec_u8Z LDKC2Tuple_OutPointScriptZ;
 
+typedef struct LDKC2TupleTempl_u32__TxOut {
+   uint32_t a;
+   LDKTxOut b;
+} LDKC2TupleTempl_u32__TxOut;
+
+typedef LDKC2TupleTempl_u32__TxOut LDKC2Tuple_u32TxOutZ;
+
 /**
  * Arbitrary 32 bytes, which could represent one of a few different things. You probably want to
  * look up the corresponding function in rust-lightning's docs.
@@ -300,19 +310,19 @@ typedef struct LDKThirtyTwoBytes {
    uint8_t data[32];
 } LDKThirtyTwoBytes;
 
-typedef struct LDKCVecTempl_TxOut {
-   LDKTxOut *data;
+typedef struct LDKCVecTempl_C2TupleTempl_u32__TxOut {
+   LDKC2TupleTempl_u32__TxOut *data;
    uintptr_t datalen;
-} LDKCVecTempl_TxOut;
+} LDKCVecTempl_C2TupleTempl_u32__TxOut;
 
-typedef struct LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut {
+typedef struct LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_C2TupleTempl_u32__TxOut {
    LDKThirtyTwoBytes a;
-   LDKCVecTempl_TxOut b;
-} LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut;
+   LDKCVecTempl_C2TupleTempl_u32__TxOut b;
+} LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_C2TupleTempl_u32__TxOut;
 
-typedef LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut LDKC2Tuple_TxidCVec_TxOutZZ;
+typedef LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_C2TupleTempl_u32__TxOut LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ;
 
-typedef LDKCVecTempl_TxOut LDKCVec_TxOutZ;
+typedef LDKCVecTempl_C2TupleTempl_u32__TxOut LDKCVec_C2Tuple_u32TxOutZZ;
 
 typedef struct LDKC2TupleTempl_u64__u64 {
    uint64_t a;
@@ -1820,6 +1830,68 @@ typedef struct LDKFeeEstimator {
    void (*free)(void *this_arg);
 } LDKFeeEstimator;
 
+/**
+ * `Persist` defines behavior for persisting channel monitors: this could mean
+ * writing once to disk, and/or uploading to one or more backup services.
+ *
+ * Note that for every new monitor, you **must** persist the new `ChannelMonitor`
+ * to disk/backups. And, on every update, you **must** persist either the
+ * `ChannelMonitorUpdate` or the updated monitor itself. Otherwise, there is risk
+ * of situations such as revoking a transaction, then crashing before this
+ * revocation can be persisted, then unintentionally broadcasting a revoked
+ * transaction and losing money. This is a risk because previous channel states
+ * are toxic, so it's important that whatever channel state is persisted is
+ * kept up-to-date.
+ */
+typedef struct LDKPersist {
+   void *this_arg;
+   /**
+    * Persist a new channel's data. The data can be stored any way you want, but
+    * the identifier provided by Rust-Lightning is the channel's outpoint (and
+    * it is up to you to maintain a correct mapping between the outpoint and the
+    * stored channel data). Note that you **must** persist every new monitor to
+    * disk. See the `Persist` trait documentation for more details.
+    *
+    * See [`ChannelMonitor::serialize_for_disk`] for writing out a `ChannelMonitor`,
+    * and [`ChannelMonitorUpdateErr`] for requirements when returning errors.
+    *
+    * [`ChannelMonitor::serialize_for_disk`]: struct.ChannelMonitor.html#method.serialize_for_disk
+    * [`ChannelMonitorUpdateErr`]: enum.ChannelMonitorUpdateErr.html
+    */
+   LDKCResult_NoneChannelMonitorUpdateErrZ (*persist_new_channel)(const void *this_arg, LDKOutPoint id, const LDKChannelMonitor *data);
+   /**
+    * Update one channel's data. The provided `ChannelMonitor` has already
+    * applied the given update.
+    *
+    * Note that on every update, you **must** persist either the
+    * `ChannelMonitorUpdate` or the updated monitor itself to disk/backups. See
+    * the `Persist` trait documentation for more details.
+    *
+    * If an implementer chooses to persist the updates only, they need to make
+    * sure that all the updates are applied to the `ChannelMonitors` *before*
+    * the set of channel monitors is given to the `ChannelManager`
+    * deserialization routine. See [`ChannelMonitor::update_monitor`] for
+    * applying a monitor update to a monitor. If full `ChannelMonitors` are
+    * persisted, then there is no need to persist individual updates.
+    *
+    * Note that there could be a performance tradeoff between persisting complete
+    * channel monitors on every update vs. persisting only updates and applying
+    * them in batches. The size of each monitor grows `O(number of state updates)`
+    * whereas updates are small and `O(1)`.
+    *
+    * See [`ChannelMonitor::serialize_for_disk`] for writing out a `ChannelMonitor`,
+    * [`ChannelMonitorUpdate::write`] for writing out an update, and
+    * [`ChannelMonitorUpdateErr`] for requirements when returning errors.
+    *
+    * [`ChannelMonitor::update_monitor`]: struct.ChannelMonitor.html#impl-1
+    * [`ChannelMonitor::serialize_for_disk`]: struct.ChannelMonitor.html#method.serialize_for_disk
+    * [`ChannelMonitorUpdate::write`]: struct.ChannelMonitorUpdate.html#method.write
+    * [`ChannelMonitorUpdateErr`]: enum.ChannelMonitorUpdateErr.html
+    */
+   LDKCResult_NoneChannelMonitorUpdateErrZ (*update_persisted_channel)(const void *this_arg, LDKOutPoint id, const LDKChannelMonitorUpdate *update, const LDKChannelMonitor *data);
+   void (*free)(void *this_arg);
+} LDKPersist;
+
 
 
 /**
@@ -1875,12 +1947,12 @@ typedef struct LDKCVecTempl_Transaction {
 
 typedef LDKCVecTempl_Transaction LDKCVec_TransactionZ;
 
-typedef struct LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut {
-   LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut *data;
+typedef struct LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_C2TupleTempl_u32__TxOut {
+   LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_C2TupleTempl_u32__TxOut *data;
    uintptr_t datalen;
-} LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut;
+} LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_C2TupleTempl_u32__TxOut;
 
-typedef LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut LDKCVec_C2Tuple_TxidCVec_TxOutZZZ;
+typedef LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_C2TupleTempl_u32__TxOut LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ;
 
 typedef struct LDKSecretKey {
    uint8_t bytes[32];
@@ -2735,7 +2807,7 @@ typedef struct LDKSocketDescriptor {
     * socket_disconnected but prior to socket_disconnected returning.
     */
    void (*disconnect_socket)(void *this_arg);
-   bool (*eq)(const void *this_arg, const void *other_arg);
+   bool (*eq)(const void *this_arg, const LDKSocketDescriptor *other_arg);
    uint64_t (*hash)(const void *this_arg);
    void *(*clone)(const void *this_arg);
    void (*free)(void *this_arg);
@@ -3047,7 +3119,9 @@ extern const void (*C2Tuple_OutPointScriptZ_free)(LDKC2Tuple_OutPointScriptZ);
 
 extern const void (*C2Tuple_SignatureCVec_SignatureZZ_free)(LDKC2Tuple_SignatureCVec_SignatureZZ);
 
-extern const void (*C2Tuple_TxidCVec_TxOutZZ_free)(LDKC2Tuple_TxidCVec_TxOutZZ);
+extern const void (*C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free)(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ);
+
+extern const void (*C2Tuple_u32TxOutZ_free)(LDKC2Tuple_u32TxOutZ);
 
 extern const void (*C2Tuple_u64u64Z_free)(LDKC2Tuple_u64u64Z);
 
@@ -3055,6 +3129,8 @@ extern const void (*C2Tuple_usizeTransactionZ_free)(LDKC2Tuple_usizeTransactionZ
 
 extern const void (*C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free)(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ);
 
+extern const uint64_t CLOSED_CHANNEL_UPDATE_ID;
+
 extern const void (*CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free)(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ);
 
 extern const LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok)(LDKC2Tuple_SignatureCVec_SignatureZZ);
@@ -3137,7 +3213,9 @@ extern const LDKCResult_boolPeerHandleErrorZ (*CResult_boolPeerHandleErrorZ_ok)(
 
 extern const void (*CVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ_free)(LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ);
 
-extern const void (*CVec_C2Tuple_TxidCVec_TxOutZZZ_free)(LDKCVec_C2Tuple_TxidCVec_TxOutZZZ);
+extern const void (*CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free)(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ);
+
+extern const void (*CVec_C2Tuple_u32TxOutZZ_free)(LDKCVec_C2Tuple_u32TxOutZZ);
 
 extern const void (*CVec_C2Tuple_usizeTransactionZZ_free)(LDKCVec_C2Tuple_usizeTransactionZZ);
 
@@ -3173,8 +3251,6 @@ extern const void (*CVec_SpendableOutputDescriptorZ_free)(LDKCVec_SpendableOutpu
 
 extern const void (*CVec_TransactionZ_free)(LDKCVec_TransactionZ);
 
-extern const void (*CVec_TxOutZ_free)(LDKCVec_TxOutZ);
-
 extern const void (*CVec_UpdateAddHTLCZ_free)(LDKCVec_UpdateAddHTLCZ);
 
 extern const void (*CVec_UpdateFailHTLCZ_free)(LDKCVec_UpdateFailHTLCZ);
@@ -3201,7 +3277,9 @@ LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_ok(void);
 
 LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(LDKOutPoint a, LDKCVec_u8Z b);
 
-LDKC2Tuple_TxidCVec_TxOutZZ C2Tuple_TxidCVec_TxOutZZ_new(LDKThirtyTwoBytes a, LDKCVec_TxOutZ b);
+LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, LDKTxOut b);
+
+LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(LDKThirtyTwoBytes a, LDKCVec_C2Tuple_u32TxOutZZ b);
 
 LDKC2Tuple_u64u64Z C2Tuple_u64u64Z_new(uint64_t a, uint64_t b);
 
@@ -3225,8 +3303,12 @@ LDKC2Tuple_HTLCOutputInCommitmentSignatureZ C2Tuple_HTLCOutputInCommitmentSignat
 
 void Event_free(LDKEvent this_ptr);
 
+LDKEvent Event_clone(const LDKEvent *orig);
+
 void MessageSendEvent_free(LDKMessageSendEvent this_ptr);
 
+LDKMessageSendEvent MessageSendEvent_clone(const LDKMessageSendEvent *orig);
+
 /**
  * Calls the free function if one is set
  */
@@ -3239,6 +3321,10 @@ void EventsProvider_free(LDKEventsProvider this_ptr);
 
 void APIError_free(LDKAPIError this_ptr);
 
+LDKAPIError APIError_clone(const LDKAPIError *orig);
+
+LDKLevel Level_clone(const LDKLevel *orig);
+
 /**
  * Returns the most verbose logging level.
  */
@@ -3251,6 +3337,8 @@ void Logger_free(LDKLogger this_ptr);
 
 void ChannelHandshakeConfig_free(LDKChannelHandshakeConfig this_ptr);
 
+LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const LDKChannelHandshakeConfig *orig);
+
 /**
  * Confirmations we will wait for before considering the channel locked in.
  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
@@ -3329,6 +3417,8 @@ MUST_USE_RES LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void);
 
 void ChannelHandshakeLimits_free(LDKChannelHandshakeLimits this_ptr);
 
+LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const LDKChannelHandshakeLimits *orig);
+
 /**
  * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
  * only applies to inbound channels.
@@ -3521,6 +3611,8 @@ MUST_USE_RES LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void);
 
 void ChannelConfig_free(LDKChannelConfig this_ptr);
 
+LDKChannelConfig ChannelConfig_clone(const LDKChannelConfig *orig);
+
 /**
  * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
  * This may be allowed to change at runtime in a later update, however doing so must result in
@@ -3609,6 +3701,8 @@ LDKChannelConfig ChannelConfig_read(LDKu8slice ser);
 
 void UserConfig_free(LDKUserConfig this_ptr);
 
+LDKUserConfig UserConfig_clone(const LDKUserConfig *orig);
+
 /**
  * Channel config that we propose to our counterparty.
  */
@@ -3643,6 +3737,8 @@ MUST_USE_RES LDKUserConfig UserConfig_new(LDKChannelHandshakeConfig own_channel_
 
 MUST_USE_RES LDKUserConfig UserConfig_default(void);
 
+LDKAccessError AccessError_clone(const LDKAccessError *orig);
+
 /**
  * Calls the free function if one is set
  */
@@ -3663,6 +3759,8 @@ void Filter_free(LDKFilter this_ptr);
  */
 void BroadcasterInterface_free(LDKBroadcasterInterface this_ptr);
 
+LDKConfirmationTarget ConfirmationTarget_clone(const LDKConfirmationTarget *orig);
+
 /**
  * Calls the free function if one is set
  */
@@ -3707,7 +3805,7 @@ void ChainMonitor_block_disconnected(const LDKChainMonitor *this_arg, const uint
  *
  * [`chain::Filter`]: ../trait.Filter.html
  */
-MUST_USE_RES LDKChainMonitor ChainMonitor_new(LDKFilter *chain_source, LDKBroadcasterInterface broadcaster, LDKLogger logger, LDKFeeEstimator feeest);
+MUST_USE_RES LDKChainMonitor ChainMonitor_new(LDKFilter *chain_source, LDKBroadcasterInterface broadcaster, LDKLogger logger, LDKFeeEstimator feeest, LDKPersist persister);
 
 LDKWatch ChainMonitor_as_Watch(const LDKChainMonitor *this_arg);
 
@@ -3715,25 +3813,39 @@ LDKEventsProvider ChainMonitor_as_EventsProvider(const LDKChainMonitor *this_arg
 
 void ChannelMonitorUpdate_free(LDKChannelMonitorUpdate this_ptr);
 
+LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const LDKChannelMonitorUpdate *orig);
+
 /**
  * The sequence number of this update. Updates *must* be replayed in-order according to this
  * sequence number (and updates may panic if they are not). The update_id values are strictly
- * increasing and increase by one for each new update.
+ * increasing and increase by one for each new update, with one exception specified below.
  *
  * This sequence number is also used to track up to which points updates which returned
  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
+ *
+ * The only instance where update_id values are not strictly increasing is the case where we
+ * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
+ * its docs for more details.
+ *
+ * [`CLOSED_CHANNEL_UPDATE_ID`]: constant.CLOSED_CHANNEL_UPDATE_ID.html
  */
 uint64_t ChannelMonitorUpdate_get_update_id(const LDKChannelMonitorUpdate *this_ptr);
 
 /**
  * The sequence number of this update. Updates *must* be replayed in-order according to this
  * sequence number (and updates may panic if they are not). The update_id values are strictly
- * increasing and increase by one for each new update.
+ * increasing and increase by one for each new update, with one exception specified below.
  *
  * This sequence number is also used to track up to which points updates which returned
  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
+ *
+ * The only instance where update_id values are not strictly increasing is the case where we
+ * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
+ * its docs for more details.
+ *
+ * [`CLOSED_CHANNEL_UPDATE_ID`]: constant.CLOSED_CHANNEL_UPDATE_ID.html
  */
 void ChannelMonitorUpdate_set_update_id(LDKChannelMonitorUpdate *this_ptr, uint64_t val);
 
@@ -3741,12 +3853,18 @@ LDKCVec_u8Z ChannelMonitorUpdate_write(const LDKChannelMonitorUpdate *obj);
 
 LDKChannelMonitorUpdate ChannelMonitorUpdate_read(LDKu8slice ser);
 
+LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_clone(const LDKChannelMonitorUpdateErr *orig);
+
 void MonitorUpdateError_free(LDKMonitorUpdateError this_ptr);
 
 void MonitorEvent_free(LDKMonitorEvent this_ptr);
 
+LDKMonitorEvent MonitorEvent_clone(const LDKMonitorEvent *orig);
+
 void HTLCUpdate_free(LDKHTLCUpdate this_ptr);
 
+LDKHTLCUpdate HTLCUpdate_clone(const LDKHTLCUpdate *orig);
+
 LDKCVec_u8Z HTLCUpdate_write(const LDKHTLCUpdate *obj);
 
 LDKHTLCUpdate HTLCUpdate_read(LDKu8slice ser);
@@ -3759,7 +3877,7 @@ void ChannelMonitor_free(LDKChannelMonitor this_ptr);
  *
  * panics if the given update is not the next update by update_id.
  */
-MUST_USE_RES LDKCResult_NoneMonitorUpdateErrorZ ChannelMonitor_update_monitor(LDKChannelMonitor *this_arg, LDKChannelMonitorUpdate updates, const LDKBroadcasterInterface *broadcaster, const LDKLogger *logger);
+MUST_USE_RES LDKCResult_NoneMonitorUpdateErrorZ ChannelMonitor_update_monitor(LDKChannelMonitor *this_arg, const LDKChannelMonitorUpdate *updates, const LDKBroadcasterInterface *broadcaster, const LDKFeeEstimator *fee_estimator, const LDKLogger *logger);
 
 /**
  * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this
@@ -3816,7 +3934,7 @@ MUST_USE_RES LDKCVec_TransactionZ ChannelMonitor_get_latest_holder_commitment_tx
  *
  * [`get_outputs_to_watch`]: #method.get_outputs_to_watch
  */
-MUST_USE_RES LDKCVec_C2Tuple_TxidCVec_TxOutZZZ ChannelMonitor_block_connected(LDKChannelMonitor *this_arg, const uint8_t (*header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height, LDKBroadcasterInterface broadcaster, LDKFeeEstimator fee_estimator, LDKLogger logger);
+MUST_USE_RES LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ChannelMonitor_block_connected(LDKChannelMonitor *this_arg, const uint8_t (*header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height, LDKBroadcasterInterface broadcaster, LDKFeeEstimator fee_estimator, LDKLogger logger);
 
 /**
  * Determines if the disconnected block contained any transactions of interest and updates
@@ -3824,8 +3942,15 @@ MUST_USE_RES LDKCVec_C2Tuple_TxidCVec_TxOutZZZ ChannelMonitor_block_connected(LD
  */
 void ChannelMonitor_block_disconnected(LDKChannelMonitor *this_arg, const uint8_t (*header)[80], uint32_t height, LDKBroadcasterInterface broadcaster, LDKFeeEstimator fee_estimator, LDKLogger logger);
 
+/**
+ * Calls the free function if one is set
+ */
+void Persist_free(LDKPersist this_ptr);
+
 void OutPoint_free(LDKOutPoint this_ptr);
 
+LDKOutPoint OutPoint_clone(const LDKOutPoint *orig);
+
 /**
  * The referenced transaction's txid.
  */
@@ -3859,6 +3984,10 @@ LDKOutPoint OutPoint_read(LDKu8slice ser);
 
 void SpendableOutputDescriptor_free(LDKSpendableOutputDescriptor this_ptr);
 
+LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const LDKSpendableOutputDescriptor *orig);
+
+LDKChannelKeys ChannelKeys_clone(const LDKChannelKeys *orig);
+
 /**
  * Calls the free function if one is set
  */
@@ -3871,6 +4000,8 @@ void KeysInterface_free(LDKKeysInterface this_ptr);
 
 void InMemoryChannelKeys_free(LDKInMemoryChannelKeys this_ptr);
 
+LDKInMemoryChannelKeys InMemoryChannelKeys_clone(const LDKInMemoryChannelKeys *orig);
+
 /**
  * Private key of anchor tx
  */
@@ -4005,6 +4136,8 @@ void ChannelManager_free(LDKChannelManager this_ptr);
 
 void ChannelDetails_free(LDKChannelDetails this_ptr);
 
+LDKChannelDetails ChannelDetails_clone(const LDKChannelDetails *orig);
+
 /**
  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
  * thereafter this is the txid of the funding transaction xor the funding transaction output).
@@ -4444,8 +4577,12 @@ void DecodeError_free(LDKDecodeError this_ptr);
 
 void Init_free(LDKInit this_ptr);
 
+LDKInit Init_clone(const LDKInit *orig);
+
 void ErrorMessage_free(LDKErrorMessage this_ptr);
 
+LDKErrorMessage ErrorMessage_clone(const LDKErrorMessage *orig);
+
 /**
  * The channel ID involved in the error
  */
@@ -4476,6 +4613,8 @@ MUST_USE_RES LDKErrorMessage ErrorMessage_new(LDKThirtyTwoBytes channel_id_arg,
 
 void Ping_free(LDKPing this_ptr);
 
+LDKPing Ping_clone(const LDKPing *orig);
+
 /**
  * The desired response length
  */
@@ -4502,6 +4641,8 @@ MUST_USE_RES LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg);
 
 void Pong_free(LDKPong this_ptr);
 
+LDKPong Pong_clone(const LDKPong *orig);
+
 /**
  * The pong packet size.
  * This field is not sent on the wire. byteslen zeros are sent.
@@ -4518,6 +4659,8 @@ MUST_USE_RES LDKPong Pong_new(uint16_t byteslen_arg);
 
 void OpenChannel_free(LDKOpenChannel this_ptr);
 
+LDKOpenChannel OpenChannel_clone(const LDKOpenChannel *orig);
+
 /**
  * The genesis hash of the blockchain where the channel is to be opened
  */
@@ -4700,6 +4843,8 @@ void OpenChannel_set_channel_flags(LDKOpenChannel *this_ptr, uint8_t val);
 
 void AcceptChannel_free(LDKAcceptChannel this_ptr);
 
+LDKAcceptChannel AcceptChannel_clone(const LDKAcceptChannel *orig);
+
 /**
  * A temporary channel ID, until the funding outpoint is announced
  */
@@ -4842,6 +4987,8 @@ void AcceptChannel_set_first_per_commitment_point(LDKAcceptChannel *this_ptr, LD
 
 void FundingCreated_free(LDKFundingCreated this_ptr);
 
+LDKFundingCreated FundingCreated_clone(const LDKFundingCreated *orig);
+
 /**
  * A temporary channel ID, until the funding is established
  */
@@ -4886,6 +5033,8 @@ MUST_USE_RES LDKFundingCreated FundingCreated_new(LDKThirtyTwoBytes temporary_ch
 
 void FundingSigned_free(LDKFundingSigned this_ptr);
 
+LDKFundingSigned FundingSigned_clone(const LDKFundingSigned *orig);
+
 /**
  * The channel ID
  */
@@ -4910,6 +5059,8 @@ MUST_USE_RES LDKFundingSigned FundingSigned_new(LDKThirtyTwoBytes channel_id_arg
 
 void FundingLocked_free(LDKFundingLocked this_ptr);
 
+LDKFundingLocked FundingLocked_clone(const LDKFundingLocked *orig);
+
 /**
  * The channel ID
  */
@@ -4934,6 +5085,8 @@ MUST_USE_RES LDKFundingLocked FundingLocked_new(LDKThirtyTwoBytes channel_id_arg
 
 void Shutdown_free(LDKShutdown this_ptr);
 
+LDKShutdown Shutdown_clone(const LDKShutdown *orig);
+
 /**
  * The channel ID
  */
@@ -4960,6 +5113,8 @@ MUST_USE_RES LDKShutdown Shutdown_new(LDKThirtyTwoBytes channel_id_arg, LDKCVec_
 
 void ClosingSigned_free(LDKClosingSigned this_ptr);
 
+LDKClosingSigned ClosingSigned_clone(const LDKClosingSigned *orig);
+
 /**
  * The channel ID
  */
@@ -4994,6 +5149,8 @@ MUST_USE_RES LDKClosingSigned ClosingSigned_new(LDKThirtyTwoBytes channel_id_arg
 
 void UpdateAddHTLC_free(LDKUpdateAddHTLC this_ptr);
 
+LDKUpdateAddHTLC UpdateAddHTLC_clone(const LDKUpdateAddHTLC *orig);
+
 /**
  * The channel ID
  */
@@ -5046,6 +5203,8 @@ void UpdateAddHTLC_set_cltv_expiry(LDKUpdateAddHTLC *this_ptr, uint32_t val);
 
 void UpdateFulfillHTLC_free(LDKUpdateFulfillHTLC this_ptr);
 
+LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const LDKUpdateFulfillHTLC *orig);
+
 /**
  * The channel ID
  */
@@ -5080,6 +5239,8 @@ MUST_USE_RES LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(LDKThirtyTwoBytes channe
 
 void UpdateFailHTLC_free(LDKUpdateFailHTLC this_ptr);
 
+LDKUpdateFailHTLC UpdateFailHTLC_clone(const LDKUpdateFailHTLC *orig);
+
 /**
  * The channel ID
  */
@@ -5102,6 +5263,8 @@ void UpdateFailHTLC_set_htlc_id(LDKUpdateFailHTLC *this_ptr, uint64_t val);
 
 void UpdateFailMalformedHTLC_free(LDKUpdateFailMalformedHTLC this_ptr);
 
+LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const LDKUpdateFailMalformedHTLC *orig);
+
 /**
  * The channel ID
  */
@@ -5134,6 +5297,8 @@ void UpdateFailMalformedHTLC_set_failure_code(LDKUpdateFailMalformedHTLC *this_p
 
 void CommitmentSigned_free(LDKCommitmentSigned this_ptr);
 
+LDKCommitmentSigned CommitmentSigned_clone(const LDKCommitmentSigned *orig);
+
 /**
  * The channel ID
  */
@@ -5163,6 +5328,8 @@ MUST_USE_RES LDKCommitmentSigned CommitmentSigned_new(LDKThirtyTwoBytes channel_
 
 void RevokeAndACK_free(LDKRevokeAndACK this_ptr);
 
+LDKRevokeAndACK RevokeAndACK_clone(const LDKRevokeAndACK *orig);
+
 /**
  * The channel ID
  */
@@ -5197,6 +5364,8 @@ MUST_USE_RES LDKRevokeAndACK RevokeAndACK_new(LDKThirtyTwoBytes channel_id_arg,
 
 void UpdateFee_free(LDKUpdateFee this_ptr);
 
+LDKUpdateFee UpdateFee_clone(const LDKUpdateFee *orig);
+
 /**
  * The channel ID
  */
@@ -5221,6 +5390,8 @@ MUST_USE_RES LDKUpdateFee UpdateFee_new(LDKThirtyTwoBytes channel_id_arg, uint32
 
 void DataLossProtect_free(LDKDataLossProtect this_ptr);
 
+LDKDataLossProtect DataLossProtect_clone(const LDKDataLossProtect *orig);
+
 /**
  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
  * belonging to the recipient
@@ -5247,6 +5418,8 @@ MUST_USE_RES LDKDataLossProtect DataLossProtect_new(LDKThirtyTwoBytes your_last_
 
 void ChannelReestablish_free(LDKChannelReestablish this_ptr);
 
+LDKChannelReestablish ChannelReestablish_clone(const LDKChannelReestablish *orig);
+
 /**
  * The channel ID
  */
@@ -5279,6 +5452,8 @@ void ChannelReestablish_set_next_remote_commitment_number(LDKChannelReestablish
 
 void AnnouncementSignatures_free(LDKAnnouncementSignatures this_ptr);
 
+LDKAnnouncementSignatures AnnouncementSignatures_clone(const LDKAnnouncementSignatures *orig);
+
 /**
  * The channel ID
  */
@@ -5323,8 +5498,12 @@ MUST_USE_RES LDKAnnouncementSignatures AnnouncementSignatures_new(LDKThirtyTwoBy
 
 void NetAddress_free(LDKNetAddress this_ptr);
 
+LDKNetAddress NetAddress_clone(const LDKNetAddress *orig);
+
 void UnsignedNodeAnnouncement_free(LDKUnsignedNodeAnnouncement this_ptr);
 
+LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const LDKUnsignedNodeAnnouncement *orig);
+
 /**
  * The advertised features
  */
@@ -5386,6 +5565,8 @@ void UnsignedNodeAnnouncement_set_addresses(LDKUnsignedNodeAnnouncement *this_pt
 
 void NodeAnnouncement_free(LDKNodeAnnouncement this_ptr);
 
+LDKNodeAnnouncement NodeAnnouncement_clone(const LDKNodeAnnouncement *orig);
+
 /**
  * The signature by the node key
  */
@@ -5410,6 +5591,8 @@ MUST_USE_RES LDKNodeAnnouncement NodeAnnouncement_new(LDKSignature signature_arg
 
 void UnsignedChannelAnnouncement_free(LDKUnsignedChannelAnnouncement this_ptr);
 
+LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const LDKUnsignedChannelAnnouncement *orig);
+
 /**
  * The advertised channel features
  */
@@ -5482,6 +5665,8 @@ void UnsignedChannelAnnouncement_set_bitcoin_key_2(LDKUnsignedChannelAnnouncemen
 
 void ChannelAnnouncement_free(LDKChannelAnnouncement this_ptr);
 
+LDKChannelAnnouncement ChannelAnnouncement_clone(const LDKChannelAnnouncement *orig);
+
 /**
  * Authentication of the announcement by the first public node
  */
@@ -5536,6 +5721,8 @@ MUST_USE_RES LDKChannelAnnouncement ChannelAnnouncement_new(LDKSignature node_si
 
 void UnsignedChannelUpdate_free(LDKUnsignedChannelUpdate this_ptr);
 
+LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const LDKUnsignedChannelUpdate *orig);
+
 /**
  * The genesis hash of the blockchain where the channel is to be opened
  */
@@ -5618,6 +5805,8 @@ void UnsignedChannelUpdate_set_fee_proportional_millionths(LDKUnsignedChannelUpd
 
 void ChannelUpdate_free(LDKChannelUpdate this_ptr);
 
+LDKChannelUpdate ChannelUpdate_clone(const LDKChannelUpdate *orig);
+
 /**
  * A signature of the channel update
  */
@@ -5642,6 +5831,8 @@ MUST_USE_RES LDKChannelUpdate ChannelUpdate_new(LDKSignature signature_arg, LDKU
 
 void QueryChannelRange_free(LDKQueryChannelRange this_ptr);
 
+LDKQueryChannelRange QueryChannelRange_clone(const LDKQueryChannelRange *orig);
+
 /**
  * The genesis hash of the blockchain being queried
  */
@@ -5676,6 +5867,8 @@ MUST_USE_RES LDKQueryChannelRange QueryChannelRange_new(LDKThirtyTwoBytes chain_
 
 void ReplyChannelRange_free(LDKReplyChannelRange this_ptr);
 
+LDKReplyChannelRange ReplyChannelRange_clone(const LDKReplyChannelRange *orig);
+
 /**
  * The genesis hash of the blockchain being queried
  */
@@ -5727,6 +5920,8 @@ MUST_USE_RES LDKReplyChannelRange ReplyChannelRange_new(LDKThirtyTwoBytes chain_
 
 void QueryShortChannelIds_free(LDKQueryShortChannelIds this_ptr);
 
+LDKQueryShortChannelIds QueryShortChannelIds_clone(const LDKQueryShortChannelIds *orig);
+
 /**
  * The genesis hash of the blockchain being queried
  */
@@ -5746,6 +5941,8 @@ MUST_USE_RES LDKQueryShortChannelIds QueryShortChannelIds_new(LDKThirtyTwoBytes
 
 void ReplyShortChannelIdsEnd_free(LDKReplyShortChannelIdsEnd this_ptr);
 
+LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const LDKReplyShortChannelIdsEnd *orig);
+
 /**
  * The genesis hash of the blockchain that was queried
  */
@@ -5772,6 +5969,8 @@ MUST_USE_RES LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(LDKThirtyTwo
 
 void GossipTimestampFilter_free(LDKGossipTimestampFilter this_ptr);
 
+LDKGossipTimestampFilter GossipTimestampFilter_clone(const LDKGossipTimestampFilter *orig);
+
 /**
  * The genesis hash of the blockchain for channel and node information
  */
@@ -5806,6 +6005,8 @@ MUST_USE_RES LDKGossipTimestampFilter GossipTimestampFilter_new(LDKThirtyTwoByte
 
 void ErrorAction_free(LDKErrorAction this_ptr);
 
+LDKErrorAction ErrorAction_clone(const LDKErrorAction *orig);
+
 void LightningError_free(LDKLightningError this_ptr);
 
 /**
@@ -5832,6 +6033,8 @@ MUST_USE_RES LDKLightningError LightningError_new(LDKCVec_u8Z err_arg, LDKErrorA
 
 void CommitmentUpdate_free(LDKCommitmentUpdate this_ptr);
 
+LDKCommitmentUpdate CommitmentUpdate_clone(const LDKCommitmentUpdate *orig);
+
 /**
  * update_add_htlc messages which should be sent
  */
@@ -5876,6 +6079,8 @@ MUST_USE_RES LDKCommitmentUpdate CommitmentUpdate_new(LDKCVec_UpdateAddHTLCZ upd
 
 void HTLCFailChannelUpdate_free(LDKHTLCFailChannelUpdate this_ptr);
 
+LDKHTLCFailChannelUpdate HTLCFailChannelUpdate_clone(const LDKHTLCFailChannelUpdate *orig);
+
 /**
  * Calls the free function if one is set
  */
@@ -6038,6 +6243,8 @@ void MessageHandler_set_route_handler(LDKMessageHandler *this_ptr, LDKRoutingMes
 
 MUST_USE_RES LDKMessageHandler MessageHandler_new(LDKChannelMessageHandler chan_handler_arg, LDKRoutingMessageHandler route_handler_arg);
 
+LDKSocketDescriptor SocketDescriptor_clone(const LDKSocketDescriptor *orig);
+
 /**
  * Calls the free function if one is set
  */
@@ -6212,6 +6419,8 @@ LDKCResult_PublicKeySecpErrorZ derive_public_revocation_key(LDKPublicKey per_com
 
 void TxCreationKeys_free(LDKTxCreationKeys this_ptr);
 
+LDKTxCreationKeys TxCreationKeys_clone(const LDKTxCreationKeys *orig);
+
 /**
  * The broadcaster's per-commitment public key which was used to derive the other keys.
  */
@@ -6274,6 +6483,8 @@ LDKTxCreationKeys TxCreationKeys_read(LDKu8slice ser);
 
 void PreCalculatedTxCreationKeys_free(LDKPreCalculatedTxCreationKeys this_ptr);
 
+LDKPreCalculatedTxCreationKeys PreCalculatedTxCreationKeys_clone(const LDKPreCalculatedTxCreationKeys *orig);
+
 /**
  * Create a new PreCalculatedTxCreationKeys from TxCreationKeys
  */
@@ -6292,6 +6503,8 @@ MUST_USE_RES LDKPublicKey PreCalculatedTxCreationKeys_per_commitment_point(const
 
 void ChannelPublicKeys_free(LDKChannelPublicKeys this_ptr);
 
+LDKChannelPublicKeys ChannelPublicKeys_clone(const LDKChannelPublicKeys *orig);
+
 /**
  * The public key which is used to sign all commitment transactions, as it appears in the
  * on-chain channel lock-in 2-of-2 multisig output.
@@ -6380,6 +6593,8 @@ LDKCVec_u8Z get_revokeable_redeemscript(LDKPublicKey revocation_key, uint16_t co
 
 void HTLCOutputInCommitment_free(LDKHTLCOutputInCommitment this_ptr);
 
+LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const LDKHTLCOutputInCommitment *orig);
+
 /**
  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
@@ -6451,6 +6666,8 @@ LDKTransaction build_htlc_transaction(const uint8_t (*prev_hash)[32], uint32_t f
 
 void HolderCommitmentTransaction_free(LDKHolderCommitmentTransaction this_ptr);
 
+LDKHolderCommitmentTransaction HolderCommitmentTransaction_clone(const LDKHolderCommitmentTransaction *orig);
+
 /**
  * The commitment transaction itself, in unsigned form.
  */
@@ -6550,6 +6767,8 @@ void ChannelFeatures_free(LDKChannelFeatures this_ptr);
 
 void RouteHop_free(LDKRouteHop this_ptr);
 
+LDKRouteHop RouteHop_clone(const LDKRouteHop *orig);
+
 /**
  * The node_id of the node at this hop.
  */
@@ -6620,6 +6839,8 @@ MUST_USE_RES LDKRouteHop RouteHop_new(LDKPublicKey pubkey_arg, LDKNodeFeatures n
 
 void Route_free(LDKRoute this_ptr);
 
+LDKRoute Route_clone(const LDKRoute *orig);
+
 /**
  * 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.
@@ -6638,6 +6859,8 @@ LDKRoute Route_read(LDKu8slice ser);
 
 void RouteHint_free(LDKRouteHint this_ptr);
 
+LDKRouteHint RouteHint_clone(const LDKRouteHint *orig);
+
 /**
  * The node_id of the non-target end of the route
  */
@@ -6884,6 +7107,8 @@ LDKChannelInfo ChannelInfo_read(LDKu8slice ser);
 
 void RoutingFees_free(LDKRoutingFees this_ptr);
 
+LDKRoutingFees RoutingFees_clone(const LDKRoutingFees *orig);
+
 /**
  * Flat routing fee in satoshis
  */
index 77b587fd8092788288559f55ee80cb9d87f75cea..49e78e3841eae605119575fd28880e188a2dd327 100644 (file)
@@ -291,6 +291,20 @@ public:
        const LDKChannelMonitor* operator &() const { return &self; }
        const LDKChannelMonitor* operator ->() const { return &self; }
 };
+class Persist {
+private:
+       LDKPersist self;
+public:
+       Persist(const Persist&) = delete;
+       ~Persist() { Persist_free(self); }
+       Persist(Persist&& o) : self(o.self) { memset(&o, 0, sizeof(Persist)); }
+       Persist(LDKPersist&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKPersist)); }
+       operator LDKPersist() { LDKPersist res = self; memset(&self, 0, sizeof(LDKPersist)); return res; }
+       LDKPersist* operator &() { return &self; }
+       LDKPersist* operator ->() { return &self; }
+       const LDKPersist* operator &() const { return &self; }
+       const LDKPersist* operator ->() const { return &self; }
+};
 class OutPoint {
 private:
        LDKOutPoint self;
@@ -1396,6 +1410,20 @@ public:
        const LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* operator &() const { return &self; }
        const LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* operator ->() const { return &self; }
 };
+class C2Tuple_u32TxOutZ {
+private:
+       LDKC2Tuple_u32TxOutZ self;
+public:
+       C2Tuple_u32TxOutZ(const C2Tuple_u32TxOutZ&) = delete;
+       ~C2Tuple_u32TxOutZ() { C2Tuple_u32TxOutZ_free(self); }
+       C2Tuple_u32TxOutZ(C2Tuple_u32TxOutZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_u32TxOutZ)); }
+       C2Tuple_u32TxOutZ(LDKC2Tuple_u32TxOutZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_u32TxOutZ)); }
+       operator LDKC2Tuple_u32TxOutZ() { LDKC2Tuple_u32TxOutZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_u32TxOutZ)); return res; }
+       LDKC2Tuple_u32TxOutZ* operator &() { return &self; }
+       LDKC2Tuple_u32TxOutZ* operator ->() { return &self; }
+       const LDKC2Tuple_u32TxOutZ* operator &() const { return &self; }
+       const LDKC2Tuple_u32TxOutZ* operator ->() const { return &self; }
+};
 class CResult_NoneMonitorUpdateErrorZ {
 private:
        LDKCResult_NoneMonitorUpdateErrorZ self;
@@ -1410,20 +1438,6 @@ public:
        const LDKCResult_NoneMonitorUpdateErrorZ* operator &() const { return &self; }
        const LDKCResult_NoneMonitorUpdateErrorZ* operator ->() const { return &self; }
 };
-class CVec_UpdateFailHTLCZ {
-private:
-       LDKCVec_UpdateFailHTLCZ self;
-public:
-       CVec_UpdateFailHTLCZ(const CVec_UpdateFailHTLCZ&) = delete;
-       ~CVec_UpdateFailHTLCZ() { CVec_UpdateFailHTLCZ_free(self); }
-       CVec_UpdateFailHTLCZ(CVec_UpdateFailHTLCZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_UpdateFailHTLCZ)); }
-       CVec_UpdateFailHTLCZ(LDKCVec_UpdateFailHTLCZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_UpdateFailHTLCZ)); }
-       operator LDKCVec_UpdateFailHTLCZ() { LDKCVec_UpdateFailHTLCZ res = self; memset(&self, 0, sizeof(LDKCVec_UpdateFailHTLCZ)); return res; }
-       LDKCVec_UpdateFailHTLCZ* operator &() { return &self; }
-       LDKCVec_UpdateFailHTLCZ* operator ->() { return &self; }
-       const LDKCVec_UpdateFailHTLCZ* operator &() const { return &self; }
-       const LDKCVec_UpdateFailHTLCZ* operator ->() const { return &self; }
-};
 class CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
 private:
        LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ self;
@@ -1438,19 +1452,19 @@ public:
        const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* operator &() const { return &self; }
        const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* operator ->() const { return &self; }
 };
-class CVec_NodeAnnouncementZ {
+class CVec_PublicKeyZ {
 private:
-       LDKCVec_NodeAnnouncementZ self;
+       LDKCVec_PublicKeyZ self;
 public:
-       CVec_NodeAnnouncementZ(const CVec_NodeAnnouncementZ&) = delete;
-       ~CVec_NodeAnnouncementZ() { CVec_NodeAnnouncementZ_free(self); }
-       CVec_NodeAnnouncementZ(CVec_NodeAnnouncementZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_NodeAnnouncementZ)); }
-       CVec_NodeAnnouncementZ(LDKCVec_NodeAnnouncementZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_NodeAnnouncementZ)); }
-       operator LDKCVec_NodeAnnouncementZ() { LDKCVec_NodeAnnouncementZ res = self; memset(&self, 0, sizeof(LDKCVec_NodeAnnouncementZ)); return res; }
-       LDKCVec_NodeAnnouncementZ* operator &() { return &self; }
-       LDKCVec_NodeAnnouncementZ* operator ->() { return &self; }
-       const LDKCVec_NodeAnnouncementZ* operator &() const { return &self; }
-       const LDKCVec_NodeAnnouncementZ* operator ->() const { return &self; }
+       CVec_PublicKeyZ(const CVec_PublicKeyZ&) = delete;
+       ~CVec_PublicKeyZ() { CVec_PublicKeyZ_free(self); }
+       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; }
+       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 CResult_boolLightningErrorZ {
 private:
@@ -1466,33 +1480,19 @@ public:
        const LDKCResult_boolLightningErrorZ* operator &() const { return &self; }
        const LDKCResult_boolLightningErrorZ* operator ->() const { return &self; }
 };
-class CVec_PublicKeyZ {
+class CVec_C2Tuple_u32TxOutZZ {
 private:
-       LDKCVec_PublicKeyZ self;
+       LDKCVec_C2Tuple_u32TxOutZZ self;
 public:
-       CVec_PublicKeyZ(const CVec_PublicKeyZ&) = delete;
-       ~CVec_PublicKeyZ() { CVec_PublicKeyZ_free(self); }
-       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; }
-       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 CResult_SecretKeySecpErrorZ {
-private:
-       LDKCResult_SecretKeySecpErrorZ self;
-public:
-       CResult_SecretKeySecpErrorZ(const CResult_SecretKeySecpErrorZ&) = delete;
-       ~CResult_SecretKeySecpErrorZ() { CResult_SecretKeySecpErrorZ_free(self); }
-       CResult_SecretKeySecpErrorZ(CResult_SecretKeySecpErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_SecretKeySecpErrorZ)); }
-       CResult_SecretKeySecpErrorZ(LDKCResult_SecretKeySecpErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_SecretKeySecpErrorZ)); }
-       operator LDKCResult_SecretKeySecpErrorZ() { LDKCResult_SecretKeySecpErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_SecretKeySecpErrorZ)); return res; }
-       LDKCResult_SecretKeySecpErrorZ* operator &() { return &self; }
-       LDKCResult_SecretKeySecpErrorZ* operator ->() { return &self; }
-       const LDKCResult_SecretKeySecpErrorZ* operator &() const { return &self; }
-       const LDKCResult_SecretKeySecpErrorZ* operator ->() const { return &self; }
+       CVec_C2Tuple_u32TxOutZZ(const CVec_C2Tuple_u32TxOutZZ&) = delete;
+       ~CVec_C2Tuple_u32TxOutZZ() { CVec_C2Tuple_u32TxOutZZ_free(self); }
+       CVec_C2Tuple_u32TxOutZZ(CVec_C2Tuple_u32TxOutZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C2Tuple_u32TxOutZZ)); }
+       CVec_C2Tuple_u32TxOutZZ(LDKCVec_C2Tuple_u32TxOutZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C2Tuple_u32TxOutZZ)); }
+       operator LDKCVec_C2Tuple_u32TxOutZZ() { LDKCVec_C2Tuple_u32TxOutZZ res = self; memset(&self, 0, sizeof(LDKCVec_C2Tuple_u32TxOutZZ)); return res; }
+       LDKCVec_C2Tuple_u32TxOutZZ* operator &() { return &self; }
+       LDKCVec_C2Tuple_u32TxOutZZ* operator ->() { return &self; }
+       const LDKCVec_C2Tuple_u32TxOutZZ* operator &() const { return &self; }
+       const LDKCVec_C2Tuple_u32TxOutZZ* operator ->() const { return &self; }
 };
 class CVec_SignatureZ {
 private:
@@ -1550,6 +1550,20 @@ public:
        const LDKCVec_UpdateFailMalformedHTLCZ* operator &() const { return &self; }
        const LDKCVec_UpdateFailMalformedHTLCZ* operator ->() const { return &self; }
 };
+class CResult_SecretKeySecpErrorZ {
+private:
+       LDKCResult_SecretKeySecpErrorZ self;
+public:
+       CResult_SecretKeySecpErrorZ(const CResult_SecretKeySecpErrorZ&) = delete;
+       ~CResult_SecretKeySecpErrorZ() { CResult_SecretKeySecpErrorZ_free(self); }
+       CResult_SecretKeySecpErrorZ(CResult_SecretKeySecpErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_SecretKeySecpErrorZ)); }
+       CResult_SecretKeySecpErrorZ(LDKCResult_SecretKeySecpErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_SecretKeySecpErrorZ)); }
+       operator LDKCResult_SecretKeySecpErrorZ() { LDKCResult_SecretKeySecpErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_SecretKeySecpErrorZ)); return res; }
+       LDKCResult_SecretKeySecpErrorZ* operator &() { return &self; }
+       LDKCResult_SecretKeySecpErrorZ* operator ->() { return &self; }
+       const LDKCResult_SecretKeySecpErrorZ* operator &() const { return &self; }
+       const LDKCResult_SecretKeySecpErrorZ* operator ->() const { return &self; }
+};
 class C2Tuple_HTLCOutputInCommitmentSignatureZ {
 private:
        LDKC2Tuple_HTLCOutputInCommitmentSignatureZ self;
@@ -1858,19 +1872,19 @@ public:
        const LDKCResult_SignatureNoneZ* operator &() const { return &self; }
        const LDKCResult_SignatureNoneZ* operator ->() const { return &self; }
 };
-class C2Tuple_TxidCVec_TxOutZZ {
+class C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
 private:
-       LDKC2Tuple_TxidCVec_TxOutZZ self;
+       LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ self;
 public:
-       C2Tuple_TxidCVec_TxOutZZ(const C2Tuple_TxidCVec_TxOutZZ&) = delete;
-       ~C2Tuple_TxidCVec_TxOutZZ() { C2Tuple_TxidCVec_TxOutZZ_free(self); }
-       C2Tuple_TxidCVec_TxOutZZ(C2Tuple_TxidCVec_TxOutZZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_TxidCVec_TxOutZZ)); }
-       C2Tuple_TxidCVec_TxOutZZ(LDKC2Tuple_TxidCVec_TxOutZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_TxidCVec_TxOutZZ)); }
-       operator LDKC2Tuple_TxidCVec_TxOutZZ() { LDKC2Tuple_TxidCVec_TxOutZZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_TxidCVec_TxOutZZ)); return res; }
-       LDKC2Tuple_TxidCVec_TxOutZZ* operator &() { return &self; }
-       LDKC2Tuple_TxidCVec_TxOutZZ* operator ->() { return &self; }
-       const LDKC2Tuple_TxidCVec_TxOutZZ* operator &() const { return &self; }
-       const LDKC2Tuple_TxidCVec_TxOutZZ* operator ->() const { return &self; }
+       C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ(const C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ&) = delete;
+       ~C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ() { C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(self); }
+       C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ(C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ)); }
+       C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ)); }
+       operator LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ() { LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ)); return res; }
+       LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* operator &() { return &self; }
+       LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* operator ->() { return &self; }
+       const LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* operator &() const { return &self; }
+       const LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* operator ->() const { return &self; }
 };
 class CVec_ChannelDetailsZ {
 private:
@@ -1900,6 +1914,20 @@ public:
        const LDKCVec_MessageSendEventZ* operator &() const { return &self; }
        const LDKCVec_MessageSendEventZ* operator ->() const { return &self; }
 };
+class CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ {
+private:
+       LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ self;
+public:
+       CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ(const CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ&) = delete;
+       ~CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ() { CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(self); }
+       CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ(CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ)); }
+       CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ)); }
+       operator LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ() { LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ res = self; memset(&self, 0, sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ)); return res; }
+       LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ* operator &() { return &self; }
+       LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ* operator ->() { return &self; }
+       const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ* operator &() const { return &self; }
+       const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ* operator ->() const { return &self; }
+};
 class CResult_NoneAPIErrorZ {
 private:
        LDKCResult_NoneAPIErrorZ self;
@@ -1942,20 +1970,6 @@ public:
        const LDKCVec_NetAddressZ* operator &() const { return &self; }
        const LDKCVec_NetAddressZ* operator ->() const { return &self; }
 };
-class CVec_TxOutZ {
-private:
-       LDKCVec_TxOutZ self;
-public:
-       CVec_TxOutZ(const CVec_TxOutZ&) = delete;
-       ~CVec_TxOutZ() { CVec_TxOutZ_free(self); }
-       CVec_TxOutZ(CVec_TxOutZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_TxOutZ)); }
-       CVec_TxOutZ(LDKCVec_TxOutZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_TxOutZ)); }
-       operator LDKCVec_TxOutZ() { LDKCVec_TxOutZ res = self; memset(&self, 0, sizeof(LDKCVec_TxOutZ)); return res; }
-       LDKCVec_TxOutZ* operator &() { return &self; }
-       LDKCVec_TxOutZ* operator ->() { return &self; }
-       const LDKCVec_TxOutZ* operator &() const { return &self; }
-       const LDKCVec_TxOutZ* operator ->() const { return &self; }
-};
 class C2Tuple_usizeTransactionZ {
 private:
        LDKC2Tuple_usizeTransactionZ self;
@@ -1984,6 +1998,20 @@ public:
        const LDKCVec_C2Tuple_usizeTransactionZZ* operator &() const { return &self; }
        const LDKCVec_C2Tuple_usizeTransactionZZ* operator ->() const { return &self; }
 };
+class CVec_TransactionZ {
+private:
+       LDKCVec_TransactionZ self;
+public:
+       CVec_TransactionZ(const CVec_TransactionZ&) = delete;
+       ~CVec_TransactionZ() { CVec_TransactionZ_free(self); }
+       CVec_TransactionZ(CVec_TransactionZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_TransactionZ)); }
+       CVec_TransactionZ(LDKCVec_TransactionZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_TransactionZ)); }
+       operator LDKCVec_TransactionZ() { LDKCVec_TransactionZ res = self; memset(&self, 0, sizeof(LDKCVec_TransactionZ)); return res; }
+       LDKCVec_TransactionZ* operator &() { return &self; }
+       LDKCVec_TransactionZ* operator ->() { return &self; }
+       const LDKCVec_TransactionZ* operator &() const { return &self; }
+       const LDKCVec_TransactionZ* operator ->() const { return &self; }
+};
 class CVec_ChannelMonitorZ {
 private:
        LDKCVec_ChannelMonitorZ self;
@@ -1998,33 +2026,33 @@ public:
        const LDKCVec_ChannelMonitorZ* operator &() const { return &self; }
        const LDKCVec_ChannelMonitorZ* operator ->() const { return &self; }
 };
-class CVec_TransactionZ {
+class CVec_UpdateFailHTLCZ {
 private:
-       LDKCVec_TransactionZ self;
+       LDKCVec_UpdateFailHTLCZ self;
 public:
-       CVec_TransactionZ(const CVec_TransactionZ&) = delete;
-       ~CVec_TransactionZ() { CVec_TransactionZ_free(self); }
-       CVec_TransactionZ(CVec_TransactionZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_TransactionZ)); }
-       CVec_TransactionZ(LDKCVec_TransactionZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_TransactionZ)); }
-       operator LDKCVec_TransactionZ() { LDKCVec_TransactionZ res = self; memset(&self, 0, sizeof(LDKCVec_TransactionZ)); return res; }
-       LDKCVec_TransactionZ* operator &() { return &self; }
-       LDKCVec_TransactionZ* operator ->() { return &self; }
-       const LDKCVec_TransactionZ* operator &() const { return &self; }
-       const LDKCVec_TransactionZ* operator ->() const { return &self; }
+       CVec_UpdateFailHTLCZ(const CVec_UpdateFailHTLCZ&) = delete;
+       ~CVec_UpdateFailHTLCZ() { CVec_UpdateFailHTLCZ_free(self); }
+       CVec_UpdateFailHTLCZ(CVec_UpdateFailHTLCZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_UpdateFailHTLCZ)); }
+       CVec_UpdateFailHTLCZ(LDKCVec_UpdateFailHTLCZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_UpdateFailHTLCZ)); }
+       operator LDKCVec_UpdateFailHTLCZ() { LDKCVec_UpdateFailHTLCZ res = self; memset(&self, 0, sizeof(LDKCVec_UpdateFailHTLCZ)); return res; }
+       LDKCVec_UpdateFailHTLCZ* operator &() { return &self; }
+       LDKCVec_UpdateFailHTLCZ* operator ->() { return &self; }
+       const LDKCVec_UpdateFailHTLCZ* operator &() const { return &self; }
+       const LDKCVec_UpdateFailHTLCZ* operator ->() const { return &self; }
 };
-class CVec_C2Tuple_TxidCVec_TxOutZZZ {
+class CVec_NodeAnnouncementZ {
 private:
-       LDKCVec_C2Tuple_TxidCVec_TxOutZZZ self;
+       LDKCVec_NodeAnnouncementZ self;
 public:
-       CVec_C2Tuple_TxidCVec_TxOutZZZ(const CVec_C2Tuple_TxidCVec_TxOutZZZ&) = delete;
-       ~CVec_C2Tuple_TxidCVec_TxOutZZZ() { CVec_C2Tuple_TxidCVec_TxOutZZZ_free(self); }
-       CVec_C2Tuple_TxidCVec_TxOutZZZ(CVec_C2Tuple_TxidCVec_TxOutZZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C2Tuple_TxidCVec_TxOutZZZ)); }
-       CVec_C2Tuple_TxidCVec_TxOutZZZ(LDKCVec_C2Tuple_TxidCVec_TxOutZZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C2Tuple_TxidCVec_TxOutZZZ)); }
-       operator LDKCVec_C2Tuple_TxidCVec_TxOutZZZ() { LDKCVec_C2Tuple_TxidCVec_TxOutZZZ res = self; memset(&self, 0, sizeof(LDKCVec_C2Tuple_TxidCVec_TxOutZZZ)); return res; }
-       LDKCVec_C2Tuple_TxidCVec_TxOutZZZ* operator &() { return &self; }
-       LDKCVec_C2Tuple_TxidCVec_TxOutZZZ* operator ->() { return &self; }
-       const LDKCVec_C2Tuple_TxidCVec_TxOutZZZ* operator &() const { return &self; }
-       const LDKCVec_C2Tuple_TxidCVec_TxOutZZZ* operator ->() const { return &self; }
+       CVec_NodeAnnouncementZ(const CVec_NodeAnnouncementZ&) = delete;
+       ~CVec_NodeAnnouncementZ() { CVec_NodeAnnouncementZ_free(self); }
+       CVec_NodeAnnouncementZ(CVec_NodeAnnouncementZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_NodeAnnouncementZ)); }
+       CVec_NodeAnnouncementZ(LDKCVec_NodeAnnouncementZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_NodeAnnouncementZ)); }
+       operator LDKCVec_NodeAnnouncementZ() { LDKCVec_NodeAnnouncementZ res = self; memset(&self, 0, sizeof(LDKCVec_NodeAnnouncementZ)); return res; }
+       LDKCVec_NodeAnnouncementZ* operator &() { return &self; }
+       LDKCVec_NodeAnnouncementZ* operator ->() { return &self; }
+       const LDKCVec_NodeAnnouncementZ* operator &() const { return &self; }
+       const LDKCVec_NodeAnnouncementZ* operator ->() const { return &self; }
 };
 class C2Tuple_u64u64Z {
 private:
index ca6cdc69fa95cc4fa20ce4223797bfe6025071da..2e15b2a2b2adf1d99d15b7091a40d878f68e8ed1 100644 (file)
@@ -116,6 +116,7 @@ struct nativeCommitmentUpdateOpaque;
 typedef struct nativeCommitmentUpdateOpaque LDKnativeCommitmentUpdate;
 struct nativeMessageHandlerOpaque;
 typedef struct nativeMessageHandlerOpaque LDKnativeMessageHandler;
+typedef struct LDKSocketDescriptor LDKSocketDescriptor;
 struct nativePeerHandleErrorOpaque;
 typedef struct nativePeerHandleErrorOpaque LDKnativePeerHandleError;
 struct nativePeerManagerOpaque;
index d084a1562274f26f865d1ce0a499fb97631631ee..fd77e0d4cf11cbcba6777980a73e64ea97849f67 100644 (file)
@@ -73,23 +73,32 @@ pub type CVec_TransactionZ = crate::c_types::CVecTempl<crate::c_types::Transacti
 pub static CVec_TransactionZ_free: extern "C" fn(CVec_TransactionZ) = crate::c_types::CVecTempl_free::<crate::c_types::Transaction>;
 
 #[no_mangle]
-pub type CVec_TxOutZ = crate::c_types::CVecTempl<crate::c_types::TxOut>;
+pub type C2Tuple_u32TxOutZ = crate::c_types::C2TupleTempl<u32, crate::c_types::TxOut>;
 #[no_mangle]
-pub static CVec_TxOutZ_free: extern "C" fn(CVec_TxOutZ) = crate::c_types::CVecTempl_free::<crate::c_types::TxOut>;
+pub static C2Tuple_u32TxOutZ_free: extern "C" fn(C2Tuple_u32TxOutZ) = crate::c_types::C2TupleTempl_free::<u32, crate::c_types::TxOut>;
+#[no_mangle]
+pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
+       C2Tuple_u32TxOutZ { a, b, }
+}
+
+#[no_mangle]
+pub type CVec_C2Tuple_u32TxOutZZ = crate::c_types::CVecTempl<crate::c_types::C2TupleTempl<u32, crate::c_types::TxOut>>;
+#[no_mangle]
+pub static CVec_C2Tuple_u32TxOutZZ_free: extern "C" fn(CVec_C2Tuple_u32TxOutZZ) = crate::c_types::CVecTempl_free::<crate::c_types::C2TupleTempl<u32, crate::c_types::TxOut>>;
 
 #[no_mangle]
-pub type C2Tuple_TxidCVec_TxOutZZ = crate::c_types::C2TupleTempl<crate::c_types::ThirtyTwoBytes, crate::c_types::CVecTempl<crate::c_types::TxOut>>;
+pub type C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ = crate::c_types::C2TupleTempl<crate::c_types::ThirtyTwoBytes, crate::c_types::CVecTempl<crate::c_types::C2TupleTempl<u32, crate::c_types::TxOut>>>;
 #[no_mangle]
-pub static C2Tuple_TxidCVec_TxOutZZ_free: extern "C" fn(C2Tuple_TxidCVec_TxOutZZ) = crate::c_types::C2TupleTempl_free::<crate::c_types::ThirtyTwoBytes, crate::c_types::CVecTempl<crate::c_types::TxOut>>;
+pub static C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free: extern "C" fn(C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) = crate::c_types::C2TupleTempl_free::<crate::c_types::ThirtyTwoBytes, crate::c_types::CVecTempl<crate::c_types::C2TupleTempl<u32, crate::c_types::TxOut>>>;
 #[no_mangle]
-pub extern "C" fn C2Tuple_TxidCVec_TxOutZZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::derived::CVec_TxOutZ) -> C2Tuple_TxidCVec_TxOutZZ {
-       C2Tuple_TxidCVec_TxOutZZ { a, b, }
+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]
-pub type CVec_C2Tuple_TxidCVec_TxOutZZZ = crate::c_types::CVecTempl<crate::c_types::C2TupleTempl<crate::c_types::ThirtyTwoBytes, crate::c_types::CVecTempl<crate::c_types::TxOut>>>;
+pub type CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ = crate::c_types::CVecTempl<crate::c_types::C2TupleTempl<crate::c_types::ThirtyTwoBytes, crate::c_types::CVecTempl<crate::c_types::C2TupleTempl<u32, crate::c_types::TxOut>>>>;
 #[no_mangle]
-pub static CVec_C2Tuple_TxidCVec_TxOutZZZ_free: extern "C" fn(CVec_C2Tuple_TxidCVec_TxOutZZZ) = crate::c_types::CVecTempl_free::<crate::c_types::C2TupleTempl<crate::c_types::ThirtyTwoBytes, crate::c_types::CVecTempl<crate::c_types::TxOut>>>;
+pub static CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free: extern "C" fn(CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ) = crate::c_types::CVecTempl_free::<crate::c_types::C2TupleTempl<crate::c_types::ThirtyTwoBytes, crate::c_types::CVecTempl<crate::c_types::C2TupleTempl<u32, crate::c_types::TxOut>>>>;
 
 #[no_mangle]
 pub type C2Tuple_u64u64Z = crate::c_types::C2TupleTempl<u64, u64>;
index ef524b568de24cbdaf1d2c880171bd1c8be71c81..b5f51032326edc1cac5ae8b0e763c4d4e9b82082 100644 (file)
@@ -93,6 +93,10 @@ impl ConfirmationTarget {
                }
        }
 }
+#[no_mangle]
+pub extern "C" fn ConfirmationTarget_clone(orig: &ConfirmationTarget) -> ConfirmationTarget {
+       orig.clone()
+}
 /// A trait which should be implemented to provide feerate information on a number of time
 /// horizons.
 ///
index 539b8450eb9141f3025750b2ef6ec197ad6ce0c4..35eb1bed22d1e442c7bfbbc9991156e0cd72cc84 100644 (file)
@@ -26,7 +26,7 @@ use crate::c_types::*;
 
 
 use lightning::chain::chainmonitor::ChainMonitor as nativeChainMonitorImport;
-type nativeChainMonitor = nativeChainMonitorImport<crate::chain::keysinterface::ChannelKeys, crate::chain::Filter, crate::chain::chaininterface::BroadcasterInterface, crate::chain::chaininterface::FeeEstimator, crate::util::logger::Logger>;
+type nativeChainMonitor = nativeChainMonitorImport<crate::chain::keysinterface::ChannelKeys, crate::chain::Filter, crate::chain::chaininterface::BroadcasterInterface, crate::chain::chaininterface::FeeEstimator, crate::util::logger::Logger, crate::chain::channelmonitor::Persist>;
 
 /// An implementation of [`chain::Watch`] for monitoring channels.
 ///
@@ -111,9 +111,9 @@ pub extern "C" fn ChainMonitor_block_disconnected(this_arg: &ChainMonitor, heade
 /// [`chain::Filter`]: ../trait.Filter.html
 #[must_use]
 #[no_mangle]
-pub extern "C" fn ChainMonitor_new(chain_source: *mut crate::chain::Filter, mut broadcaster: crate::chain::chaininterface::BroadcasterInterface, mut logger: crate::util::logger::Logger, mut feeest: crate::chain::chaininterface::FeeEstimator) -> ChainMonitor {
+pub extern "C" fn ChainMonitor_new(chain_source: *mut crate::chain::Filter, mut broadcaster: crate::chain::chaininterface::BroadcasterInterface, mut logger: crate::util::logger::Logger, mut feeest: crate::chain::chaininterface::FeeEstimator, mut persister: crate::chain::channelmonitor::Persist) -> ChainMonitor {
        let mut local_chain_source = if chain_source == std::ptr::null_mut() { None } else { Some( { unsafe { *Box::from_raw(chain_source) } }) };
-       let mut ret = lightning::chain::chainmonitor::ChainMonitor::new(local_chain_source, broadcaster, logger, feeest);
+       let mut ret = lightning::chain::chainmonitor::ChainMonitor::new(local_chain_source, broadcaster, logger, feeest, persister);
        ChainMonitor { inner: Box::into_raw(Box::new(ret)), is_owned: true }
 }
 
@@ -129,8 +129,8 @@ pub extern "C" fn ChainMonitor_as_Watch(this_arg: *const ChainMonitor) -> crate:
 }
 use lightning::chain::Watch as WatchTraitImport;
 #[must_use]
-extern "C" fn ChainMonitor_Watch_watch_channel(this_arg: *const c_void, mut funding_txo: crate::chain::transaction::OutPoint, mut monitor: crate::chain::channelmonitor::ChannelMonitor) -> crate::c_types::derived::CResult_NoneChannelMonitorUpdateErrZ {
-       let mut ret = unsafe { &mut *(this_arg as *mut nativeChainMonitor) }.watch_channel(*unsafe { Box::from_raw(funding_txo.take_ptr()) }, *unsafe { Box::from_raw(monitor.take_ptr()) });
+extern "C" fn ChainMonitor_Watch_watch_channel(this_arg: *const c_void, mut funding_outpoint: crate::chain::transaction::OutPoint, mut monitor: crate::chain::channelmonitor::ChannelMonitor) -> crate::c_types::derived::CResult_NoneChannelMonitorUpdateErrZ {
+       let mut ret = unsafe { &mut *(this_arg as *mut nativeChainMonitor) }.watch_channel(*unsafe { Box::from_raw(funding_outpoint.take_ptr()) }, *unsafe { Box::from_raw(monitor.take_ptr()) });
        let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { 0u8 /*o*/ }), Err(mut e) => crate::c_types::CResultTempl::err( { crate::chain::channelmonitor::ChannelMonitorUpdateErr::native_into(e) }) };
        local_ret
 }
index 79c84d53ea0eb2b3a2a2a42cebce2bb8ab1db905..c644670257b2b34bcded75a22f1f3bdc02693ed8 100644 (file)
@@ -69,13 +69,23 @@ impl Clone for ChannelMonitorUpdate {
 pub(crate) extern "C" fn ChannelMonitorUpdate_clone_void(this_ptr: *const c_void) -> *mut c_void {
        Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChannelMonitorUpdate)).clone() })) as *mut c_void
 }
+#[no_mangle]
+pub extern "C" fn ChannelMonitorUpdate_clone(orig: &ChannelMonitorUpdate) -> ChannelMonitorUpdate {
+       ChannelMonitorUpdate { inner: Box::into_raw(Box::new(unsafe { &*orig.inner }.clone())), is_owned: true }
+}
 /// The sequence number of this update. Updates *must* be replayed in-order according to this
 /// sequence number (and updates may panic if they are not). The update_id values are strictly
-/// increasing and increase by one for each new update.
+/// increasing and increase by one for each new update, with one exception specified below.
 ///
 /// This sequence number is also used to track up to which points updates which returned
 /// ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
 /// ChannelMonitor when ChannelManager::channel_monitor_updated is called.
+///
+/// The only instance where update_id values are not strictly increasing is the case where we
+/// allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
+/// its docs for more details.
+///
+/// [`CLOSED_CHANNEL_UPDATE_ID`]: constant.CLOSED_CHANNEL_UPDATE_ID.html
 #[no_mangle]
 pub extern "C" fn ChannelMonitorUpdate_get_update_id(this_ptr: &ChannelMonitorUpdate) -> u64 {
        let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.update_id;
@@ -83,15 +93,24 @@ pub extern "C" fn ChannelMonitorUpdate_get_update_id(this_ptr: &ChannelMonitorUp
 }
 /// The sequence number of this update. Updates *must* be replayed in-order according to this
 /// sequence number (and updates may panic if they are not). The update_id values are strictly
-/// increasing and increase by one for each new update.
+/// increasing and increase by one for each new update, with one exception specified below.
 ///
 /// This sequence number is also used to track up to which points updates which returned
 /// ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
 /// ChannelMonitor when ChannelManager::channel_monitor_updated is called.
+///
+/// The only instance where update_id values are not strictly increasing is the case where we
+/// allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
+/// its docs for more details.
+///
+/// [`CLOSED_CHANNEL_UPDATE_ID`]: constant.CLOSED_CHANNEL_UPDATE_ID.html
 #[no_mangle]
 pub extern "C" fn ChannelMonitorUpdate_set_update_id(this_ptr: &mut ChannelMonitorUpdate, mut val: u64) {
        unsafe { &mut *this_ptr.inner }.update_id = val;
 }
+
+#[no_mangle]
+pub static CLOSED_CHANNEL_UPDATE_ID: u64 = lightning::chain::channelmonitor::CLOSED_CHANNEL_UPDATE_ID;
 #[no_mangle]
 pub extern "C" fn ChannelMonitorUpdate_write(obj: *const ChannelMonitorUpdate) -> crate::c_types::derived::CVec_u8Z {
        crate::c_types::serialize_obj(unsafe { &(*(*obj).inner) })
@@ -197,6 +216,10 @@ impl ChannelMonitorUpdateErr {
                }
        }
 }
+#[no_mangle]
+pub extern "C" fn ChannelMonitorUpdateErr_clone(orig: &ChannelMonitorUpdateErr) -> ChannelMonitorUpdateErr {
+       orig.clone()
+}
 
 use lightning::chain::channelmonitor::MonitorUpdateError as nativeMonitorUpdateErrorImport;
 type nativeMonitorUpdateError = nativeMonitorUpdateErrorImport;
@@ -205,7 +228,7 @@ type nativeMonitorUpdateError = nativeMonitorUpdateErrorImport;
 /// inconsistent with the ChannelMonitor being called. eg for ChannelMonitor::update_monitor this
 /// means you tried to update a monitor for a different channel or the ChannelMonitorUpdate was
 /// corrupted.
-/// Contains a human-readable error message.
+/// Contains a developer-readable error message.
 #[must_use]
 #[repr(C)]
 pub struct MonitorUpdateError {
@@ -277,6 +300,23 @@ impl MonitorEvent {
                ret
        }
 }
+impl Clone for MonitorEvent {
+       fn clone(&self) -> Self {
+               Self {
+                       inner: Box::into_raw(Box::new(unsafe { &*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 MonitorEvent_clone_void(this_ptr: *const c_void) -> *mut c_void {
+       Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeMonitorEvent)).clone() })) as *mut c_void
+}
+#[no_mangle]
+pub extern "C" fn MonitorEvent_clone(orig: &MonitorEvent) -> MonitorEvent {
+       MonitorEvent { inner: Box::into_raw(Box::new(unsafe { &*orig.inner }.clone())), is_owned: true }
+}
 
 use lightning::chain::channelmonitor::HTLCUpdate as nativeHTLCUpdateImport;
 type nativeHTLCUpdate = nativeHTLCUpdateImport;
@@ -333,6 +373,10 @@ pub(crate) extern "C" fn HTLCUpdate_clone_void(this_ptr: *const c_void) -> *mut
        Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeHTLCUpdate)).clone() })) as *mut c_void
 }
 #[no_mangle]
+pub extern "C" fn HTLCUpdate_clone(orig: &HTLCUpdate) -> HTLCUpdate {
+       HTLCUpdate { inner: Box::into_raw(Box::new(unsafe { &*orig.inner }.clone())), is_owned: true }
+}
+#[no_mangle]
 pub extern "C" fn HTLCUpdate_write(obj: *const HTLCUpdate) -> crate::c_types::derived::CVec_u8Z {
        crate::c_types::serialize_obj(unsafe { &(*(*obj).inner) })
 }
@@ -397,8 +441,8 @@ impl ChannelMonitor {
 /// panics if the given update is not the next update by update_id.
 #[must_use]
 #[no_mangle]
-pub extern "C" fn ChannelMonitor_update_monitor(this_arg: &mut ChannelMonitor, mut updates: crate::chain::channelmonitor::ChannelMonitorUpdate, broadcaster: &crate::chain::chaininterface::BroadcasterInterface, logger: &crate::util::logger::Logger) -> crate::c_types::derived::CResult_NoneMonitorUpdateErrorZ {
-       let mut ret = unsafe { &mut (*(this_arg.inner as *mut nativeChannelMonitor)) }.update_monitor(*unsafe { Box::from_raw(updates.take_ptr()) }, broadcaster, logger);
+pub extern "C" fn ChannelMonitor_update_monitor(this_arg: &mut ChannelMonitor, updates: &crate::chain::channelmonitor::ChannelMonitorUpdate, broadcaster: &crate::chain::chaininterface::BroadcasterInterface, fee_estimator: &crate::chain::chaininterface::FeeEstimator, logger: &crate::util::logger::Logger) -> crate::c_types::derived::CResult_NoneMonitorUpdateErrorZ {
+       let mut ret = unsafe { &mut (*(this_arg.inner as *mut nativeChannelMonitor)) }.update_monitor(unsafe { &*updates.inner }, broadcaster, fee_estimator, logger);
        let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { 0u8 /*o*/ }), Err(mut e) => crate::c_types::CResultTempl::err( { crate::chain::channelmonitor::MonitorUpdateError { inner: Box::into_raw(Box::new(e)), is_owned: true } }) };
        local_ret
 }
@@ -477,10 +521,10 @@ pub extern "C" fn ChannelMonitor_get_latest_holder_commitment_txn(this_arg: &mut
 /// [`get_outputs_to_watch`]: #method.get_outputs_to_watch
 #[must_use]
 #[no_mangle]
-pub extern "C" fn ChannelMonitor_block_connected(this_arg: &mut ChannelMonitor, header: *const [u8; 80], mut txdata: crate::c_types::derived::CVec_C2Tuple_usizeTransactionZZ, mut height: u32, mut broadcaster: crate::chain::chaininterface::BroadcasterInterface, mut fee_estimator: crate::chain::chaininterface::FeeEstimator, mut logger: crate::util::logger::Logger) -> crate::c_types::derived::CVec_C2Tuple_TxidCVec_TxOutZZZ {
+pub extern "C" fn ChannelMonitor_block_connected(this_arg: &mut ChannelMonitor, header: *const [u8; 80], mut txdata: crate::c_types::derived::CVec_C2Tuple_usizeTransactionZZ, mut height: u32, mut broadcaster: crate::chain::chaininterface::BroadcasterInterface, mut fee_estimator: crate::chain::chaininterface::FeeEstimator, mut logger: crate::util::logger::Logger) -> crate::c_types::derived::CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ {
        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 }); };
        let mut ret = unsafe { &mut (*(this_arg.inner as *mut nativeChannelMonitor)) }.block_connected(&::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), &local_txdata.iter().map(|(a, b)| (*a, b)).collect::<Vec<_>>()[..], height, broadcaster, fee_estimator, logger);
-       let mut local_ret = Vec::new(); for 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 item in orig_ret_0_1.drain(..) { local_orig_ret_0_1.push( { crate::c_types::TxOut::from_rust(item) }); }; let mut local_ret_0 = (crate::c_types::ThirtyTwoBytes { data: orig_ret_0_0.into_inner() }, local_orig_ret_0_1.into()).into(); local_ret_0 }); };
+       let mut local_ret = Vec::new(); for 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 item in orig_ret_0_1.drain(..) { local_orig_ret_0_1.push( { let (mut orig_orig_ret_0_1_0_0, mut orig_orig_ret_0_1_0_1) = item; let mut local_orig_ret_0_1_0 = (orig_orig_ret_0_1_0_0, crate::c_types::TxOut::from_rust(orig_orig_ret_0_1_0_1)).into(); local_orig_ret_0_1_0 }); }; let mut local_ret_0 = (crate::c_types::ThirtyTwoBytes { data: orig_ret_0_0.into_inner() }, local_orig_ret_0_1.into()).into(); local_ret_0 }); };
        local_ret.into()
 }
 
@@ -491,3 +535,96 @@ pub extern "C" fn ChannelMonitor_block_disconnected(this_arg: &mut ChannelMonito
        unsafe { &mut (*(this_arg.inner as *mut nativeChannelMonitor)) }.block_disconnected(&::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), height, broadcaster, fee_estimator, logger)
 }
 
+/// `Persist` defines behavior for persisting channel monitors: this could mean
+/// writing once to disk, and/or uploading to one or more backup services.
+///
+/// Note that for every new monitor, you **must** persist the new `ChannelMonitor`
+/// to disk/backups. And, on every update, you **must** persist either the
+/// `ChannelMonitorUpdate` or the updated monitor itself. Otherwise, there is risk
+/// of situations such as revoking a transaction, then crashing before this
+/// revocation can be persisted, then unintentionally broadcasting a revoked
+/// transaction and losing money. This is a risk because previous channel states
+/// are toxic, so it's important that whatever channel state is persisted is
+/// kept up-to-date.
+#[repr(C)]
+pub struct Persist {
+       pub this_arg: *mut c_void,
+       /// Persist a new channel's data. The data can be stored any way you want, but
+       /// the identifier provided by Rust-Lightning is the channel's outpoint (and
+       /// it is up to you to maintain a correct mapping between the outpoint and the
+       /// stored channel data). Note that you **must** persist every new monitor to
+       /// disk. See the `Persist` trait documentation for more details.
+       ///
+       /// See [`ChannelMonitor::serialize_for_disk`] for writing out a `ChannelMonitor`,
+       /// and [`ChannelMonitorUpdateErr`] for requirements when returning errors.
+       ///
+       /// [`ChannelMonitor::serialize_for_disk`]: struct.ChannelMonitor.html#method.serialize_for_disk
+       /// [`ChannelMonitorUpdateErr`]: enum.ChannelMonitorUpdateErr.html
+       #[must_use]
+       pub persist_new_channel: extern "C" fn (this_arg: *const c_void, id: crate::chain::transaction::OutPoint, data: &crate::chain::channelmonitor::ChannelMonitor) -> crate::c_types::derived::CResult_NoneChannelMonitorUpdateErrZ,
+       /// Update one channel's data. The provided `ChannelMonitor` has already
+       /// applied the given update.
+       ///
+       /// Note that on every update, you **must** persist either the
+       /// `ChannelMonitorUpdate` or the updated monitor itself to disk/backups. See
+       /// the `Persist` trait documentation for more details.
+       ///
+       /// If an implementer chooses to persist the updates only, they need to make
+       /// sure that all the updates are applied to the `ChannelMonitors` *before*
+       /// the set of channel monitors is given to the `ChannelManager`
+       /// deserialization routine. See [`ChannelMonitor::update_monitor`] for
+       /// applying a monitor update to a monitor. If full `ChannelMonitors` are
+       /// persisted, then there is no need to persist individual updates.
+       ///
+       /// Note that there could be a performance tradeoff between persisting complete
+       /// channel monitors on every update vs. persisting only updates and applying
+       /// them in batches. The size of each monitor grows `O(number of state updates)`
+       /// whereas updates are small and `O(1)`.
+       ///
+       /// See [`ChannelMonitor::serialize_for_disk`] for writing out a `ChannelMonitor`,
+       /// [`ChannelMonitorUpdate::write`] for writing out an update, and
+       /// [`ChannelMonitorUpdateErr`] for requirements when returning errors.
+       ///
+       /// [`ChannelMonitor::update_monitor`]: struct.ChannelMonitor.html#impl-1
+       /// [`ChannelMonitor::serialize_for_disk`]: struct.ChannelMonitor.html#method.serialize_for_disk
+       /// [`ChannelMonitorUpdate::write`]: struct.ChannelMonitorUpdate.html#method.write
+       /// [`ChannelMonitorUpdateErr`]: enum.ChannelMonitorUpdateErr.html
+       #[must_use]
+       pub update_persisted_channel: extern "C" fn (this_arg: *const c_void, id: crate::chain::transaction::OutPoint, update: &crate::chain::channelmonitor::ChannelMonitorUpdate, data: &crate::chain::channelmonitor::ChannelMonitor) -> crate::c_types::derived::CResult_NoneChannelMonitorUpdateErrZ,
+       pub free: Option<extern "C" fn(this_arg: *mut c_void)>,
+}
+unsafe impl Send for Persist {}
+unsafe impl Sync for Persist {}
+
+use lightning::chain::channelmonitor::Persist as rustPersist;
+impl rustPersist<crate::chain::keysinterface::ChannelKeys> for Persist {
+       fn persist_new_channel(&self, id: lightning::chain::transaction::OutPoint, data: &lightning::chain::channelmonitor::ChannelMonitor<crate::chain::keysinterface::ChannelKeys>) -> Result<(), lightning::chain::channelmonitor::ChannelMonitorUpdateErr> {
+               let mut ret = (self.persist_new_channel)(self.this_arg, crate::chain::transaction::OutPoint { inner: Box::into_raw(Box::new(id)), is_owned: true }, &crate::chain::channelmonitor::ChannelMonitor { inner: unsafe { (data as *const _) as *mut _ }, is_owned: false });
+               let mut local_ret = match ret.result_ok { true => Ok( { () /*(*unsafe { Box::from_raw(ret.contents.result.take_ptr()) })*/ }), false => Err( { (*unsafe { Box::from_raw(ret.contents.err.take_ptr()) }).into_native() })};
+               local_ret
+       }
+       fn update_persisted_channel(&self, id: lightning::chain::transaction::OutPoint, update: &lightning::chain::channelmonitor::ChannelMonitorUpdate, data: &lightning::chain::channelmonitor::ChannelMonitor<crate::chain::keysinterface::ChannelKeys>) -> Result<(), lightning::chain::channelmonitor::ChannelMonitorUpdateErr> {
+               let mut ret = (self.update_persisted_channel)(self.this_arg, crate::chain::transaction::OutPoint { inner: Box::into_raw(Box::new(id)), is_owned: true }, &crate::chain::channelmonitor::ChannelMonitorUpdate { inner: unsafe { (update as *const _) as *mut _ }, is_owned: false }, &crate::chain::channelmonitor::ChannelMonitor { inner: unsafe { (data as *const _) as *mut _ }, is_owned: false });
+               let mut local_ret = match ret.result_ok { true => Ok( { () /*(*unsafe { Box::from_raw(ret.contents.result.take_ptr()) })*/ }), false => Err( { (*unsafe { Box::from_raw(ret.contents.err.take_ptr()) }).into_native() })};
+               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 std::ops::Deref for Persist {
+       type Target = Self;
+       fn deref(&self) -> &Self {
+               self
+       }
+}
+/// Calls the free function if one is set
+#[no_mangle]
+pub extern "C" fn Persist_free(this_ptr: Persist) { }
+impl Drop for Persist {
+       fn drop(&mut self) {
+               if let Some(f) = self.free {
+                       f(self.this_arg);
+               }
+       }
+}
index 8d8a0acd129f29fd383c9fad62531a4053edc4bb..afa982bc45cfdabe65855595a130ee57856e36a5 100644 (file)
@@ -220,6 +220,10 @@ impl SpendableOutputDescriptor {
 }
 #[no_mangle]
 pub extern "C" fn SpendableOutputDescriptor_free(this_ptr: SpendableOutputDescriptor) { }
+#[no_mangle]
+pub extern "C" fn SpendableOutputDescriptor_clone(orig: &SpendableOutputDescriptor) -> SpendableOutputDescriptor {
+       orig.clone()
+}
 /// Set of lightning keys needed to operate a channel as described in BOLT 3.
 ///
 /// Signing services could be implemented on a hardware wallet. In this case,
@@ -362,26 +366,30 @@ pub struct ChannelKeys {
        pub free: Option<extern "C" fn(this_arg: *mut c_void)>,
 }
 unsafe impl Send for ChannelKeys {}
+#[no_mangle]
+pub extern "C" fn ChannelKeys_clone(orig: &ChannelKeys) -> ChannelKeys {
+       ChannelKeys {
+               this_arg: if let Some(f) = orig.clone { (f)(orig.this_arg) } else { orig.this_arg },
+               get_per_commitment_point: orig.get_per_commitment_point.clone(),
+               release_commitment_secret: orig.release_commitment_secret.clone(),
+               pubkeys: orig.pubkeys.clone(),
+               set_pubkeys: orig.set_pubkeys.clone(),
+               key_derivation_params: orig.key_derivation_params.clone(),
+               sign_counterparty_commitment: orig.sign_counterparty_commitment.clone(),
+               sign_holder_commitment: orig.sign_holder_commitment.clone(),
+               sign_holder_commitment_htlc_transactions: orig.sign_holder_commitment_htlc_transactions.clone(),
+               sign_justice_transaction: orig.sign_justice_transaction.clone(),
+               sign_counterparty_htlc_transaction: orig.sign_counterparty_htlc_transaction.clone(),
+               sign_closing_transaction: orig.sign_closing_transaction.clone(),
+               sign_channel_announcement: orig.sign_channel_announcement.clone(),
+               on_accept: orig.on_accept.clone(),
+               clone: orig.clone.clone(),
+               free: orig.free.clone(),
+       }
+}
 impl Clone for ChannelKeys {
        fn clone(&self) -> Self {
-               Self {
-               this_arg: if let Some(f) = self.clone { (f)(self.this_arg) } else { self.this_arg },
-                       get_per_commitment_point: self.get_per_commitment_point.clone(),
-                       release_commitment_secret: self.release_commitment_secret.clone(),
-                       pubkeys: self.pubkeys.clone(),
-                       set_pubkeys: self.set_pubkeys.clone(),
-                       key_derivation_params: self.key_derivation_params.clone(),
-                       sign_counterparty_commitment: self.sign_counterparty_commitment.clone(),
-                       sign_holder_commitment: self.sign_holder_commitment.clone(),
-                       sign_holder_commitment_htlc_transactions: self.sign_holder_commitment_htlc_transactions.clone(),
-                       sign_justice_transaction: self.sign_justice_transaction.clone(),
-                       sign_counterparty_htlc_transaction: self.sign_counterparty_htlc_transaction.clone(),
-                       sign_closing_transaction: self.sign_closing_transaction.clone(),
-                       sign_channel_announcement: self.sign_channel_announcement.clone(),
-                       on_accept: self.on_accept.clone(),
-                       clone: self.clone.clone(),
-                       free: self.free.clone(),
-               }
+               ChannelKeys_clone(self)
        }
 }
 
@@ -591,6 +599,10 @@ impl Clone for InMemoryChannelKeys {
 pub(crate) extern "C" fn InMemoryChannelKeys_clone_void(this_ptr: *const c_void) -> *mut c_void {
        Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeInMemoryChannelKeys)).clone() })) as *mut c_void
 }
+#[no_mangle]
+pub extern "C" fn InMemoryChannelKeys_clone(orig: &InMemoryChannelKeys) -> InMemoryChannelKeys {
+       InMemoryChannelKeys { inner: Box::into_raw(Box::new(unsafe { &*orig.inner }.clone())), is_owned: true }
+}
 /// Private key of anchor tx
 #[no_mangle]
 pub extern "C" fn InMemoryChannelKeys_get_funding_key(this_ptr: &InMemoryChannelKeys) -> *const [u8; 32] {
index cbfa6074ada4f2f3055c733784c0a0a5e3552570..6ea4d99db9df9e403b29f8aa8f4a52ede7df17d4 100644 (file)
@@ -52,6 +52,10 @@ impl AccessError {
                }
        }
 }
+#[no_mangle]
+pub extern "C" fn AccessError_clone(orig: &AccessError) -> AccessError {
+       orig.clone()
+}
 /// The `Access` trait defines behavior for accessing chain data and state, such as blocks and
 /// UTXOs.
 #[repr(C)]
index 9d099cb6939f52a664e2d66fce645a1841ce5977..3a35c4727f937183018e304786e6cf4029c2fda4 100644 (file)
@@ -58,6 +58,10 @@ impl Clone for OutPoint {
 pub(crate) extern "C" fn OutPoint_clone_void(this_ptr: *const c_void) -> *mut c_void {
        Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeOutPoint)).clone() })) as *mut c_void
 }
+#[no_mangle]
+pub extern "C" fn OutPoint_clone(orig: &OutPoint) -> OutPoint {
+       OutPoint { inner: Box::into_raw(Box::new(unsafe { &*orig.inner }.clone())), is_owned: true }
+}
 /// The referenced transaction's txid.
 #[no_mangle]
 pub extern "C" fn OutPoint_get_txid(this_ptr: &OutPoint) -> *const [u8; 32] {
index 038ad71c051d27f53e36f683ea4bcf3d70c0e2f3..f9e6c407ef036df18c28e437c1d18ea2bec19543 100644 (file)
@@ -133,6 +133,10 @@ impl Clone for TxCreationKeys {
 pub(crate) extern "C" fn TxCreationKeys_clone_void(this_ptr: *const c_void) -> *mut c_void {
        Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeTxCreationKeys)).clone() })) as *mut c_void
 }
+#[no_mangle]
+pub extern "C" fn TxCreationKeys_clone(orig: &TxCreationKeys) -> TxCreationKeys {
+       TxCreationKeys { inner: Box::into_raw(Box::new(unsafe { &*orig.inner }.clone())), is_owned: true }
+}
 /// The broadcaster's per-commitment public key which was used to derive the other keys.
 #[no_mangle]
 pub extern "C" fn TxCreationKeys_get_per_commitment_point(this_ptr: &TxCreationKeys) -> crate::c_types::PublicKey {
@@ -256,6 +260,23 @@ impl PreCalculatedTxCreationKeys {
                ret
        }
 }
+impl Clone for PreCalculatedTxCreationKeys {
+       fn clone(&self) -> Self {
+               Self {
+                       inner: Box::into_raw(Box::new(unsafe { &*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 PreCalculatedTxCreationKeys_clone_void(this_ptr: *const c_void) -> *mut c_void {
+       Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativePreCalculatedTxCreationKeys)).clone() })) as *mut c_void
+}
+#[no_mangle]
+pub extern "C" fn PreCalculatedTxCreationKeys_clone(orig: &PreCalculatedTxCreationKeys) -> PreCalculatedTxCreationKeys {
+       PreCalculatedTxCreationKeys { inner: Box::into_raw(Box::new(unsafe { &*orig.inner }.clone())), is_owned: true }
+}
 /// Create a new PreCalculatedTxCreationKeys from TxCreationKeys
 #[must_use]
 #[no_mangle]
@@ -332,6 +353,10 @@ impl Clone for ChannelPublicKeys {
 pub(crate) extern "C" fn ChannelPublicKeys_clone_void(this_ptr: *const c_void) -> *mut c_void {
        Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChannelPublicKeys)).clone() })) as *mut c_void
 }
+#[no_mangle]
+pub extern "C" fn ChannelPublicKeys_clone(orig: &ChannelPublicKeys) -> ChannelPublicKeys {
+       ChannelPublicKeys { inner: Box::into_raw(Box::new(unsafe { &*orig.inner }.clone())), is_owned: true }
+}
 /// The public key which is used to sign all commitment transactions, as it appears in the
 /// on-chain channel lock-in 2-of-2 multisig output.
 #[no_mangle]
@@ -497,6 +522,10 @@ impl Clone for HTLCOutputInCommitment {
 pub(crate) extern "C" fn HTLCOutputInCommitment_clone_void(this_ptr: *const c_void) -> *mut c_void {
        Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeHTLCOutputInCommitment)).clone() })) as *mut c_void
 }
+#[no_mangle]
+pub extern "C" fn HTLCOutputInCommitment_clone(orig: &HTLCOutputInCommitment) -> HTLCOutputInCommitment {
+       HTLCOutputInCommitment { inner: Box::into_raw(Box::new(unsafe { &*orig.inner }.clone())), is_owned: true }
+}
 /// Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
 /// Note that this is not the same as whether it is ountbound *from us*. To determine that you
 /// need to compare this value to whether the commitment transaction in question is that of
@@ -638,6 +667,10 @@ impl Clone for HolderCommitmentTransaction {
 pub(crate) extern "C" fn HolderCommitmentTransaction_clone_void(this_ptr: *const c_void) -> *mut c_void {
        Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeHolderCommitmentTransaction)).clone() })) as *mut c_void
 }
+#[no_mangle]
+pub extern "C" fn HolderCommitmentTransaction_clone(orig: &HolderCommitmentTransaction) -> HolderCommitmentTransaction {
+       HolderCommitmentTransaction { inner: Box::into_raw(Box::new(unsafe { &*orig.inner }.clone())), is_owned: true }
+}
 /// The commitment transaction itself, in unsigned form.
 #[no_mangle]
 pub extern "C" fn HolderCommitmentTransaction_get_unsigned_tx(this_ptr: &HolderCommitmentTransaction) -> crate::c_types::Transaction {
index 7d9028a572586b66fbb62d2535d44d3ae9dc7f88..c21f26e94e05bfc2c7c3bb4069f4135293e10f5f 100644 (file)
@@ -124,6 +124,23 @@ impl ChannelDetails {
                ret
        }
 }
+impl Clone for ChannelDetails {
+       fn clone(&self) -> Self {
+               Self {
+                       inner: Box::into_raw(Box::new(unsafe { &*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 ChannelDetails_clone_void(this_ptr: *const c_void) -> *mut c_void {
+       Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChannelDetails)).clone() })) as *mut c_void
+}
+#[no_mangle]
+pub extern "C" fn ChannelDetails_clone(orig: &ChannelDetails) -> ChannelDetails {
+       ChannelDetails { inner: Box::into_raw(Box::new(unsafe { &*orig.inner }.clone())), is_owned: true }
+}
 /// The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
 /// thereafter this is the txid of the funding transaction xor the funding transaction output).
 /// Note that this means this value is *not* persistent - it can change once during the
index 6925139d69392335e62ca8176160cecc0f0a5995..401da37772c30c8afca85ccdf96b86ae0d19f8b0 100644 (file)
@@ -95,6 +95,23 @@ impl Init {
                ret
        }
 }
+impl Clone for Init {
+       fn clone(&self) -> Self {
+               Self {
+                       inner: Box::into_raw(Box::new(unsafe { &*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 Init_clone_void(this_ptr: *const c_void) -> *mut c_void {
+       Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeInit)).clone() })) as *mut c_void
+}
+#[no_mangle]
+pub extern "C" fn Init_clone(orig: &Init) -> Init {
+       Init { inner: Box::into_raw(Box::new(unsafe { &*orig.inner }.clone())), is_owned: true }
+}
 
 use lightning::ln::msgs::ErrorMessage as nativeErrorMessageImport;
 type nativeErrorMessage = nativeErrorMessageImport;
@@ -146,6 +163,10 @@ impl Clone for ErrorMessage {
 pub(crate) extern "C" fn ErrorMessage_clone_void(this_ptr: *const c_void) -> *mut c_void {
        Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeErrorMessage)).clone() })) as *mut c_void
 }
+#[no_mangle]
+pub extern "C" fn ErrorMessage_clone(orig: &ErrorMessage) -> ErrorMessage {
+       ErrorMessage { inner: Box::into_raw(Box::new(unsafe { &*orig.inner }.clone())), is_owned: true }
+}
 /// The channel ID involved in the error
 #[no_mangle]
 pub extern "C" fn ErrorMessage_get_channel_id(this_ptr: &ErrorMessage) -> *const [u8; 32] {
@@ -220,6 +241,23 @@ impl Ping {
                ret
        }
 }
+impl Clone for Ping {
+       fn clone(&self) -> Self {
+               Self {
+                       inner: Box::into_raw(Box::new(unsafe { &*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 Ping_clone_void(this_ptr: *const c_void) -> *mut c_void {
+       Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativePing)).clone() })) as *mut c_void
+}
+#[no_mangle]
+pub extern "C" fn Ping_clone(orig: &Ping) -> Ping {
+       Ping { inner: Box::into_raw(Box::new(unsafe { &*orig.inner }.clone())), is_owned: true }
+}
 /// The desired response length
 #[no_mangle]
 pub extern "C" fn Ping_get_ponglen(this_ptr: &Ping) -> u16 {
@@ -290,6 +328,23 @@ impl Pong {
                ret
        }
 }
+impl Clone for Pong {
+       fn clone(&self) -> Self {
+               Self {
+                       inner: Box::into_raw(Box::new(unsafe { &*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 Pong_clone_void(this_ptr: *const c_void) -> *mut c_void {
+       Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativePong)).clone() })) as *mut c_void
+}
+#[no_mangle]
+pub extern "C" fn Pong_clone(orig: &Pong) -> Pong {
+       Pong { inner: Box::into_raw(Box::new(unsafe { &*orig.inner }.clone())), is_owned: true }
+}
 /// The pong packet size.
 /// This field is not sent on the wire. byteslen zeros are sent.
 #[no_mangle]
@@ -361,6 +416,10 @@ impl Clone for OpenChannel {
 pub(crate) extern "C" fn OpenChannel_clone_void(this_ptr: *const c_void) -> *mut c_void {
        Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeOpenChannel)).clone() })) as *mut c_void
 }
+#[no_mangle]
+pub extern "C" fn OpenChannel_clone(orig: &OpenChannel) -> OpenChannel {
+       OpenChannel { inner: Box::into_raw(Box::new(unsafe { &*orig.inner }.clone())), is_owned: true }
+}
 /// The genesis hash of the blockchain where the channel is to be opened
 #[no_mangle]
 pub extern "C" fn OpenChannel_get_chain_hash(this_ptr: &OpenChannel) -> *const [u8; 32] {
@@ -610,6 +669,10 @@ impl Clone for AcceptChannel {
 pub(crate) extern "C" fn AcceptChannel_clone_void(this_ptr: *const c_void) -> *mut c_void {
        Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeAcceptChannel)).clone() })) as *mut c_void
 }
+#[no_mangle]
+pub extern "C" fn AcceptChannel_clone(orig: &AcceptChannel) -> AcceptChannel {
+       AcceptChannel { inner: Box::into_raw(Box::new(unsafe { &*orig.inner }.clone())), is_owned: true }
+}
 /// A temporary channel ID, until the funding outpoint is announced
 #[no_mangle]
 pub extern "C" fn AcceptChannel_get_temporary_channel_id(this_ptr: &AcceptChannel) -> *const [u8; 32] {
@@ -815,6 +878,10 @@ impl Clone for FundingCreated {
 pub(crate) extern "C" fn FundingCreated_clone_void(this_ptr: *const c_void) -> *mut c_void {
        Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeFundingCreated)).clone() })) as *mut c_void
 }
+#[no_mangle]
+pub extern "C" fn FundingCreated_clone(orig: &FundingCreated) -> FundingCreated {
+       FundingCreated { inner: Box::into_raw(Box::new(unsafe { &*orig.inner }.clone())), is_owned: true }
+}
 /// A temporary channel ID, until the funding is established
 #[no_mangle]
 pub extern "C" fn FundingCreated_get_temporary_channel_id(this_ptr: &FundingCreated) -> *const [u8; 32] {
@@ -920,6 +987,10 @@ impl Clone for FundingSigned {
 pub(crate) extern "C" fn FundingSigned_clone_void(this_ptr: *const c_void) -> *mut c_void {
        Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeFundingSigned)).clone() })) as *mut c_void
 }
+#[no_mangle]
+pub extern "C" fn FundingSigned_clone(orig: &FundingSigned) -> FundingSigned {
+       FundingSigned { inner: Box::into_raw(Box::new(unsafe { &*orig.inner }.clone())), is_owned: true }
+}
 /// The channel ID
 #[no_mangle]
 pub extern "C" fn FundingSigned_get_channel_id(this_ptr: &FundingSigned) -> *const [u8; 32] {
@@ -1001,6 +1072,10 @@ impl Clone for FundingLocked {
 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
 }
+#[no_mangle]
+pub extern "C" fn FundingLocked_clone(orig: &FundingLocked) -> FundingLocked {
+       FundingLocked { inner: Box::into_raw(Box::new(unsafe { &*orig.inner }.clone())), is_owned: true }
+}
 /// The channel ID
 #[no_mangle]
 pub extern "C" fn FundingLocked_get_channel_id(this_ptr: &FundingLocked) -> *const [u8; 32] {
@@ -1082,6 +1157,10 @@ impl Clone for Shutdown {
 pub(crate) extern "C" fn Shutdown_clone_void(this_ptr: *const c_void) -> *mut c_void {
        Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeShutdown)).clone() })) as *mut c_void
 }
+#[no_mangle]
+pub extern "C" fn Shutdown_clone(orig: &Shutdown) -> Shutdown {
+       Shutdown { inner: Box::into_raw(Box::new(unsafe { &*orig.inner }.clone())), is_owned: true }
+}
 /// The channel ID
 #[no_mangle]
 pub extern "C" fn Shutdown_get_channel_id(this_ptr: &Shutdown) -> *const [u8; 32] {
@@ -1165,6 +1244,10 @@ impl Clone for ClosingSigned {
 pub(crate) extern "C" fn ClosingSigned_clone_void(this_ptr: *const c_void) -> *mut c_void {
        Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeClosingSigned)).clone() })) as *mut c_void
 }
+#[no_mangle]
+pub extern "C" fn ClosingSigned_clone(orig: &ClosingSigned) -> ClosingSigned {
+       ClosingSigned { inner: Box::into_raw(Box::new(unsafe { &*orig.inner }.clone())), is_owned: true }
+}
 /// The channel ID
 #[no_mangle]
 pub extern "C" fn ClosingSigned_get_channel_id(this_ptr: &ClosingSigned) -> *const [u8; 32] {
@@ -1258,6 +1341,10 @@ impl Clone for UpdateAddHTLC {
 pub(crate) extern "C" fn UpdateAddHTLC_clone_void(this_ptr: *const c_void) -> *mut c_void {
        Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeUpdateAddHTLC)).clone() })) as *mut c_void
 }
+#[no_mangle]
+pub extern "C" fn UpdateAddHTLC_clone(orig: &UpdateAddHTLC) -> UpdateAddHTLC {
+       UpdateAddHTLC { inner: Box::into_raw(Box::new(unsafe { &*orig.inner }.clone())), is_owned: true }
+}
 /// The channel ID
 #[no_mangle]
 pub extern "C" fn UpdateAddHTLC_get_channel_id(this_ptr: &UpdateAddHTLC) -> *const [u8; 32] {
@@ -1364,6 +1451,10 @@ impl Clone for UpdateFulfillHTLC {
 pub(crate) extern "C" fn UpdateFulfillHTLC_clone_void(this_ptr: *const c_void) -> *mut c_void {
        Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeUpdateFulfillHTLC)).clone() })) as *mut c_void
 }
+#[no_mangle]
+pub extern "C" fn UpdateFulfillHTLC_clone(orig: &UpdateFulfillHTLC) -> UpdateFulfillHTLC {
+       UpdateFulfillHTLC { inner: Box::into_raw(Box::new(unsafe { &*orig.inner }.clone())), is_owned: true }
+}
 /// The channel ID
 #[no_mangle]
 pub extern "C" fn UpdateFulfillHTLC_get_channel_id(this_ptr: &UpdateFulfillHTLC) -> *const [u8; 32] {
@@ -1457,6 +1548,10 @@ impl Clone for UpdateFailHTLC {
 pub(crate) extern "C" fn UpdateFailHTLC_clone_void(this_ptr: *const c_void) -> *mut c_void {
        Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeUpdateFailHTLC)).clone() })) as *mut c_void
 }
+#[no_mangle]
+pub extern "C" fn UpdateFailHTLC_clone(orig: &UpdateFailHTLC) -> UpdateFailHTLC {
+       UpdateFailHTLC { inner: Box::into_raw(Box::new(unsafe { &*orig.inner }.clone())), is_owned: true }
+}
 /// The channel ID
 #[no_mangle]
 pub extern "C" fn UpdateFailHTLC_get_channel_id(this_ptr: &UpdateFailHTLC) -> *const [u8; 32] {
@@ -1530,6 +1625,10 @@ impl Clone for UpdateFailMalformedHTLC {
 pub(crate) extern "C" fn UpdateFailMalformedHTLC_clone_void(this_ptr: *const c_void) -> *mut c_void {
        Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeUpdateFailMalformedHTLC)).clone() })) as *mut c_void
 }
+#[no_mangle]
+pub extern "C" fn UpdateFailMalformedHTLC_clone(orig: &UpdateFailMalformedHTLC) -> UpdateFailMalformedHTLC {
+       UpdateFailMalformedHTLC { inner: Box::into_raw(Box::new(unsafe { &*orig.inner }.clone())), is_owned: true }
+}
 /// The channel ID
 #[no_mangle]
 pub extern "C" fn UpdateFailMalformedHTLC_get_channel_id(this_ptr: &UpdateFailMalformedHTLC) -> *const [u8; 32] {
@@ -1614,6 +1713,10 @@ impl Clone for CommitmentSigned {
 pub(crate) extern "C" fn CommitmentSigned_clone_void(this_ptr: *const c_void) -> *mut c_void {
        Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeCommitmentSigned)).clone() })) as *mut c_void
 }
+#[no_mangle]
+pub extern "C" fn CommitmentSigned_clone(orig: &CommitmentSigned) -> CommitmentSigned {
+       CommitmentSigned { inner: Box::into_raw(Box::new(unsafe { &*orig.inner }.clone())), is_owned: true }
+}
 /// The channel ID
 #[no_mangle]
 pub extern "C" fn CommitmentSigned_get_channel_id(this_ptr: &CommitmentSigned) -> *const [u8; 32] {
@@ -1703,6 +1806,10 @@ impl Clone for RevokeAndACK {
 pub(crate) extern "C" fn RevokeAndACK_clone_void(this_ptr: *const c_void) -> *mut c_void {
        Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeRevokeAndACK)).clone() })) as *mut c_void
 }
+#[no_mangle]
+pub extern "C" fn RevokeAndACK_clone(orig: &RevokeAndACK) -> RevokeAndACK {
+       RevokeAndACK { inner: Box::into_raw(Box::new(unsafe { &*orig.inner }.clone())), is_owned: true }
+}
 /// The channel ID
 #[no_mangle]
 pub extern "C" fn RevokeAndACK_get_channel_id(this_ptr: &RevokeAndACK) -> *const [u8; 32] {
@@ -1796,6 +1903,10 @@ impl Clone for UpdateFee {
 pub(crate) extern "C" fn UpdateFee_clone_void(this_ptr: *const c_void) -> *mut c_void {
        Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeUpdateFee)).clone() })) as *mut c_void
 }
+#[no_mangle]
+pub extern "C" fn UpdateFee_clone(orig: &UpdateFee) -> UpdateFee {
+       UpdateFee { inner: Box::into_raw(Box::new(unsafe { &*orig.inner }.clone())), is_owned: true }
+}
 /// The channel ID
 #[no_mangle]
 pub extern "C" fn UpdateFee_get_channel_id(this_ptr: &UpdateFee) -> *const [u8; 32] {
@@ -1880,6 +1991,10 @@ impl Clone for DataLossProtect {
 pub(crate) extern "C" fn DataLossProtect_clone_void(this_ptr: *const c_void) -> *mut c_void {
        Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeDataLossProtect)).clone() })) as *mut c_void
 }
+#[no_mangle]
+pub extern "C" fn DataLossProtect_clone(orig: &DataLossProtect) -> DataLossProtect {
+       DataLossProtect { inner: Box::into_raw(Box::new(unsafe { &*orig.inner }.clone())), is_owned: true }
+}
 /// Proof that the sender knows the per-commitment secret of a specific commitment transaction
 /// belonging to the recipient
 #[no_mangle]
@@ -1963,6 +2078,10 @@ impl Clone for ChannelReestablish {
 pub(crate) extern "C" fn ChannelReestablish_clone_void(this_ptr: *const c_void) -> *mut c_void {
        Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChannelReestablish)).clone() })) as *mut c_void
 }
+#[no_mangle]
+pub extern "C" fn ChannelReestablish_clone(orig: &ChannelReestablish) -> ChannelReestablish {
+       ChannelReestablish { inner: Box::into_raw(Box::new(unsafe { &*orig.inner }.clone())), is_owned: true }
+}
 /// The channel ID
 #[no_mangle]
 pub extern "C" fn ChannelReestablish_get_channel_id(this_ptr: &ChannelReestablish) -> *const [u8; 32] {
@@ -2047,6 +2166,10 @@ impl Clone for AnnouncementSignatures {
 pub(crate) extern "C" fn AnnouncementSignatures_clone_void(this_ptr: *const c_void) -> *mut c_void {
        Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeAnnouncementSignatures)).clone() })) as *mut c_void
 }
+#[no_mangle]
+pub extern "C" fn AnnouncementSignatures_clone(orig: &AnnouncementSignatures) -> AnnouncementSignatures {
+       AnnouncementSignatures { inner: Box::into_raw(Box::new(unsafe { &*orig.inner }.clone())), is_owned: true }
+}
 /// The channel ID
 #[no_mangle]
 pub extern "C" fn AnnouncementSignatures_get_channel_id(this_ptr: &AnnouncementSignatures) -> *const [u8; 32] {
@@ -2280,6 +2403,10 @@ impl NetAddress {
 }
 #[no_mangle]
 pub extern "C" fn NetAddress_free(this_ptr: NetAddress) { }
+#[no_mangle]
+pub extern "C" fn NetAddress_clone(orig: &NetAddress) -> NetAddress {
+       orig.clone()
+}
 
 use lightning::ln::msgs::UnsignedNodeAnnouncement as nativeUnsignedNodeAnnouncementImport;
 type nativeUnsignedNodeAnnouncement = nativeUnsignedNodeAnnouncementImport;
@@ -2331,6 +2458,10 @@ impl Clone for UnsignedNodeAnnouncement {
 pub(crate) extern "C" fn UnsignedNodeAnnouncement_clone_void(this_ptr: *const c_void) -> *mut c_void {
        Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeUnsignedNodeAnnouncement)).clone() })) as *mut c_void
 }
+#[no_mangle]
+pub extern "C" fn UnsignedNodeAnnouncement_clone(orig: &UnsignedNodeAnnouncement) -> UnsignedNodeAnnouncement {
+       UnsignedNodeAnnouncement { inner: Box::into_raw(Box::new(unsafe { &*orig.inner }.clone())), is_owned: true }
+}
 /// The advertised features
 #[no_mangle]
 pub extern "C" fn UnsignedNodeAnnouncement_get_features(this_ptr: &UnsignedNodeAnnouncement) -> crate::ln::features::NodeFeatures {
@@ -2447,6 +2578,10 @@ impl Clone for NodeAnnouncement {
 pub(crate) extern "C" fn NodeAnnouncement_clone_void(this_ptr: *const c_void) -> *mut c_void {
        Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeNodeAnnouncement)).clone() })) as *mut c_void
 }
+#[no_mangle]
+pub extern "C" fn NodeAnnouncement_clone(orig: &NodeAnnouncement) -> NodeAnnouncement {
+       NodeAnnouncement { inner: Box::into_raw(Box::new(unsafe { &*orig.inner }.clone())), is_owned: true }
+}
 /// The signature by the node key
 #[no_mangle]
 pub extern "C" fn NodeAnnouncement_get_signature(this_ptr: &NodeAnnouncement) -> crate::c_types::Signature {
@@ -2528,6 +2663,10 @@ impl Clone for UnsignedChannelAnnouncement {
 pub(crate) extern "C" fn UnsignedChannelAnnouncement_clone_void(this_ptr: *const c_void) -> *mut c_void {
        Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeUnsignedChannelAnnouncement)).clone() })) as *mut c_void
 }
+#[no_mangle]
+pub extern "C" fn UnsignedChannelAnnouncement_clone(orig: &UnsignedChannelAnnouncement) -> UnsignedChannelAnnouncement {
+       UnsignedChannelAnnouncement { inner: Box::into_raw(Box::new(unsafe { &*orig.inner }.clone())), is_owned: true }
+}
 /// The advertised channel features
 #[no_mangle]
 pub extern "C" fn UnsignedChannelAnnouncement_get_features(this_ptr: &UnsignedChannelAnnouncement) -> crate::ln::features::ChannelFeatures {
@@ -2656,6 +2795,10 @@ impl Clone for ChannelAnnouncement {
 pub(crate) extern "C" fn ChannelAnnouncement_clone_void(this_ptr: *const c_void) -> *mut c_void {
        Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChannelAnnouncement)).clone() })) as *mut c_void
 }
+#[no_mangle]
+pub extern "C" fn ChannelAnnouncement_clone(orig: &ChannelAnnouncement) -> ChannelAnnouncement {
+       ChannelAnnouncement { inner: Box::into_raw(Box::new(unsafe { &*orig.inner }.clone())), is_owned: true }
+}
 /// Authentication of the announcement by the first public node
 #[no_mangle]
 pub extern "C" fn ChannelAnnouncement_get_node_signature_1(this_ptr: &ChannelAnnouncement) -> crate::c_types::Signature {
@@ -2773,6 +2916,10 @@ impl Clone for UnsignedChannelUpdate {
 pub(crate) extern "C" fn UnsignedChannelUpdate_clone_void(this_ptr: *const c_void) -> *mut c_void {
        Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeUnsignedChannelUpdate)).clone() })) as *mut c_void
 }
+#[no_mangle]
+pub extern "C" fn UnsignedChannelUpdate_clone(orig: &UnsignedChannelUpdate) -> UnsignedChannelUpdate {
+       UnsignedChannelUpdate { inner: Box::into_raw(Box::new(unsafe { &*orig.inner }.clone())), is_owned: true }
+}
 /// The genesis hash of the blockchain where the channel is to be opened
 #[no_mangle]
 pub extern "C" fn UnsignedChannelUpdate_get_chain_hash(this_ptr: &UnsignedChannelUpdate) -> *const [u8; 32] {
@@ -2912,6 +3059,10 @@ impl Clone for ChannelUpdate {
 pub(crate) extern "C" fn ChannelUpdate_clone_void(this_ptr: *const c_void) -> *mut c_void {
        Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChannelUpdate)).clone() })) as *mut c_void
 }
+#[no_mangle]
+pub extern "C" fn ChannelUpdate_clone(orig: &ChannelUpdate) -> ChannelUpdate {
+       ChannelUpdate { inner: Box::into_raw(Box::new(unsafe { &*orig.inner }.clone())), is_owned: true }
+}
 /// A signature of the channel update
 #[no_mangle]
 pub extern "C" fn ChannelUpdate_get_signature(this_ptr: &ChannelUpdate) -> crate::c_types::Signature {
@@ -2996,6 +3147,10 @@ impl Clone for QueryChannelRange {
 pub(crate) extern "C" fn QueryChannelRange_clone_void(this_ptr: *const c_void) -> *mut c_void {
        Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeQueryChannelRange)).clone() })) as *mut c_void
 }
+#[no_mangle]
+pub extern "C" fn QueryChannelRange_clone(orig: &QueryChannelRange) -> QueryChannelRange {
+       QueryChannelRange { inner: Box::into_raw(Box::new(unsafe { &*orig.inner }.clone())), is_owned: true }
+}
 /// The genesis hash of the blockchain being queried
 #[no_mangle]
 pub extern "C" fn QueryChannelRange_get_chain_hash(this_ptr: &QueryChannelRange) -> *const [u8; 32] {
@@ -3095,6 +3250,10 @@ impl Clone for ReplyChannelRange {
 pub(crate) extern "C" fn ReplyChannelRange_clone_void(this_ptr: *const c_void) -> *mut c_void {
        Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeReplyChannelRange)).clone() })) as *mut c_void
 }
+#[no_mangle]
+pub extern "C" fn ReplyChannelRange_clone(orig: &ReplyChannelRange) -> ReplyChannelRange {
+       ReplyChannelRange { inner: Box::into_raw(Box::new(unsafe { &*orig.inner }.clone())), is_owned: true }
+}
 /// The genesis hash of the blockchain being queried
 #[no_mangle]
 pub extern "C" fn ReplyChannelRange_get_chain_hash(this_ptr: &ReplyChannelRange) -> *const [u8; 32] {
@@ -3217,6 +3376,10 @@ impl Clone for QueryShortChannelIds {
 pub(crate) extern "C" fn QueryShortChannelIds_clone_void(this_ptr: *const c_void) -> *mut c_void {
        Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeQueryShortChannelIds)).clone() })) as *mut c_void
 }
+#[no_mangle]
+pub extern "C" fn QueryShortChannelIds_clone(orig: &QueryShortChannelIds) -> QueryShortChannelIds {
+       QueryShortChannelIds { inner: Box::into_raw(Box::new(unsafe { &*orig.inner }.clone())), is_owned: true }
+}
 /// The genesis hash of the blockchain being queried
 #[no_mangle]
 pub extern "C" fn QueryShortChannelIds_get_chain_hash(this_ptr: &QueryShortChannelIds) -> *const [u8; 32] {
@@ -3297,6 +3460,10 @@ impl Clone for ReplyShortChannelIdsEnd {
 pub(crate) extern "C" fn ReplyShortChannelIdsEnd_clone_void(this_ptr: *const c_void) -> *mut c_void {
        Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeReplyShortChannelIdsEnd)).clone() })) as *mut c_void
 }
+#[no_mangle]
+pub extern "C" fn ReplyShortChannelIdsEnd_clone(orig: &ReplyShortChannelIdsEnd) -> ReplyShortChannelIdsEnd {
+       ReplyShortChannelIdsEnd { inner: Box::into_raw(Box::new(unsafe { &*orig.inner }.clone())), is_owned: true }
+}
 /// The genesis hash of the blockchain that was queried
 #[no_mangle]
 pub extern "C" fn ReplyShortChannelIdsEnd_get_chain_hash(this_ptr: &ReplyShortChannelIdsEnd) -> *const [u8; 32] {
@@ -3382,6 +3549,10 @@ impl Clone for GossipTimestampFilter {
 pub(crate) extern "C" fn GossipTimestampFilter_clone_void(this_ptr: *const c_void) -> *mut c_void {
        Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeGossipTimestampFilter)).clone() })) as *mut c_void
 }
+#[no_mangle]
+pub extern "C" fn GossipTimestampFilter_clone(orig: &GossipTimestampFilter) -> GossipTimestampFilter {
+       GossipTimestampFilter { inner: Box::into_raw(Box::new(unsafe { &*orig.inner }.clone())), is_owned: true }
+}
 /// The genesis hash of the blockchain for channel and node information
 #[no_mangle]
 pub extern "C" fn GossipTimestampFilter_get_chain_hash(this_ptr: &GossipTimestampFilter) -> *const [u8; 32] {
@@ -3517,6 +3688,10 @@ impl ErrorAction {
 }
 #[no_mangle]
 pub extern "C" fn ErrorAction_free(this_ptr: ErrorAction) { }
+#[no_mangle]
+pub extern "C" fn ErrorAction_clone(orig: &ErrorAction) -> ErrorAction {
+       orig.clone()
+}
 
 use lightning::ln::msgs::LightningError as nativeLightningErrorImport;
 type nativeLightningError = nativeLightningErrorImport;
@@ -3637,6 +3812,10 @@ impl Clone for CommitmentUpdate {
 pub(crate) extern "C" fn CommitmentUpdate_clone_void(this_ptr: *const c_void) -> *mut c_void {
        Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeCommitmentUpdate)).clone() })) as *mut c_void
 }
+#[no_mangle]
+pub extern "C" fn CommitmentUpdate_clone(orig: &CommitmentUpdate) -> CommitmentUpdate {
+       CommitmentUpdate { inner: Box::into_raw(Box::new(unsafe { &*orig.inner }.clone())), is_owned: true }
+}
 /// update_add_htlc messages which should be sent
 #[no_mangle]
 pub extern "C" fn CommitmentUpdate_set_update_add_htlcs(this_ptr: &mut CommitmentUpdate, mut val: crate::c_types::derived::CVec_UpdateAddHTLCZ) {
@@ -3827,6 +4006,10 @@ impl HTLCFailChannelUpdate {
 }
 #[no_mangle]
 pub extern "C" fn HTLCFailChannelUpdate_free(this_ptr: HTLCFailChannelUpdate) { }
+#[no_mangle]
+pub extern "C" fn HTLCFailChannelUpdate_clone(orig: &HTLCFailChannelUpdate) -> HTLCFailChannelUpdate {
+       orig.clone()
+}
 /// A trait to describe an object which can receive channel messages.
 ///
 /// Messages MAY be called in parallel when they originate from different their_node_ids, however
index e4c8b59b1b45a78018335434b07ca609fe574cf0..50e1c3696a8d222e0017a2e6309e8fc2408c0f02 100644 (file)
@@ -118,29 +118,33 @@ pub struct SocketDescriptor {
        /// though races may occur whereby disconnect_socket is called after a call to
        /// socket_disconnected but prior to socket_disconnected returning.
        pub disconnect_socket: extern "C" fn (this_arg: *mut c_void),
-       pub eq: extern "C" fn (this_arg: *const c_void, other_arg: *const c_void) -> bool,
+       pub eq: extern "C" fn (this_arg: *const c_void, other_arg: &SocketDescriptor) -> bool,
        pub hash: extern "C" fn (this_arg: *const c_void) -> u64,
        pub clone: Option<extern "C" fn (this_arg: *const c_void) -> *mut c_void>,
        pub free: Option<extern "C" fn(this_arg: *mut c_void)>,
 }
 impl std::cmp::Eq for SocketDescriptor {}
 impl std::cmp::PartialEq for SocketDescriptor {
-       fn eq(&self, o: &Self) -> bool { (self.eq)(self.this_arg, o.this_arg) }
+       fn eq(&self, o: &Self) -> bool { (self.eq)(self.this_arg, o) }
 }
 impl std::hash::Hash for SocketDescriptor {
        fn hash<H: std::hash::Hasher>(&self, hasher: &mut H) { hasher.write_u64((self.hash)(self.this_arg)) }
 }
+#[no_mangle]
+pub extern "C" fn SocketDescriptor_clone(orig: &SocketDescriptor) -> SocketDescriptor {
+       SocketDescriptor {
+               this_arg: if let Some(f) = orig.clone { (f)(orig.this_arg) } else { orig.this_arg },
+               send_data: orig.send_data.clone(),
+               disconnect_socket: orig.disconnect_socket.clone(),
+               eq: orig.eq.clone(),
+               hash: orig.hash.clone(),
+               clone: orig.clone.clone(),
+               free: orig.free.clone(),
+       }
+}
 impl Clone for SocketDescriptor {
        fn clone(&self) -> Self {
-               Self {
-               this_arg: if let Some(f) = self.clone { (f)(self.this_arg) } else { self.this_arg },
-                       send_data: self.send_data.clone(),
-                       disconnect_socket: self.disconnect_socket.clone(),
-                       eq: self.eq.clone(),
-                       hash: self.hash.clone(),
-                       clone: self.clone.clone(),
-                       free: self.free.clone(),
-               }
+               SocketDescriptor_clone(self)
        }
 }
 
index c2930f0f335a12ff575b854e1fd104c5e59df6aa..11eb92a363a1dca996418ee29399361feb3ab7a0 100644 (file)
@@ -517,6 +517,10 @@ impl Clone for RoutingFees {
 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]
+pub extern "C" fn RoutingFees_clone(orig: &RoutingFees) -> RoutingFees {
+       RoutingFees { inner: Box::into_raw(Box::new(unsafe { &*orig.inner }.clone())), is_owned: true }
+}
 /// Flat routing fee in satoshis
 #[no_mangle]
 pub extern "C" fn RoutingFees_get_base_msat(this_ptr: &RoutingFees) -> u32 {
index 2195fe47daa17e7aac00620535e30c98232fb9f5..8be9528330d2ae41b1b8ba87704690d150b5277a 100644 (file)
@@ -58,6 +58,10 @@ impl Clone for RouteHop {
 pub(crate) extern "C" fn RouteHop_clone_void(this_ptr: *const c_void) -> *mut c_void {
        Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeRouteHop)).clone() })) as *mut c_void
 }
+#[no_mangle]
+pub extern "C" fn RouteHop_clone(orig: &RouteHop) -> RouteHop {
+       RouteHop { inner: Box::into_raw(Box::new(unsafe { &*orig.inner }.clone())), is_owned: true }
+}
 /// The node_id of the node at this hop.
 #[no_mangle]
 pub extern "C" fn RouteHop_get_pubkey(this_ptr: &RouteHop) -> crate::c_types::PublicKey {
@@ -194,6 +198,10 @@ impl Clone for Route {
 pub(crate) extern "C" fn Route_clone_void(this_ptr: *const c_void) -> *mut c_void {
        Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeRoute)).clone() })) as *mut c_void
 }
+#[no_mangle]
+pub extern "C" fn Route_clone(orig: &Route) -> Route {
+       Route { inner: Box::into_raw(Box::new(unsafe { &*orig.inner }.clone())), is_owned: true }
+}
 /// 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
@@ -263,6 +271,23 @@ impl RouteHint {
                ret
        }
 }
+impl Clone for RouteHint {
+       fn clone(&self) -> Self {
+               Self {
+                       inner: Box::into_raw(Box::new(unsafe { &*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 RouteHint_clone_void(this_ptr: *const c_void) -> *mut c_void {
+       Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeRouteHint)).clone() })) as *mut c_void
+}
+#[no_mangle]
+pub extern "C" fn RouteHint_clone(orig: &RouteHint) -> RouteHint {
+       RouteHint { inner: Box::into_raw(Box::new(unsafe { &*orig.inner }.clone())), is_owned: true }
+}
 /// The node_id of the non-target end of the route
 #[no_mangle]
 pub extern "C" fn RouteHint_get_src_node_id(this_ptr: &RouteHint) -> crate::c_types::PublicKey {
index 30a42708f705f7b65a865da9f298c3c97ab8961b..346ddc344a1a70f174cabc29c0e6b63767dc9f74 100644 (file)
@@ -58,6 +58,10 @@ impl Clone for ChannelHandshakeConfig {
 pub(crate) extern "C" fn ChannelHandshakeConfig_clone_void(this_ptr: *const c_void) -> *mut c_void {
        Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChannelHandshakeConfig)).clone() })) as *mut c_void
 }
+#[no_mangle]
+pub extern "C" fn ChannelHandshakeConfig_clone(orig: &ChannelHandshakeConfig) -> ChannelHandshakeConfig {
+       ChannelHandshakeConfig { inner: Box::into_raw(Box::new(unsafe { &*orig.inner }.clone())), is_owned: true }
+}
 /// Confirmations we will wait for before considering the channel locked in.
 /// Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
 /// equivalent limit applied to outbound channels).
@@ -208,6 +212,10 @@ impl Clone for ChannelHandshakeLimits {
 pub(crate) extern "C" fn ChannelHandshakeLimits_clone_void(this_ptr: *const c_void) -> *mut c_void {
        Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChannelHandshakeLimits)).clone() })) as *mut c_void
 }
+#[no_mangle]
+pub extern "C" fn ChannelHandshakeLimits_clone(orig: &ChannelHandshakeLimits) -> ChannelHandshakeLimits {
+       ChannelHandshakeLimits { inner: Box::into_raw(Box::new(unsafe { &*orig.inner }.clone())), is_owned: true }
+}
 /// Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
 /// only applies to inbound channels.
 ///
@@ -477,6 +485,10 @@ impl Clone for ChannelConfig {
 pub(crate) extern "C" fn ChannelConfig_clone_void(this_ptr: *const c_void) -> *mut c_void {
        Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChannelConfig)).clone() })) as *mut c_void
 }
+#[no_mangle]
+pub extern "C" fn ChannelConfig_clone(orig: &ChannelConfig) -> ChannelConfig {
+       ChannelConfig { inner: Box::into_raw(Box::new(unsafe { &*orig.inner }.clone())), is_owned: true }
+}
 /// Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
 /// This may be allowed to change at runtime in a later update, however doing so must result in
 /// update messages sent to notify all nodes of our updated relay fee.
@@ -638,6 +650,10 @@ impl Clone for UserConfig {
 pub(crate) extern "C" fn UserConfig_clone_void(this_ptr: *const c_void) -> *mut c_void {
        Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeUserConfig)).clone() })) as *mut c_void
 }
+#[no_mangle]
+pub extern "C" fn UserConfig_clone(orig: &UserConfig) -> UserConfig {
+       UserConfig { inner: Box::into_raw(Box::new(unsafe { &*orig.inner }.clone())), is_owned: true }
+}
 /// Channel config that we propose to our counterparty.
 #[no_mangle]
 pub extern "C" fn UserConfig_get_own_channel_config(this_ptr: &UserConfig) -> crate::util::config::ChannelHandshakeConfig {
index 06cb4a7f879ab6318fc9aad25bf2244dfffefdbf..9b0e757de971217a60fdb9925872f3a1bbd68f6a 100644 (file)
@@ -160,3 +160,7 @@ impl APIError {
 }
 #[no_mangle]
 pub extern "C" fn APIError_free(this_ptr: APIError) { }
+#[no_mangle]
+pub extern "C" fn APIError_clone(orig: &APIError) -> APIError {
+       orig.clone()
+}
index db8ac33f8f60fbee426aa72a2e64a6d00f0746d9..e596774b6c137253f0216c365299a32d58c1bef4 100644 (file)
@@ -308,6 +308,10 @@ impl Event {
 }
 #[no_mangle]
 pub extern "C" fn Event_free(this_ptr: Event) { }
+#[no_mangle]
+pub extern "C" fn Event_clone(orig: &Event) -> Event {
+       orig.clone()
+}
 /// 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.
@@ -859,6 +863,10 @@ impl MessageSendEvent {
 }
 #[no_mangle]
 pub extern "C" fn MessageSendEvent_free(this_ptr: MessageSendEvent) { }
+#[no_mangle]
+pub extern "C" fn MessageSendEvent_clone(orig: &MessageSendEvent) -> MessageSendEvent {
+       orig.clone()
+}
 /// A trait indicating an object may generate message send events
 #[repr(C)]
 pub struct MessageSendEventsProvider {
index ae20abbb6aec25c44a780dc1dc096ee76b4a089d..8a1fbb15d54340e37dccf5b0f6592a6020659681 100644 (file)
@@ -74,6 +74,10 @@ impl Level {
                }
        }
 }
+#[no_mangle]
+pub extern "C" fn Level_clone(orig: &Level) -> Level {
+       orig.clone()
+}
 /// Returns the most verbose logging level.
 #[must_use]
 #[no_mangle]