Update bindings to latest upstream code
authorMatt Corallo <git@bluematt.me>
Fri, 2 Oct 2020 02:21:19 +0000 (22:21 -0400)
committerMatt Corallo <git@bluematt.me>
Wed, 21 Oct 2020 18:54:51 +0000 (14:54 -0400)
18 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 [new file with mode: 0644]
lightning-c-bindings/src/chain/channelmonitor.rs [new file with mode: 0644]
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/channelmonitor.rs [deleted file]
lightning-c-bindings/src/ln/mod.rs
lightning-c-bindings/src/ln/msgs.rs
lightning-c-bindings/src/routing/network_graph.rs
lightning-c-bindings/src/routing/router.rs
lightning-c-bindings/src/util/errors.rs

index 7c4be60daa8d749de2c6957bc72758517711818d..c77027611fa24225dfa5068850e360d3062668a7 100644 (file)
 #include <stdlib.h>
 
 /**
- * Used to give chain error details upstream
+ * An error when accessing the chain via [`Access`].
+ *
+ * [`Access`]: trait.Access.html
  */
-typedef enum LDKChainError {
-   /**
-    * Client doesn't support UTXO lookup (but the chain hash matches our genesis block hash)
-    */
-   LDKChainError_NotSupported,
+typedef enum LDKAccessError {
    /**
-    * Chain isn't the one watched
+    * The requested chain is unknown.
     */
-   LDKChainError_NotWatched,
+   LDKAccessError_UnknownChain,
    /**
-    * Tx doesn't exist or is unconfirmed
+    * The requested transaction doesn't exist or hasn't confirmed.
     */
-   LDKChainError_UnknownTx,
+   LDKAccessError_UnknownTx,
    /**
     * Must be last for serialization purposes
     */
-   LDKChainError_Sentinel,
-} LDKChainError;
+   LDKAccessError_Sentinel,
+} LDKAccessError;
 
 /**
  * An error enum representing a failure to persist a channel monitor update.
@@ -88,6 +86,11 @@ typedef enum LDKChannelMonitorUpdateErr {
     * Note that even when you fail a holder commitment transaction update, you must store the
     * update to ensure you can claim from it in case of a duplicate copy of this ChannelMonitor
     * broadcasts it (e.g distributed channel-monitor deployment)
+    *
+    * In case of distributed watchtowers deployment, the new version must be written to disk, as
+    * state may have been stored but rejected due to a block forcing a commitment broadcast. This
+    * storage is used to claim outputs of rejected state confirmed onchain by another watchtower,
+    * lagging behind on block processing.
     */
    LDKChannelMonitorUpdateErr_PermanentFailure,
    /**
@@ -179,6 +182,27 @@ typedef enum LDKSecp256k1Error {
    LDKSecp256k1Error_Sentinel,
 } LDKSecp256k1Error;
 
+/**
+ * A serialized transaction, in (pointer, length) form.
+ *
+ * This type optionally owns its own memory, and thus the semantics around access change based on
+ * the `data_is_owned` flag. If `data_is_owned` is set, you must call `Transaction_free` to free
+ * the underlying buffer before the object goes out of scope. If `data_is_owned` is not set, any
+ * access to the buffer after the scope in which the object was provided to you is invalid. eg,
+ * access after you return from the call in which a `!data_is_owned` `Transaction` is provided to
+ * you would be invalid.
+ *
+ * Note that, while it may change in the future, because transactions on the Rust side are stored
+ * in a deserialized form, all `Transaction`s generated on the Rust side will have `data_is_owned`
+ * set. Similarly, while it may change in the future, all `Transaction`s you pass to Rust may have
+ * `data_is_owned` either set or unset at your discretion.
+ */
+typedef struct LDKTransaction {
+   const uint8_t *data;
+   uintptr_t datalen;
+   bool data_is_owned;
+} LDKTransaction;
+
 typedef struct LDKCVecTempl_u8 {
    uint8_t *data;
    uintptr_t datalen;
@@ -195,6 +219,79 @@ typedef struct LDKTxOut {
    uint64_t value;
 } LDKTxOut;
 
+typedef struct LDKC2TupleTempl_usize__Transaction {
+   uintptr_t *a;
+   LDKTransaction *b;
+} LDKC2TupleTempl_usize__Transaction;
+
+typedef LDKC2TupleTempl_usize__Transaction LDKC2Tuple_usizeTransactionZ;
+
+typedef union LDKCResultPtr_u8__ChannelMonitorUpdateErr {
+   uint8_t *result;
+   LDKChannelMonitorUpdateErr *err;
+} LDKCResultPtr_u8__ChannelMonitorUpdateErr;
+
+typedef struct LDKCResultTempl_u8__ChannelMonitorUpdateErr {
+   LDKCResultPtr_u8__ChannelMonitorUpdateErr contents;
+   bool result_ok;
+} LDKCResultTempl_u8__ChannelMonitorUpdateErr;
+
+typedef LDKCResultTempl_u8__ChannelMonitorUpdateErr LDKCResult_NoneChannelMonitorUpdateErrZ;
+
+
+
+/**
+ * General Err type for ChannelMonitor actions. Generally, this implies that the data provided is
+ * inconsistent with the ChannelMonitor being called. eg for ChannelMonitor::update_monitor this
+ * means you tried to update a monitor for a different channel or the ChannelMonitorUpdate was
+ * corrupted.
+ * Contains a human-readable error message.
+ */
+typedef struct MUST_USE_STRUCT LDKMonitorUpdateError {
+   /**
+    * Nearly everyhwere, inner must be non-null, however in places where
+    * the Rust equivalent takes an Option, it may be set to null to indicate None.
+    */
+   LDKnativeMonitorUpdateError *inner;
+   bool is_owned;
+} LDKMonitorUpdateError;
+
+typedef union LDKCResultPtr_u8__MonitorUpdateError {
+   uint8_t *result;
+   LDKMonitorUpdateError *err;
+} LDKCResultPtr_u8__MonitorUpdateError;
+
+typedef struct LDKCResultTempl_u8__MonitorUpdateError {
+   LDKCResultPtr_u8__MonitorUpdateError contents;
+   bool result_ok;
+} LDKCResultTempl_u8__MonitorUpdateError;
+
+typedef LDKCResultTempl_u8__MonitorUpdateError LDKCResult_NoneMonitorUpdateErrorZ;
+
+
+
+/**
+ * A reference to a transaction output.
+ *
+ * Differs from bitcoin::blockdata::transaction::OutPoint as the index is a u16 instead of u32
+ * due to LN's restrictions on index values. Should reduce (possibly) unsafe conversions this way.
+ */
+typedef struct MUST_USE_STRUCT LDKOutPoint {
+   /**
+    * Nearly everyhwere, inner must be non-null, however in places where
+    * the Rust equivalent takes an Option, it may be set to null to indicate None.
+    */
+   LDKnativeOutPoint *inner;
+   bool is_owned;
+} LDKOutPoint;
+
+typedef struct LDKC2TupleTempl_OutPoint__CVec_u8Z {
+   LDKOutPoint *a;
+   LDKCVec_u8Z *b;
+} LDKC2TupleTempl_OutPoint__CVec_u8Z;
+
+typedef LDKC2TupleTempl_OutPoint__CVec_u8Z LDKC2Tuple_OutPointScriptZ;
+
 /**
  * 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.
@@ -203,19 +300,19 @@ typedef struct LDKThirtyTwoBytes {
    uint8_t data[32];
 } LDKThirtyTwoBytes;
 
-typedef struct LDKC2TupleTempl_ThirtyTwoBytes__u32 {
-   LDKThirtyTwoBytes *a;
-   uint32_t *b;
-} LDKC2TupleTempl_ThirtyTwoBytes__u32;
+typedef struct LDKCVecTempl_TxOut {
+   LDKTxOut *data;
+   uintptr_t datalen;
+} LDKCVecTempl_TxOut;
 
-typedef LDKC2TupleTempl_ThirtyTwoBytes__u32 LDKC2Tuple_Txidu32Z;
+typedef struct LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut {
+   LDKThirtyTwoBytes *a;
+   LDKCVecTempl_TxOut *b;
+} LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut;
 
-typedef struct LDKC2TupleTempl_CVec_u8Z__u64 {
-   LDKCVec_u8Z *a;
-   uint64_t *b;
-} LDKC2TupleTempl_CVec_u8Z__u64;
+typedef LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut LDKC2Tuple_TxidCVec_TxOutZZ;
 
-typedef LDKC2TupleTempl_CVec_u8Z__u64 LDKC2Tuple_Scriptu64Z;
+typedef LDKCVecTempl_TxOut LDKCVec_TxOutZ;
 
 typedef struct LDKC2TupleTempl_u64__u64 {
    uint64_t *a;
@@ -315,7 +412,7 @@ typedef enum LDKAPIError_Tag {
     */
    LDKAPIError_ChannelUnavailable,
    /**
-    * An attempt to call add/update_monitor returned an Err (ie you did this!), causing the
+    * An attempt to call watch/update_channel returned an Err (ie you did this!), causing the
     * attempted action to fail.
     */
    LDKAPIError_MonitorUpdateFailed,
@@ -392,72 +489,6 @@ typedef struct LDKCResultTempl_u8__PaymentSendFailure {
 
 typedef LDKCResultTempl_u8__PaymentSendFailure LDKCResult_NonePaymentSendFailureZ;
 
-typedef union LDKCResultPtr_u8__ChannelMonitorUpdateErr {
-   uint8_t *result;
-   LDKChannelMonitorUpdateErr *err;
-} LDKCResultPtr_u8__ChannelMonitorUpdateErr;
-
-typedef struct LDKCResultTempl_u8__ChannelMonitorUpdateErr {
-   LDKCResultPtr_u8__ChannelMonitorUpdateErr contents;
-   bool result_ok;
-} LDKCResultTempl_u8__ChannelMonitorUpdateErr;
-
-typedef LDKCResultTempl_u8__ChannelMonitorUpdateErr LDKCResult_NoneChannelMonitorUpdateErrZ;
-
-
-
-/**
- * General Err type for ChannelMonitor actions. Generally, this implies that the data provided is
- * inconsistent with the ChannelMonitor being called. eg for ChannelMonitor::update_monitor this
- * means you tried to update a monitor for a different channel or the ChannelMonitorUpdate was
- * corrupted.
- * Contains a human-readable error message.
- */
-typedef struct MUST_USE_STRUCT LDKMonitorUpdateError {
-   /**
-    * Nearly everyhwere, inner must be non-null, however in places where
-    * the Rust equivalent takes an Option, it may be set to null to indicate None.
-    */
-   LDKnativeMonitorUpdateError *inner;
-   bool is_owned;
-} LDKMonitorUpdateError;
-
-typedef union LDKCResultPtr_u8__MonitorUpdateError {
-   uint8_t *result;
-   LDKMonitorUpdateError *err;
-} LDKCResultPtr_u8__MonitorUpdateError;
-
-typedef struct LDKCResultTempl_u8__MonitorUpdateError {
-   LDKCResultPtr_u8__MonitorUpdateError contents;
-   bool result_ok;
-} LDKCResultTempl_u8__MonitorUpdateError;
-
-typedef LDKCResultTempl_u8__MonitorUpdateError LDKCResult_NoneMonitorUpdateErrorZ;
-
-
-
-/**
- * A reference to a transaction output.
- *
- * Differs from bitcoin::blockdata::transaction::OutPoint as the index is a u16 instead of u32
- * due to LN's restrictions on index values. Should reduce (possibly) unsafe conversions this way.
- */
-typedef struct MUST_USE_STRUCT LDKOutPoint {
-   /**
-    * Nearly everyhwere, inner must be non-null, however in places where
-    * the Rust equivalent takes an Option, it may be set to null to indicate None.
-    */
-   LDKnativeOutPoint *inner;
-   bool is_owned;
-} LDKOutPoint;
-
-typedef struct LDKC2TupleTempl_OutPoint__CVec_u8Z {
-   LDKOutPoint *a;
-   LDKCVec_u8Z *b;
-} LDKC2TupleTempl_OutPoint__CVec_u8Z;
-
-typedef LDKC2TupleTempl_OutPoint__CVec_u8Z LDKC2Tuple_OutPointScriptZ;
-
 
 
 /**
@@ -1346,208 +1377,34 @@ typedef struct MUST_USE_STRUCT LDKUserConfig {
    bool is_owned;
 } LDKUserConfig;
 
-typedef union LDKCResultPtr_C2TupleTempl_CVec_u8Z__u64_____ChainError {
-   LDKC2TupleTempl_CVec_u8Z__u64 *result;
-   LDKChainError *err;
-} LDKCResultPtr_C2TupleTempl_CVec_u8Z__u64_____ChainError;
+typedef union LDKCResultPtr_TxOut__AccessError {
+   LDKTxOut *result;
+   LDKAccessError *err;
+} LDKCResultPtr_TxOut__AccessError;
 
-typedef struct LDKCResultTempl_C2TupleTempl_CVec_u8Z__u64_____ChainError {
-   LDKCResultPtr_C2TupleTempl_CVec_u8Z__u64_____ChainError contents;
+typedef struct LDKCResultTempl_TxOut__AccessError {
+   LDKCResultPtr_TxOut__AccessError contents;
    bool result_ok;
-} LDKCResultTempl_C2TupleTempl_CVec_u8Z__u64_____ChainError;
-
-typedef LDKCResultTempl_C2TupleTempl_CVec_u8Z__u64_____ChainError LDKCResult_C2Tuple_Scriptu64ZChainErrorZ;
-
-typedef struct LDKCVecTempl_usize {
-   uintptr_t *data;
-   uintptr_t datalen;
-} LDKCVecTempl_usize;
-
-typedef LDKCVecTempl_usize LDKCVec_usizeZ;
-
-/**
- * An interface to request notification of certain scripts as they appear the
- * chain.
- *
- * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
- * called from inside the library in response to ChainListener events, P2P events, or timer
- * events).
- */
-typedef struct LDKChainWatchInterface {
-   void *this_arg;
-   /**
-    * Provides a txid/random-scriptPubKey-in-the-tx which much be watched for.
-    */
-   void (*install_watch_tx)(const void *this_arg, const uint8_t (*txid)[32], LDKu8slice script_pub_key);
-   /**
-    * Provides an outpoint which must be watched for, providing any transactions which spend the
-    * given outpoint.
-    */
-   void (*install_watch_outpoint)(const void *this_arg, LDKC2Tuple_Txidu32Z outpoint, LDKu8slice out_script);
-   /**
-    * Indicates that a listener needs to see all transactions.
-    */
-   void (*watch_all_txn)(const void *this_arg);
-   /**
-    * Gets the script and value in satoshis for a given unspent transaction output given a
-    * short_channel_id (aka unspent_tx_output_identier). For BTC/tBTC channels the top three
-    * bytes are the block height, the next 3 the transaction index within the block, and the
-    * final two the output within the transaction.
-    */
-   LDKCResult_C2Tuple_Scriptu64ZChainErrorZ (*get_chain_utxo)(const void *this_arg, LDKThirtyTwoBytes genesis_hash, uint64_t unspent_tx_output_identifier);
-   /**
-    * Gets the list of transaction indices within a given block that the ChainWatchInterface is
-    * watching for.
-    */
-   LDKCVec_usizeZ (*filter_block)(const void *this_arg, LDKu8slice block);
-   /**
-    * Returns a usize that changes when the ChainWatchInterface's watched data is modified.
-    * Users of `filter_block` should pre-save a copy of `reentered`'s return value and use it to
-    * determine whether they need to re-filter a given block.
-    */
-   uintptr_t (*reentered)(const void *this_arg);
-   void (*free)(void *this_arg);
-} LDKChainWatchInterface;
-
-/**
- * A reference to a serialized transaction, in (pointer, length) form.
- * This type does *not* own its own memory, so access to it after, eg, the call in which it was
- * provided to you are invalid.
- */
-typedef struct LDKTransaction {
-   const uint8_t *data;
-   uintptr_t datalen;
-} LDKTransaction;
-
-/**
- * An interface to send a transaction to the Bitcoin network.
- */
-typedef struct LDKBroadcasterInterface {
-   void *this_arg;
-   /**
-    * Sends a transaction out to (hopefully) be mined.
-    */
-   void (*broadcast_transaction)(const void *this_arg, LDKTransaction tx);
-   void (*free)(void *this_arg);
-} LDKBroadcasterInterface;
-
-typedef struct LDKCVecTempl_CVec_u8Z {
-   LDKCVec_u8Z *data;
-   uintptr_t datalen;
-} LDKCVecTempl_CVec_u8Z;
-
-typedef LDKCVecTempl_CVec_u8Z LDKCVec_TransactionZ;
+} LDKCResultTempl_TxOut__AccessError;
 
-typedef struct LDKusizeslice {
-   const uintptr_t *data;
-   uintptr_t datalen;
-} LDKusizeslice;
-
-/**
- * A trait indicating a desire to listen for events from the chain
- */
-typedef struct LDKChainListener {
-   void *this_arg;
-   /**
-    * Notifies a listener that a block was connected.
-    *
-    * The txn_matched array should be set to references to transactions which matched the
-    * relevant installed watch outpoints/txn, or the full set of transactions in the block.
-    *
-    * Note that if txn_matched includes only matched transactions, and a new
-    * transaction/outpoint is watched during a block_connected call, the block *must* be
-    * re-scanned with the new transaction/outpoints and block_connected should be called
-    * again with the same header and (at least) the new transactions.
-    *
-    * Note that if non-new transaction/outpoints are be registered during a call, a second call
-    * *must not* happen.
-    *
-    * This also means those counting confirmations using block_connected callbacks should watch
-    * for duplicate headers and not count them towards confirmations!
-    */
-   void (*block_connected)(const void *this_arg, const uint8_t (*header)[80], uint32_t height, LDKCVec_TransactionZ txn_matched, LDKusizeslice indexes_of_txn_matched);
-   /**
-    * Notifies a listener that a block was disconnected.
-    * Unlike block_connected, this *must* never be called twice for the same disconnect event.
-    * Height must be the one of the block which was disconnected (not new height of the best chain)
-    */
-   void (*block_disconnected)(const void *this_arg, const uint8_t (*header)[80], uint32_t disconnected_height);
-   void (*free)(void *this_arg);
-} LDKChainListener;
+typedef LDKCResultTempl_TxOut__AccessError LDKCResult_TxOutAccessErrorZ;
 
 /**
- * A trait which should be implemented to provide feerate information on a number of time
- * horizons.
- *
- * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
- * called from inside the library in response to ChainListener events, P2P events, or timer
- * events).
+ * The `Access` trait defines behavior for accessing chain data and state, such as blocks and
+ * UTXOs.
  */
-typedef struct LDKFeeEstimator {
+typedef struct LDKAccess {
    void *this_arg;
    /**
-    * Gets estimated satoshis of fee required per 1000 Weight-Units.
+    * Returns the transaction output of a funding transaction encoded by [`short_channel_id`].
+    * Returns an error if `genesis_hash` is for a different chain or if such a transaction output
+    * is unknown.
     *
-    * Must be no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later round-downs
-    * don't put us below 1 satoshi-per-byte).
-    *
-    * This translates to:
-    *  * satoshis-per-byte * 250
-    *  * ceil(satoshis-per-kbyte / 4)
+    * [`short_channel_id`]: https://github.com/lightningnetwork/lightning-rfc/blob/master/07-routing-gossip.md#definition-of-short_channel_id
     */
-   uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, LDKConfirmationTarget confirmation_target);
+   LDKCResult_TxOutAccessErrorZ (*get_utxo)(const void *this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id);
    void (*free)(void *this_arg);
-} LDKFeeEstimator;
-
-
-
-/**
- * Utility for tracking registered txn/outpoints and checking for matches
- */
-typedef struct MUST_USE_STRUCT LDKChainWatchedUtil {
-   /**
-    * Nearly everyhwere, inner must be non-null, however in places where
-    * the Rust equivalent takes an Option, it may be set to null to indicate None.
-    */
-   LDKnativeChainWatchedUtil *inner;
-   bool is_owned;
-} LDKChainWatchedUtil;
-
-
-
-/**
- * Utility for notifying listeners about new blocks, and handling block rescans if new watch
- * data is registered.
- *
- * Rather than using a plain BlockNotifier, it is preferable to use either a BlockNotifierArc
- * or a BlockNotifierRef for conciseness. See their documentation for more details, but essentially
- * you should default to using a BlockNotifierRef, and use a BlockNotifierArc instead when you
- * require ChainListeners with static lifetimes, such as when you're using lightning-net-tokio.
- */
-typedef struct MUST_USE_STRUCT LDKBlockNotifier {
-   /**
-    * Nearly everyhwere, inner must be non-null, however in places where
-    * the Rust equivalent takes an Option, it may be set to null to indicate None.
-    */
-   LDKnativeBlockNotifier *inner;
-   bool is_owned;
-} LDKBlockNotifier;
-
-
-
-/**
- * Utility to capture some common parts of ChainWatchInterface implementors.
- *
- * Keeping a local copy of this in a ChainWatchInterface implementor is likely useful.
- */
-typedef struct MUST_USE_STRUCT LDKChainWatchInterfaceUtil {
-   /**
-    * Nearly everyhwere, inner must be non-null, however in places where
-    * the Rust equivalent takes an Option, it may be set to null to indicate None.
-    */
-   LDKnativeChainWatchInterfaceUtil *inner;
-   bool is_owned;
-} LDKChainWatchInterfaceUtil;
+} LDKAccess;
 
 
 
@@ -1776,75 +1633,6 @@ typedef struct LDKChannelKeys {
    void (*free)(void *this_arg);
 } LDKChannelKeys;
 
-typedef struct LDKSecretKey {
-   uint8_t bytes[32];
-} LDKSecretKey;
-
-/**
- * A trait to describe an object which can get user secrets and key material.
- */
-typedef struct LDKKeysInterface {
-   void *this_arg;
-   /**
-    * Get node secret key (aka node_id or network_key)
-    */
-   LDKSecretKey (*get_node_secret)(const void *this_arg);
-   /**
-    * Get destination redeemScript to encumber static protocol exit points.
-    */
-   LDKCVec_u8Z (*get_destination_script)(const void *this_arg);
-   /**
-    * Get shutdown_pubkey to use as PublicKey at channel closure
-    */
-   LDKPublicKey (*get_shutdown_pubkey)(const void *this_arg);
-   /**
-    * Get a new set of ChannelKeys for per-channel secrets. These MUST be unique even if you
-    * restarted with some stale data!
-    */
-   LDKChannelKeys (*get_channel_keys)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis);
-   /**
-    * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting
-    * onion packets and for temporary channel IDs. There is no requirement that these be
-    * persisted anywhere, though they must be unique across restarts.
-    */
-   LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg);
-   void (*free)(void *this_arg);
-} LDKKeysInterface;
-
-
-
-/**
- * A simple implementation of ChannelKeys that just keeps the private keys in memory.
- */
-typedef struct MUST_USE_STRUCT LDKInMemoryChannelKeys {
-   /**
-    * Nearly everyhwere, inner must be non-null, however in places where
-    * the Rust equivalent takes an Option, it may be set to null to indicate None.
-    */
-   LDKnativeInMemoryChannelKeys *inner;
-   bool is_owned;
-} LDKInMemoryChannelKeys;
-
-
-
-/**
- * Simple KeysInterface implementor that takes a 32-byte seed for use as a BIP 32 extended key
- * and derives keys from that.
- *
- * Your node_id is seed/0'
- * ChannelMonitor closes may use seed/1'
- * Cooperative closes may use seed/2'
- * The two close keys may be needed to claim on-chain funds!
- */
-typedef struct MUST_USE_STRUCT LDKKeysManager {
-   /**
-    * Nearly everyhwere, inner must be non-null, however in places where
-    * the Rust equivalent takes an Option, it may be set to null to indicate None.
-    */
-   LDKnativeKeysManager *inner;
-   bool is_owned;
-} LDKKeysManager;
-
 
 
 /**
@@ -1905,77 +1693,263 @@ typedef struct LDKCVecTempl_MonitorEvent {
 typedef LDKCVecTempl_MonitorEvent LDKCVec_MonitorEventZ;
 
 /**
- * Simple trait indicating ability to track a set of ChannelMonitors and multiplex events between
- * them. Generally should be implemented by keeping a local SimpleManyChannelMonitor and passing
- * events to it, while also taking any add/update_monitor events and passing them to some remote
- * server(s).
+ * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as
+ * blocks are connected and disconnected.
+ *
+ * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are
+ * responsible for maintaining a set of monitors such that they can be updated accordingly as
+ * channel state changes and HTLCs are resolved. See method documentation for specific
+ * requirements.
  *
- * In general, you must always have at least one local copy in memory, which must never fail to
- * update (as it is responsible for broadcasting the latest state in case the channel is closed),
- * and then persist it to various on-disk locations. If, for some reason, the in-memory copy fails
- * to update (eg out-of-memory or some other condition), you must immediately shut down without
- * taking any further action such as writing the current state to disk. This should likely be
- * accomplished via panic!() or abort().
+ * Implementations **must** ensure that updates are successfully applied and persisted upon method
+ * completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down
+ * without taking any further action such as persisting the current state.
  *
- * Note that any updates to a channel's monitor *must* be applied to each instance of the
- * channel's monitor everywhere (including remote watchtowers) *before* this function returns. If
- * an update occurs and a remote watchtower is left with old state, it may broadcast transactions
- * which we have revoked, allowing our counterparty to claim all funds in the channel!
+ * If an implementation maintains multiple instances of a channel's monitor (e.g., by storing
+ * backup copies), then it must ensure that updates are applied across all instances. Otherwise, it
+ * could result in a revoked transaction being broadcast, allowing the counterparty to claim all
+ * funds in the channel. See [`ChannelMonitorUpdateErr`] for more details about how to handle
+ * multiple instances.
  *
- * User needs to notify implementors of ManyChannelMonitor when a new block is connected or
- * disconnected using their `block_connected` and `block_disconnected` methods. However, rather
- * than calling these methods directly, the user should register implementors as listeners to the
- * BlockNotifier and call the BlockNotifier's `block_(dis)connected` methods, which will notify
- * all registered listeners in one go.
+ * [`ChannelMonitor`]: channelmonitor/struct.ChannelMonitor.html
+ * [`ChannelMonitorUpdateErr`]: channelmonitor/enum.ChannelMonitorUpdateErr.html
+ * [`PermanentFailure`]: channelmonitor/enum.ChannelMonitorUpdateErr.html#variant.PermanentFailure
  */
-typedef struct LDKManyChannelMonitor {
+typedef struct LDKWatch {
    void *this_arg;
    /**
-    * Adds a monitor for the given `funding_txo`.
+    * Watches a channel identified by `funding_txo` using `monitor`.
     *
-    * Implementer must also ensure that the funding_txo txid *and* outpoint are registered with
-    * any relevant ChainWatchInterfaces such that the provided monitor receives block_connected
-    * callbacks with the funding transaction, or any spends of it.
+    * Implementations are responsible for watching the chain for the funding transaction along
+    * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means
+    * calling [`block_connected`] and [`block_disconnected`] on the monitor.
     *
-    * Further, the implementer must also ensure that each output returned in
-    * monitor.get_outputs_to_watch() is registered to ensure that the provided monitor learns about
-    * any spends of any of the outputs.
-    *
-    * Any spends of outputs which should have been registered which aren't passed to
-    * ChannelMonitors via block_connected may result in FUNDS LOSS.
+    * [`get_outputs_to_watch`]: channelmonitor/struct.ChannelMonitor.html#method.get_outputs_to_watch
+    * [`block_connected`]: channelmonitor/struct.ChannelMonitor.html#method.block_connected
+    * [`block_disconnected`]: channelmonitor/struct.ChannelMonitor.html#method.block_disconnected
     */
-   LDKCResult_NoneChannelMonitorUpdateErrZ (*add_monitor)(const void *this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor);
+   LDKCResult_NoneChannelMonitorUpdateErrZ (*watch_channel)(const void *this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor);
    /**
-    * Updates a monitor for the given `funding_txo`.
+    * Updates a channel identified by `funding_txo` by applying `update` to its monitor.
     *
-    * Implementer must also ensure that the funding_txo txid *and* outpoint are registered with
-    * any relevant ChainWatchInterfaces such that the provided monitor receives block_connected
-    * callbacks with the funding transaction, or any spends of it.
+    * Implementations must call [`update_monitor`] with the given update. See
+    * [`ChannelMonitorUpdateErr`] for invariants around returning an error.
     *
-    * Further, the implementer must also ensure that each output returned in
-    * monitor.get_watch_outputs() is registered to ensure that the provided monitor learns about
-    * any spends of any of the outputs.
+    * [`update_monitor`]: channelmonitor/struct.ChannelMonitor.html#method.update_monitor
+    * [`ChannelMonitorUpdateErr`]: channelmonitor/enum.ChannelMonitorUpdateErr.html
+    */
+   LDKCResult_NoneChannelMonitorUpdateErrZ (*update_channel)(const void *this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update);
+   /**
+    * Returns any monitor events since the last call. Subsequent calls must only return new
+    * events.
+    */
+   LDKCVec_MonitorEventZ (*release_pending_monitor_events)(const void *this_arg);
+   void (*free)(void *this_arg);
+} LDKWatch;
+
+/**
+ * The `Filter` trait defines behavior for indicating chain activity of interest pertaining to
+ * channels.
+ *
+ * This is useful in order to have a [`Watch`] implementation convey to a chain source which
+ * transactions to be notified of. Notification may take the form of pre-filtering blocks or, in
+ * the case of [BIP 157]/[BIP 158], only fetching a block if the compact filter matches. If
+ * receiving full blocks from a chain source, any further filtering is unnecessary.
+ *
+ * After an output has been registered, subsequent block retrievals from the chain source must not
+ * exclude any transactions matching the new criteria nor any in-block descendants of such
+ * transactions.
+ *
+ * Note that use as part of a [`Watch`] implementation involves reentrancy. Therefore, the `Filter`
+ * should not block on I/O. Implementations should instead queue the newly monitored data to be
+ * processed later. Then, in order to block until the data has been processed, any `Watch`
+ * invocation that has called the `Filter` must return [`TemporaryFailure`].
+ *
+ * [`Watch`]: trait.Watch.html
+ * [`TemporaryFailure`]: channelmonitor/enum.ChannelMonitorUpdateErr.html#variant.TemporaryFailure
+ * [BIP 157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki
+ * [BIP 158]: https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki
+ */
+typedef struct LDKFilter {
+   void *this_arg;
+   /**
+    * Registers interest in a transaction with `txid` and having an output with `script_pubkey` as
+    * a spending condition.
+    */
+   void (*register_tx)(const void *this_arg, const uint8_t (*txid)[32], LDKu8slice script_pubkey);
+   /**
+    * Registers interest in spends of a transaction output identified by `outpoint` having
+    * `script_pubkey` as the spending condition.
+    */
+   void (*register_output)(const void *this_arg, const LDKOutPoint *outpoint, LDKu8slice script_pubkey);
+   void (*free)(void *this_arg);
+} LDKFilter;
+
+/**
+ * An interface to send a transaction to the Bitcoin network.
+ */
+typedef struct LDKBroadcasterInterface {
+   void *this_arg;
+   /**
+    * Sends a transaction out to (hopefully) be mined.
+    */
+   void (*broadcast_transaction)(const void *this_arg, LDKTransaction tx);
+   void (*free)(void *this_arg);
+} LDKBroadcasterInterface;
+
+/**
+ * A trait which should be implemented to provide feerate information on a number of time
+ * horizons.
+ *
+ * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
+ * called from inside the library in response to chain events, P2P events, or timer events).
+ */
+typedef struct LDKFeeEstimator {
+   void *this_arg;
+   /**
+    * Gets estimated satoshis of fee required per 1000 Weight-Units.
     *
-    * Any spends of outputs which should have been registered which aren't passed to
-    * ChannelMonitors via block_connected may result in FUNDS LOSS.
+    * Must be no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later round-downs
+    * don't put us below 1 satoshi-per-byte).
     *
-    * In case of distributed watchtowers deployment, even if an Err is return, the new version
-    * must be written to disk, as state may have been stored but rejected due to a block forcing
-    * a commitment broadcast. This storage is used to claim outputs of rejected state confirmed
-    * onchain by another watchtower, lagging behind on block processing.
+    * This translates to:
+    *  * satoshis-per-byte * 250
+    *  * ceil(satoshis-per-kbyte / 4)
     */
-   LDKCResult_NoneChannelMonitorUpdateErrZ (*update_monitor)(const void *this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate monitor);
+   uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, LDKConfirmationTarget confirmation_target);
+   void (*free)(void *this_arg);
+} LDKFeeEstimator;
+
+
+
+/**
+ * An implementation of [`chain::Watch`] for monitoring channels.
+ *
+ * Connected and disconnected blocks must be provided to `ChainMonitor` as documented by
+ * [`chain::Watch`]. May be used in conjunction with [`ChannelManager`] to monitor channels locally
+ * or used independently to monitor channels remotely. See the [module-level documentation] for
+ * details.
+ *
+ * [`chain::Watch`]: ../trait.Watch.html
+ * [`ChannelManager`]: ../../ln/channelmanager/struct.ChannelManager.html
+ * [module-level documentation]: index.html
+ */
+typedef struct MUST_USE_STRUCT LDKChainMonitor {
    /**
-    * Used by ChannelManager to get list of HTLC resolved onchain and which needed to be updated
-    * with success or failure.
-    *
-    * You should probably just call through to
-    * ChannelMonitor::get_and_clear_pending_monitor_events() for each ChannelMonitor and return
-    * the full list.
+    * Nearly everyhwere, inner must be non-null, however in places where
+    * the Rust equivalent takes an Option, it may be set to null to indicate None.
+    */
+   LDKnativeChainMonitor *inner;
+   bool is_owned;
+} LDKChainMonitor;
+
+typedef struct LDKCVecTempl_C2TupleTempl_usize__Transaction {
+   LDKC2TupleTempl_usize__Transaction *data;
+   uintptr_t datalen;
+} LDKCVecTempl_C2TupleTempl_usize__Transaction;
+
+typedef LDKCVecTempl_C2TupleTempl_usize__Transaction LDKCVec_C2Tuple_usizeTransactionZZ;
+
+
+
+/**
+ * Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on
+ * chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the
+ * preimage claim backward will lead to loss of funds.
+ *
+ * [`chain::Watch`]: ../trait.Watch.html
+ */
+typedef struct MUST_USE_STRUCT LDKHTLCUpdate {
+   /**
+    * Nearly everyhwere, inner must be non-null, however in places where
+    * the Rust equivalent takes an Option, it may be set to null to indicate None.
+    */
+   LDKnativeHTLCUpdate *inner;
+   bool is_owned;
+} LDKHTLCUpdate;
+
+typedef struct LDKCVecTempl_Transaction {
+   LDKTransaction *data;
+   uintptr_t datalen;
+} LDKCVecTempl_Transaction;
+
+typedef LDKCVecTempl_Transaction LDKCVec_TransactionZ;
+
+typedef struct LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut {
+   LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut *data;
+   uintptr_t datalen;
+} LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut;
+
+typedef LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut LDKCVec_C2Tuple_TxidCVec_TxOutZZZ;
+
+typedef struct LDKSecretKey {
+   uint8_t bytes[32];
+} LDKSecretKey;
+
+/**
+ * A trait to describe an object which can get user secrets and key material.
+ */
+typedef struct LDKKeysInterface {
+   void *this_arg;
+   /**
+    * Get node secret key (aka node_id or network_key)
+    */
+   LDKSecretKey (*get_node_secret)(const void *this_arg);
+   /**
+    * Get destination redeemScript to encumber static protocol exit points.
+    */
+   LDKCVec_u8Z (*get_destination_script)(const void *this_arg);
+   /**
+    * Get shutdown_pubkey to use as PublicKey at channel closure
+    */
+   LDKPublicKey (*get_shutdown_pubkey)(const void *this_arg);
+   /**
+    * Get a new set of ChannelKeys for per-channel secrets. These MUST be unique even if you
+    * restarted with some stale data!
     */
-   LDKCVec_MonitorEventZ (*get_and_clear_pending_monitor_events)(const void *this_arg);
+   LDKChannelKeys (*get_channel_keys)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis);
+   /**
+    * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting
+    * onion packets and for temporary channel IDs. There is no requirement that these be
+    * persisted anywhere, though they must be unique across restarts.
+    */
+   LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg);
    void (*free)(void *this_arg);
-} LDKManyChannelMonitor;
+} LDKKeysInterface;
+
+
+
+/**
+ * A simple implementation of ChannelKeys that just keeps the private keys in memory.
+ */
+typedef struct MUST_USE_STRUCT LDKInMemoryChannelKeys {
+   /**
+    * Nearly everyhwere, inner must be non-null, however in places where
+    * the Rust equivalent takes an Option, it may be set to null to indicate None.
+    */
+   LDKnativeInMemoryChannelKeys *inner;
+   bool is_owned;
+} LDKInMemoryChannelKeys;
+
+
+
+/**
+ * Simple KeysInterface implementor that takes a 32-byte seed for use as a BIP 32 extended key
+ * and derives keys from that.
+ *
+ * Your node_id is seed/0'
+ * ChannelMonitor closes may use seed/1'
+ * Cooperative closes may use seed/2'
+ * The two close keys may be needed to claim on-chain funds!
+ */
+typedef struct MUST_USE_STRUCT LDKKeysManager {
+   /**
+    * Nearly everyhwere, inner must be non-null, however in places where
+    * the Rust equivalent takes an Option, it may be set to null to indicate None.
+    */
+   LDKnativeKeysManager *inner;
+   bool is_owned;
+} LDKKeysManager;
 
 
 
@@ -1993,7 +1967,7 @@ typedef struct LDKManyChannelMonitor {
  *
  * Note that you can be a bit lazier about writing out ChannelManager than you can be with
  * ChannelMonitors. With ChannelMonitors you MUST write each monitor update out to disk before
- * returning from ManyChannelMonitor::add_/update_monitor, with ChannelManagers, writing updates
+ * returning from chain::Watch::watch_/update_channel, with ChannelManagers, writing updates
  * happens out-of-band (and will prevent any other ChannelManager operations from occurring during
  * the serialization process). If the deserialized version is out-of-date compared to the
  * ChannelMonitors passed by reference to read(), those channels will be force-closed based on the
@@ -2361,11 +2335,10 @@ typedef struct LDKChannelMessageHandler {
  *    This may result in closing some Channels if the ChannelMonitor is newer than the stored
  *    ChannelManager state to ensure no loss of funds. Thus, transactions may be broadcasted.
  * 3) Register all relevant ChannelMonitor outpoints with your chain watch mechanism using
- *    ChannelMonitor::get_monitored_outpoints and ChannelMonitor::get_funding_txo().
+ *    ChannelMonitor::get_outputs_to_watch() and ChannelMonitor::get_funding_txo().
  * 4) Reconnect blocks on your ChannelMonitors.
- * 5) Move the ChannelMonitors into your local ManyChannelMonitor.
+ * 5) Move the ChannelMonitors into your local chain::Watch.
  * 6) Disconnect/connect blocks on the ChannelManager.
- * 7) Register the new ChannelManager with your ChainWatchInterface.
  */
 typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs {
    /**
@@ -2385,21 +2358,6 @@ typedef LDKCVecTempl_ChannelMonitor LDKCVec_ChannelMonitorZ;
 
 
 
-/**
- * Simple structure send back by ManyChannelMonitor in case of HTLC detected onchain from a
- * forward channel and from which info are needed to update HTLC in a backward channel.
- */
-typedef struct MUST_USE_STRUCT LDKHTLCUpdate {
-   /**
-    * Nearly everyhwere, inner must be non-null, however in places where
-    * the Rust equivalent takes an Option, it may be set to null to indicate None.
-    */
-   LDKnativeHTLCUpdate *inner;
-   bool is_owned;
-} LDKHTLCUpdate;
-
-
-
 /**
  * An error in decoding a message or struct.
  */
@@ -2473,6 +2431,34 @@ typedef struct MUST_USE_STRUCT LDKUnsignedNodeAnnouncement {
 
 
 
+/**
+ * Features used within a `node_announcement` message.
+ */
+typedef struct MUST_USE_STRUCT LDKNodeFeatures {
+   /**
+    * Nearly everyhwere, inner must be non-null, however in places where
+    * the Rust equivalent takes an Option, it may be set to null to indicate None.
+    */
+   LDKnativeNodeFeatures *inner;
+   bool is_owned;
+} LDKNodeFeatures;
+
+
+
+/**
+ * Features used within a `channel_announcement` message.
+ */
+typedef struct MUST_USE_STRUCT LDKChannelFeatures {
+   /**
+    * Nearly everyhwere, inner must be non-null, however in places where
+    * the Rust equivalent takes an Option, it may be set to null to indicate None.
+    */
+   LDKnativeChannelFeatures *inner;
+   bool is_owned;
+} LDKChannelFeatures;
+
+
+
 /**
  * The unsigned part of a channel_update
  */
@@ -2865,42 +2851,14 @@ typedef struct LDKCResultTempl_TxCreationKeys__Secp256k1Error {
    bool result_ok;
 } LDKCResultTempl_TxCreationKeys__Secp256k1Error;
 
-typedef LDKCResultTempl_TxCreationKeys__Secp256k1Error LDKCResult_TxCreationKeysSecpErrorZ;
-
-typedef struct LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature {
-   LDKC2TupleTempl_HTLCOutputInCommitment__Signature *data;
-   uintptr_t datalen;
-} LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature;
-
-typedef LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ;
-
-
-
-/**
- * Features used within a `node_announcement` message.
- */
-typedef struct MUST_USE_STRUCT LDKNodeFeatures {
-   /**
-    * Nearly everyhwere, inner must be non-null, however in places where
-    * the Rust equivalent takes an Option, it may be set to null to indicate None.
-    */
-   LDKnativeNodeFeatures *inner;
-   bool is_owned;
-} LDKNodeFeatures;
-
+typedef LDKCResultTempl_TxCreationKeys__Secp256k1Error LDKCResult_TxCreationKeysSecpErrorZ;
 
+typedef struct LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature {
+   LDKC2TupleTempl_HTLCOutputInCommitment__Signature *data;
+   uintptr_t datalen;
+} LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature;
 
-/**
- * Features used within a `channel_announcement` message.
- */
-typedef struct MUST_USE_STRUCT LDKChannelFeatures {
-   /**
-    * Nearly everyhwere, inner must be non-null, however in places where
-    * the Rust equivalent takes an Option, it may be set to null to indicate None.
-    */
-   LDKnativeChannelFeatures *inner;
-   bool is_owned;
-} LDKChannelFeatures;
+typedef LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ;
 
 
 
@@ -3087,21 +3045,15 @@ extern const void (*C2Tuple_HTLCOutputInCommitmentSignatureZ_free)(LDKC2Tuple_HT
 
 extern const void (*C2Tuple_OutPointScriptZ_free)(LDKC2Tuple_OutPointScriptZ);
 
-extern const void (*C2Tuple_Scriptu64Z_free)(LDKC2Tuple_Scriptu64Z);
-
 extern const void (*C2Tuple_SignatureCVec_SignatureZZ_free)(LDKC2Tuple_SignatureCVec_SignatureZZ);
 
-extern const void (*C2Tuple_Txidu32Z_free)(LDKC2Tuple_Txidu32Z);
+extern const void (*C2Tuple_TxidCVec_TxOutZZ_free)(LDKC2Tuple_TxidCVec_TxOutZZ);
 
 extern const void (*C2Tuple_u64u64Z_free)(LDKC2Tuple_u64u64Z);
 
-extern const void (*C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free)(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ);
-
-extern const LDKCResult_C2Tuple_Scriptu64ZChainErrorZ (*CResult_C2Tuple_Scriptu64ZChainErrorZ_err)(LDKChainError);
+extern const void (*C2Tuple_usizeTransactionZ_free)(LDKC2Tuple_usizeTransactionZ);
 
-extern const void (*CResult_C2Tuple_Scriptu64ZChainErrorZ_free)(LDKCResult_C2Tuple_Scriptu64ZChainErrorZ);
-
-extern const LDKCResult_C2Tuple_Scriptu64ZChainErrorZ (*CResult_C2Tuple_Scriptu64ZChainErrorZ_ok)(LDKC2Tuple_Scriptu64Z);
+extern const void (*C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free)(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ);
 
 extern const void (*CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free)(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ);
 
@@ -3165,6 +3117,12 @@ extern const void (*CResult_TxCreationKeysSecpErrorZ_free)(LDKCResult_TxCreation
 
 extern const LDKCResult_TxCreationKeysSecpErrorZ (*CResult_TxCreationKeysSecpErrorZ_ok)(LDKTxCreationKeys);
 
+extern const LDKCResult_TxOutAccessErrorZ (*CResult_TxOutAccessErrorZ_err)(LDKAccessError);
+
+extern const void (*CResult_TxOutAccessErrorZ_free)(LDKCResult_TxOutAccessErrorZ);
+
+extern const LDKCResult_TxOutAccessErrorZ (*CResult_TxOutAccessErrorZ_ok)(LDKTxOut);
+
 extern const LDKCResult_boolLightningErrorZ (*CResult_boolLightningErrorZ_err)(LDKLightningError);
 
 extern const void (*CResult_boolLightningErrorZ_free)(LDKCResult_boolLightningErrorZ);
@@ -3179,6 +3137,10 @@ 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_usizeTransactionZZ_free)(LDKCVec_C2Tuple_usizeTransactionZZ);
+
 extern const void (*CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free)(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ);
 
 extern const void (*CVec_CVec_RouteHopZZ_free)(LDKCVec_CVec_RouteHopZZ);
@@ -3211,6 +3173,8 @@ 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);
@@ -3223,15 +3187,21 @@ extern const void (*CVec_u64Z_free)(LDKCVec_u64Z);
 
 extern const void (*CVec_u8Z_free)(LDKCVec_u8Z);
 
-extern const void (*CVec_usizeZ_free)(LDKCVec_usizeZ);
-
 extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT;
 
+void Transaction_free(LDKTransaction _res);
+
 void TxOut_free(LDKTxOut _res);
 
-LDKC2Tuple_Txidu32Z C2Tuple_Txidu32Z_new(LDKThirtyTwoBytes a, uint32_t b);
+LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, LDKTransaction b);
+
+LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_ok(void);
+
+LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_ok(void);
+
+LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(LDKOutPoint a, LDKCVec_u8Z b);
 
-LDKC2Tuple_Scriptu64Z C2Tuple_Scriptu64Z_new(LDKCVec_u8Z a, uint64_t b);
+LDKC2Tuple_TxidCVec_TxOutZZ C2Tuple_TxidCVec_TxOutZZ_new(LDKThirtyTwoBytes a, LDKCVec_TxOutZ b);
 
 LDKC2Tuple_u64u64Z C2Tuple_u64u64Z_new(uint64_t a, uint64_t b);
 
@@ -3247,12 +3217,6 @@ LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void);
 
 LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void);
 
-LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_ok(void);
-
-LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_ok(void);
-
-LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(LDKOutPoint a, LDKCVec_u8Z b);
-
 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(LDKChannelAnnouncement a, LDKChannelUpdate b, LDKChannelUpdate c);
 
 LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void);
@@ -3682,101 +3646,183 @@ MUST_USE_RES LDKUserConfig UserConfig_default(void);
 /**
  * Calls the free function if one is set
  */
-void ChainWatchInterface_free(LDKChainWatchInterface this_ptr);
+void Access_free(LDKAccess this_ptr);
 
 /**
  * Calls the free function if one is set
  */
-void BroadcasterInterface_free(LDKBroadcasterInterface this_ptr);
+void Watch_free(LDKWatch this_ptr);
+
+/**
+ * Calls the free function if one is set
+ */
+void Filter_free(LDKFilter this_ptr);
 
 /**
  * Calls the free function if one is set
  */
-void ChainListener_free(LDKChainListener this_ptr);
+void BroadcasterInterface_free(LDKBroadcasterInterface this_ptr);
 
 /**
  * Calls the free function if one is set
  */
 void FeeEstimator_free(LDKFeeEstimator this_ptr);
 
-void ChainWatchedUtil_free(LDKChainWatchedUtil this_ptr);
+void ChainMonitor_free(LDKChainMonitor this_ptr);
 
 /**
- * Constructs an empty (watches nothing) ChainWatchedUtil
+ * Dispatches to per-channel monitors, which are responsible for updating their on-chain view
+ * of a channel and reacting accordingly based on transactions in the connected block. See
+ * [`ChannelMonitor::block_connected`] for details. Any HTLCs that were resolved on chain will
+ * be returned by [`chain::Watch::release_pending_monitor_events`].
+ *
+ * Calls back to [`chain::Filter`] if any monitor indicated new outputs to watch. Subsequent
+ * calls must not exclude any transactions matching the new outputs nor any in-block
+ * descendants of such transactions. It is not necessary to re-fetch the block to obtain
+ * updated `txdata`.
+ *
+ * [`ChannelMonitor::block_connected`]: ../channelmonitor/struct.ChannelMonitor.html#method.block_connected
+ * [`chain::Watch::release_pending_monitor_events`]: ../trait.Watch.html#tymethod.release_pending_monitor_events
+ * [`chain::Filter`]: ../trait.Filter.html
  */
-MUST_USE_RES LDKChainWatchedUtil ChainWatchedUtil_new(void);
+void ChainMonitor_block_connected(const LDKChainMonitor *this_arg, const uint8_t (*header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
 
 /**
- * Registers a tx for monitoring, returning true if it was a new tx and false if we'd already
- * been watching for it.
+ * Dispatches to per-channel monitors, which are responsible for updating their on-chain view
+ * of a channel based on the disconnected block. See [`ChannelMonitor::block_disconnected`] for
+ * details.
+ *
+ * [`ChannelMonitor::block_disconnected`]: ../channelmonitor/struct.ChannelMonitor.html#method.block_disconnected
  */
-MUST_USE_RES bool ChainWatchedUtil_register_tx(LDKChainWatchedUtil *this_arg, const uint8_t (*txid)[32], LDKu8slice script_pub_key);
+void ChainMonitor_block_disconnected(const LDKChainMonitor *this_arg, const uint8_t (*header)[80], uint32_t disconnected_height);
 
 /**
- * Registers an outpoint for monitoring, returning true if it was a new outpoint and false if
- * we'd already been watching for it
+ * Creates a new `ChainMonitor` used to watch on-chain activity pertaining to channels.
+ *
+ * When an optional chain source implementing [`chain::Filter`] is provided, the chain monitor
+ * will call back to it indicating transactions and outputs of interest. This allows clients to
+ * pre-filter blocks or only fetch blocks matching a compact filter. Otherwise, clients may
+ * always need to fetch full blocks absent another means for determining which blocks contain
+ * transactions relevant to the watched channels.
+ *
+ * [`chain::Filter`]: ../trait.Filter.html
  */
-MUST_USE_RES bool ChainWatchedUtil_register_outpoint(LDKChainWatchedUtil *this_arg, LDKC2Tuple_Txidu32Z outpoint, LDKu8slice _script_pub_key);
+MUST_USE_RES LDKChainMonitor ChainMonitor_new(LDKFilter *chain_source, LDKBroadcasterInterface broadcaster, LDKLogger logger, LDKFeeEstimator feeest);
+
+LDKWatch ChainMonitor_as_Watch(const LDKChainMonitor *this_arg);
+
+LDKEventsProvider ChainMonitor_as_EventsProvider(const LDKChainMonitor *this_arg);
+
+void ChannelMonitorUpdate_free(LDKChannelMonitorUpdate this_ptr);
 
 /**
- * Sets us to match all transactions, returning true if this is a new setting and false if
- * we'd already been set to match everything.
+ * 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.
+ *
+ * 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.
  */
-MUST_USE_RES bool ChainWatchedUtil_watch_all(LDKChainWatchedUtil *this_arg);
+uint64_t ChannelMonitorUpdate_get_update_id(const LDKChannelMonitorUpdate *this_ptr);
 
 /**
- * Checks if a given transaction matches the current filter.
+ * 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.
+ *
+ * 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.
  */
-MUST_USE_RES bool ChainWatchedUtil_does_match_tx(const LDKChainWatchedUtil *this_arg, LDKTransaction tx);
+void ChannelMonitorUpdate_set_update_id(LDKChannelMonitorUpdate *this_ptr, uint64_t val);
+
+LDKCVec_u8Z ChannelMonitorUpdate_write(const LDKChannelMonitorUpdate *obj);
+
+LDKChannelMonitorUpdate ChannelMonitorUpdate_read(LDKu8slice ser);
+
+void MonitorUpdateError_free(LDKMonitorUpdateError this_ptr);
+
+void MonitorEvent_free(LDKMonitorEvent this_ptr);
+
+void HTLCUpdate_free(LDKHTLCUpdate this_ptr);
+
+LDKCVec_u8Z HTLCUpdate_write(const LDKHTLCUpdate *obj);
+
+LDKHTLCUpdate HTLCUpdate_read(LDKu8slice ser);
+
+void ChannelMonitor_free(LDKChannelMonitor this_ptr);
 
-void BlockNotifier_free(LDKBlockNotifier this_ptr);
+/**
+ * Updates a ChannelMonitor on the basis of some new information provided by the Channel
+ * itself.
+ *
+ * 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);
 
 /**
- * Constructs a new BlockNotifier without any listeners.
+ * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this
+ * ChannelMonitor.
  */
-MUST_USE_RES LDKBlockNotifier BlockNotifier_new(LDKChainWatchInterface chain_monitor);
+MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const LDKChannelMonitor *this_arg);
 
 /**
- * Register the given listener to receive events.
+ * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for.
  */
-void BlockNotifier_register_listener(const LDKBlockNotifier *this_arg, LDKChainListener listener);
+MUST_USE_RES LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const LDKChannelMonitor *this_arg);
 
 /**
- * Notify listeners that a block was connected given a full, unfiltered block.
+ * Get the list of HTLCs who's status has been updated on chain. This should be called by
+ * ChannelManager via [`chain::Watch::release_pending_monitor_events`].
  *
- * Handles re-scanning the block and calling block_connected again if listeners register new
- * watch data during the callbacks for you (see ChainListener::block_connected for more info).
+ * [`chain::Watch::release_pending_monitor_events`]: ../trait.Watch.html#tymethod.release_pending_monitor_events
  */
-void BlockNotifier_block_connected(const LDKBlockNotifier *this_arg, LDKu8slice block, uint32_t height);
+MUST_USE_RES LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(LDKChannelMonitor *this_arg);
 
 /**
- * Notify listeners that a block was connected, given pre-filtered list of transactions in the
- * block which matched the filter (probably using does_match_tx).
+ * Gets the list of pending events which were generated by previous actions, clearing the list
+ * in the process.
  *
- * Returns true if notified listeners registered additional watch data (implying that the
- * block must be re-scanned and this function called again prior to further block_connected
- * calls, see ChainListener::block_connected for more info).
+ * This is called by ChainMonitor::get_and_clear_pending_events() and is equivalent to
+ * EventsProvider::get_and_clear_pending_events() except that it requires &mut self as we do
+ * no internal locking in ChannelMonitors.
  */
-MUST_USE_RES bool BlockNotifier_block_connected_checked(const LDKBlockNotifier *this_arg, const uint8_t (*header)[80], uint32_t height, LDKCVec_TransactionZ txn_matched, LDKusizeslice indexes_of_txn_matched);
+MUST_USE_RES LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(LDKChannelMonitor *this_arg);
 
 /**
- * Notify listeners that a block was disconnected.
+ * Used by ChannelManager deserialization to broadcast the latest holder state if its copy of
+ * the Channel was out-of-date. You may use it to get a broadcastable holder toxic tx in case of
+ * fallen-behind, i.e when receiving a channel_reestablish with a proof that our counterparty side knows
+ * a higher revocation secret than the holder commitment number we are aware of. Broadcasting these
+ * transactions are UNSAFE, as they allow counterparty side to punish you. Nevertheless you may want to
+ * broadcast them if counterparty don't close channel with his higher commitment transaction after a
+ * substantial amount of time (a month or even a year) to get back funds. Best may be to contact
+ * out-of-band the other node operator to coordinate with him if option is available to you.
+ * In any-case, choice is up to the user.
  */
-void BlockNotifier_block_disconnected(const LDKBlockNotifier *this_arg, const uint8_t (*header)[80], uint32_t disconnected_height);
-
-void ChainWatchInterfaceUtil_free(LDKChainWatchInterfaceUtil this_ptr);
-
-LDKChainWatchInterface ChainWatchInterfaceUtil_as_ChainWatchInterface(const LDKChainWatchInterfaceUtil *this_arg);
+MUST_USE_RES LDKCVec_TransactionZ ChannelMonitor_get_latest_holder_commitment_txn(LDKChannelMonitor *this_arg, const LDKLogger *logger);
 
 /**
- * Creates a new ChainWatchInterfaceUtil for the given network
+ * Processes transactions in a newly connected block, which may result in any of the following:
+ * - update the monitor's state against resolved HTLCs
+ * - punish the counterparty in the case of seeing a revoked commitment transaction
+ * - force close the channel and claim/timeout incoming/outgoing HTLCs if near expiration
+ * - detect settled outputs for later spending
+ * - schedule and bump any in-flight claims
+ *
+ * Returns any new outputs to watch from `txdata`; after called, these are also included in
+ * [`get_outputs_to_watch`].
+ *
+ * [`get_outputs_to_watch`]: #method.get_outputs_to_watch
  */
-MUST_USE_RES LDKChainWatchInterfaceUtil ChainWatchInterfaceUtil_new(LDKNetwork network);
+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);
 
 /**
- * Checks if a given transaction matches the current filter.
+ * Determines if the disconnected block contained any transactions of interest and updates
+ * appropriately.
  */
-MUST_USE_RES bool ChainWatchInterfaceUtil_does_match_tx(const LDKChainWatchInterfaceUtil *this_arg, LDKTransaction tx);
+void ChannelMonitor_block_disconnected(LDKChannelMonitor *this_arg, const uint8_t (*header)[80], uint32_t height, LDKBroadcasterInterface broadcaster, LDKFeeEstimator fee_estimator, LDKLogger logger);
 
 void OutPoint_free(LDKOutPoint this_ptr);
 
@@ -4082,12 +4128,8 @@ void PaymentSendFailure_free(LDKPaymentSendFailure this_ptr);
  *
  * Users need to notify the new ChannelManager when a new block is connected or
  * disconnected using its `block_connected` and `block_disconnected` methods.
- * However, rather than calling these methods directly, the user should register
- * the ChannelManager as a listener to the BlockNotifier and call the BlockNotifier's
- * `block_(dis)connected` methods, which will notify all registered listeners in one
- * go.
  */
-MUST_USE_RES LDKChannelManager ChannelManager_new(LDKNetwork network, LDKFeeEstimator fee_est, LDKManyChannelMonitor monitor, LDKBroadcasterInterface tx_broadcaster, LDKLogger logger, LDKKeysInterface keys_manager, LDKUserConfig config, uintptr_t current_blockchain_height);
+MUST_USE_RES LDKChannelManager ChannelManager_new(LDKNetwork network, LDKFeeEstimator fee_est, LDKWatch chain_monitor, LDKBroadcasterInterface tx_broadcaster, LDKLogger logger, LDKKeysInterface keys_manager, LDKUserConfig config, uintptr_t current_blockchain_height);
 
 /**
  * Creates a new outbound channel to the given remote node and with the given value.
@@ -4278,7 +4320,7 @@ MUST_USE_RES LDKPublicKey ChannelManager_get_our_node_id(const LDKChannelManager
  * exists largely only to prevent races between this and concurrent update_monitor calls.
  *
  * Thus, the anticipated use is, at a high level:
- *  1) You register a ManyChannelMonitor with this ChannelManager,
+ *  1) You register a chain::Watch with this ChannelManager,
  *  2) it stores each update to disk, and begins updating any remote (eg watchtower) copies of
  *     said ChannelMonitors as it can, returning ChannelMonitorUpdateErr::TemporaryFailures
  *     any time it cannot do so instantly,
@@ -4292,7 +4334,18 @@ LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const L
 
 LDKEventsProvider ChannelManager_as_EventsProvider(const LDKChannelManager *this_arg);
 
-LDKChainListener ChannelManager_as_ChainListener(const LDKChannelManager *this_arg);
+/**
+ * Updates channel state based on transactions seen in a connected block.
+ */
+void ChannelManager_block_connected(const LDKChannelManager *this_arg, const uint8_t (*header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
+
+/**
+ * Updates channel state based on a disconnected block.
+ *
+ * If necessary, the channel may be force-closed without letting the counterparty participate
+ * in the shutdown.
+ */
+void ChannelManager_block_disconnected(const LDKChannelManager *this_arg, const uint8_t (*header)[80]);
 
 LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const LDKChannelManager *this_arg);
 
@@ -4325,22 +4378,22 @@ const LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const LDKChannel
 void ChannelManagerReadArgs_set_fee_estimator(LDKChannelManagerReadArgs *this_ptr, LDKFeeEstimator val);
 
 /**
- * The ManyChannelMonitor for use in the ChannelManager in the future.
+ * The chain::Watch for use in the ChannelManager in the future.
  *
- * No calls to the ManyChannelMonitor will be made during deserialization. It is assumed that
+ * No calls to the chain::Watch will be made during deserialization. It is assumed that
  * you have deserialized ChannelMonitors separately and will add them to your
- * ManyChannelMonitor after deserializing this ChannelManager.
+ * chain::Watch after deserializing this ChannelManager.
  */
-const LDKManyChannelMonitor *ChannelManagerReadArgs_get_monitor(const LDKChannelManagerReadArgs *this_ptr);
+const LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const LDKChannelManagerReadArgs *this_ptr);
 
 /**
- * The ManyChannelMonitor for use in the ChannelManager in the future.
+ * The chain::Watch for use in the ChannelManager in the future.
  *
- * No calls to the ManyChannelMonitor will be made during deserialization. It is assumed that
+ * No calls to the chain::Watch will be made during deserialization. It is assumed that
  * you have deserialized ChannelMonitors separately and will add them to your
- * ManyChannelMonitor after deserializing this ChannelManager.
+ * chain::Watch after deserializing this ChannelManager.
  */
-void ChannelManagerReadArgs_set_monitor(LDKChannelManagerReadArgs *this_ptr, LDKManyChannelMonitor val);
+void ChannelManagerReadArgs_set_chain_monitor(LDKChannelManagerReadArgs *this_ptr, LDKWatch val);
 
 /**
  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
@@ -4385,100 +4438,7 @@ void ChannelManagerReadArgs_set_default_config(LDKChannelManagerReadArgs *this_p
  * HashMap for you. This is primarily useful for C bindings where it is not practical to
  * populate a HashMap directly from C.
  */
-MUST_USE_RES LDKChannelManagerReadArgs ChannelManagerReadArgs_new(LDKKeysInterface keys_manager, LDKFeeEstimator fee_estimator, LDKManyChannelMonitor monitor, LDKBroadcasterInterface tx_broadcaster, LDKLogger logger, LDKUserConfig default_config, LDKCVec_ChannelMonitorZ channel_monitors);
-
-void ChannelMonitorUpdate_free(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.
- *
- * 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.
- */
-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.
- *
- * 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.
- */
-void ChannelMonitorUpdate_set_update_id(LDKChannelMonitorUpdate *this_ptr, uint64_t val);
-
-LDKCVec_u8Z ChannelMonitorUpdate_write(const LDKChannelMonitorUpdate *obj);
-
-LDKChannelMonitorUpdate ChannelMonitorUpdate_read(LDKu8slice ser);
-
-void MonitorUpdateError_free(LDKMonitorUpdateError this_ptr);
-
-void MonitorEvent_free(LDKMonitorEvent this_ptr);
-
-void HTLCUpdate_free(LDKHTLCUpdate this_ptr);
-
-LDKCVec_u8Z HTLCUpdate_write(const LDKHTLCUpdate *obj);
-
-LDKHTLCUpdate HTLCUpdate_read(LDKu8slice ser);
-
-void ChannelMonitor_free(LDKChannelMonitor this_ptr);
-
-/**
- * Calls the free function if one is set
- */
-void ManyChannelMonitor_free(LDKManyChannelMonitor this_ptr);
-
-/**
- * Updates a ChannelMonitor on the basis of some new information provided by the Channel
- * itself.
- *
- * 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);
-
-/**
- * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this
- * ChannelMonitor.
- */
-MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const LDKChannelMonitor *this_arg);
-
-/**
- * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for.
- */
-MUST_USE_RES LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const LDKChannelMonitor *this_arg);
-
-/**
- * Get the list of HTLCs who's status has been updated on chain. This should be called by
- * ChannelManager via ManyChannelMonitor::get_and_clear_pending_monitor_events().
- */
-MUST_USE_RES LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(LDKChannelMonitor *this_arg);
-
-/**
- * Gets the list of pending events which were generated by previous actions, clearing the list
- * in the process.
- *
- * This is called by ManyChannelMonitor::get_and_clear_pending_events() and is equivalent to
- * EventsProvider::get_and_clear_pending_events() except that it requires &mut self as we do
- * no internal locking in ChannelMonitors.
- */
-MUST_USE_RES LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(LDKChannelMonitor *this_arg);
-
-/**
- * Used by ChannelManager deserialization to broadcast the latest holder state if its copy of
- * the Channel was out-of-date. You may use it to get a broadcastable holder toxic tx in case of
- * fallen-behind, i.e when receiving a channel_reestablish with a proof that our counterparty side knows
- * a higher revocation secret than the holder commitment number we are aware of. Broadcasting these
- * transactions are UNSAFE, as they allow counterparty side to punish you. Nevertheless you may want to
- * broadcast them if counterparty don't close channel with his higher commitment transaction after a
- * substantial amount of time (a month or even a year) to get back funds. Best may be to contact
- * out-of-band the other node operator to coordinate with him if option is available to you.
- * In any-case, choice is up to the user.
- */
-MUST_USE_RES LDKCVec_TransactionZ ChannelMonitor_get_latest_holder_commitment_txn(LDKChannelMonitor *this_arg, const LDKLogger *logger);
+MUST_USE_RES LDKChannelManagerReadArgs ChannelManagerReadArgs_new(LDKKeysInterface keys_manager, LDKFeeEstimator fee_estimator, LDKWatch chain_monitor, LDKBroadcasterInterface tx_broadcaster, LDKLogger logger, LDKUserConfig default_config, LDKCVec_ChannelMonitorZ channel_monitors);
 
 void DecodeError_free(LDKDecodeError this_ptr);
 
@@ -5365,6 +5325,16 @@ void NetAddress_free(LDKNetAddress this_ptr);
 
 void UnsignedNodeAnnouncement_free(LDKUnsignedNodeAnnouncement this_ptr);
 
+/**
+ * The advertised features
+ */
+LDKNodeFeatures UnsignedNodeAnnouncement_get_features(const LDKUnsignedNodeAnnouncement *this_ptr);
+
+/**
+ * The advertised features
+ */
+void UnsignedNodeAnnouncement_set_features(LDKUnsignedNodeAnnouncement *this_ptr, LDKNodeFeatures val);
+
 /**
  * A strictly monotonic announcement counter, with gaps allowed
  */
@@ -5440,6 +5410,16 @@ MUST_USE_RES LDKNodeAnnouncement NodeAnnouncement_new(LDKSignature signature_arg
 
 void UnsignedChannelAnnouncement_free(LDKUnsignedChannelAnnouncement this_ptr);
 
+/**
+ * The advertised channel features
+ */
+LDKChannelFeatures UnsignedChannelAnnouncement_get_features(const LDKUnsignedChannelAnnouncement *this_ptr);
+
+/**
+ * The advertised channel features
+ */
+void UnsignedChannelAnnouncement_set_features(LDKUnsignedChannelAnnouncement *this_ptr, LDKChannelFeatures val);
+
 /**
  * The genesis hash of the blockchain where the channel is to be opened
  */
@@ -6467,19 +6447,19 @@ LDKCVec_u8Z make_funding_redeemscript(LDKPublicKey broadcaster, LDKPublicKey cou
 /**
  * panics if htlc.transaction_output_index.is_none()!
  */
-LDKCVec_u8Z build_htlc_transaction(const uint8_t (*prev_hash)[32], uint32_t feerate_per_kw, uint16_t contest_delay, const LDKHTLCOutputInCommitment *htlc, LDKPublicKey broadcaster_delayed_payment_key, LDKPublicKey revocation_key);
+LDKTransaction build_htlc_transaction(const uint8_t (*prev_hash)[32], uint32_t feerate_per_kw, uint16_t contest_delay, const LDKHTLCOutputInCommitment *htlc, LDKPublicKey broadcaster_delayed_payment_key, LDKPublicKey revocation_key);
 
 void HolderCommitmentTransaction_free(LDKHolderCommitmentTransaction this_ptr);
 
 /**
  * The commitment transaction itself, in unsigned form.
  */
-LDKCVec_u8Z HolderCommitmentTransaction_get_unsigned_tx(const LDKHolderCommitmentTransaction *this_ptr);
+LDKTransaction HolderCommitmentTransaction_get_unsigned_tx(const LDKHolderCommitmentTransaction *this_ptr);
 
 /**
  * The commitment transaction itself, in unsigned form.
  */
-void HolderCommitmentTransaction_set_unsigned_tx(LDKHolderCommitmentTransaction *this_ptr, LDKCVec_u8Z val);
+void HolderCommitmentTransaction_set_unsigned_tx(LDKHolderCommitmentTransaction *this_ptr, LDKTransaction val);
 
 /**
  * Our counterparty's signature for the transaction, above.
@@ -6522,7 +6502,7 @@ void HolderCommitmentTransaction_set_per_htlc(LDKHolderCommitmentTransaction *th
  * The unsigned transaction outputs must be consistent with htlc_data.  This function
  * only checks that the shape and amounts are consistent, but does not check the scriptPubkey.
  */
-MUST_USE_RES LDKHolderCommitmentTransaction HolderCommitmentTransaction_new_missing_holder_sig(LDKCVec_u8Z unsigned_tx, LDKSignature counterparty_sig, LDKPublicKey holder_funding_key, LDKPublicKey counterparty_funding_key, LDKTxCreationKeys keys, uint32_t feerate_per_kw, LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ htlc_data);
+MUST_USE_RES LDKHolderCommitmentTransaction HolderCommitmentTransaction_new_missing_holder_sig(LDKTransaction unsigned_tx, LDKSignature counterparty_sig, LDKPublicKey holder_funding_key, LDKPublicKey counterparty_funding_key, LDKTxCreationKeys keys, uint32_t feerate_per_kw, LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ htlc_data);
 
 /**
  * The pre-calculated transaction creation public keys.
@@ -6580,6 +6560,18 @@ LDKPublicKey RouteHop_get_pubkey(const LDKRouteHop *this_ptr);
  */
 void RouteHop_set_pubkey(LDKRouteHop *this_ptr, LDKPublicKey val);
 
+/**
+ * The node_announcement features of the node at this hop. For the last hop, these may be
+ * amended to match the features present in the invoice this node generated.
+ */
+LDKNodeFeatures RouteHop_get_node_features(const LDKRouteHop *this_ptr);
+
+/**
+ * The node_announcement features of the node at this hop. For the last hop, these may be
+ * amended to match the features present in the invoice this node generated.
+ */
+void RouteHop_set_node_features(LDKRouteHop *this_ptr, LDKNodeFeatures val);
+
 /**
  * The channel that should be used from the previous hop to reach this node.
  */
@@ -6590,6 +6582,18 @@ uint64_t RouteHop_get_short_channel_id(const LDKRouteHop *this_ptr);
  */
 void RouteHop_set_short_channel_id(LDKRouteHop *this_ptr, uint64_t val);
 
+/**
+ * The channel_announcement features of the channel that should be used from the previous hop
+ * to reach this node.
+ */
+LDKChannelFeatures RouteHop_get_channel_features(const LDKRouteHop *this_ptr);
+
+/**
+ * The channel_announcement features of the channel that should be used from the previous hop
+ * to reach this node.
+ */
+void RouteHop_set_channel_features(LDKRouteHop *this_ptr, LDKChannelFeatures val);
+
 /**
  * The fee taken on this hop. For the last hop, this should be the full value of the payment.
  */
@@ -6612,6 +6616,8 @@ uint32_t RouteHop_get_cltv_expiry_delta(const LDKRouteHop *this_ptr);
  */
 void RouteHop_set_cltv_expiry_delta(LDKRouteHop *this_ptr, uint32_t val);
 
+MUST_USE_RES LDKRouteHop RouteHop_new(LDKPublicKey pubkey_arg, LDKNodeFeatures node_features_arg, uint64_t short_channel_id_arg, LDKChannelFeatures channel_features_arg, uint64_t fee_msat_arg, uint32_t cltv_expiry_delta_arg);
+
 void Route_free(LDKRoute this_ptr);
 
 /**
@@ -6717,13 +6723,13 @@ void NetGraphMsgHandler_free(LDKNetGraphMsgHandler this_ptr);
  * channel data is correct, and that the announcement is signed with
  * channel owners' keys.
  */
-MUST_USE_RES LDKNetGraphMsgHandler NetGraphMsgHandler_new(LDKChainWatchInterface chain_monitor, LDKLogger logger);
+MUST_USE_RES LDKNetGraphMsgHandler NetGraphMsgHandler_new(LDKAccess *chain_access, LDKLogger logger);
 
 /**
  * Creates a new tracker of the actual state of the network of channels and nodes,
  * assuming an existing Network Graph.
  */
-MUST_USE_RES LDKNetGraphMsgHandler NetGraphMsgHandler_from_net_graph(LDKChainWatchInterface chain_monitor, LDKLogger logger, LDKNetworkGraph network_graph);
+MUST_USE_RES LDKNetGraphMsgHandler NetGraphMsgHandler_from_net_graph(LDKAccess *chain_access, LDKLogger logger, LDKNetworkGraph network_graph);
 
 /**
  * Take a read lock on the network_graph and return it in the C-bindings
@@ -6806,6 +6812,16 @@ LDKDirectionalChannelInfo DirectionalChannelInfo_read(LDKu8slice ser);
 
 void ChannelInfo_free(LDKChannelInfo this_ptr);
 
+/**
+ * Protocol features of a channel communicated during its announcement
+ */
+LDKChannelFeatures ChannelInfo_get_features(const LDKChannelInfo *this_ptr);
+
+/**
+ * Protocol features of a channel communicated during its announcement
+ */
+void ChannelInfo_set_features(LDKChannelInfo *this_ptr, LDKChannelFeatures val);
+
 /**
  * Source node of the first direction of a channel
  */
@@ -6898,6 +6914,16 @@ LDKCVec_u8Z RoutingFees_write(const LDKRoutingFees *obj);
 
 void NodeAnnouncementInfo_free(LDKNodeAnnouncementInfo this_ptr);
 
+/**
+ * Protocol features the node announced support for
+ */
+LDKNodeFeatures NodeAnnouncementInfo_get_features(const LDKNodeAnnouncementInfo *this_ptr);
+
+/**
+ * Protocol features the node announced support for
+ */
+void NodeAnnouncementInfo_set_features(LDKNodeAnnouncementInfo *this_ptr, LDKNodeFeatures val);
+
 /**
  * When the last known update to the node state was issued.
  * Value is opaque, as set in the announcement.
@@ -6955,6 +6981,8 @@ LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const LDKNodeA
  */
 void NodeAnnouncementInfo_set_announcement_message(LDKNodeAnnouncementInfo *this_ptr, LDKNodeAnnouncement val);
 
+MUST_USE_RES LDKNodeAnnouncementInfo NodeAnnouncementInfo_new(LDKNodeFeatures features_arg, uint32_t last_update_arg, LDKThreeBytes rgb_arg, LDKThirtyTwoBytes alias_arg, LDKCVec_NetAddressZ addresses_arg, LDKNodeAnnouncement announcement_message_arg);
+
 LDKCVec_u8Z NodeAnnouncementInfo_write(const LDKNodeAnnouncementInfo *obj);
 
 LDKNodeAnnouncementInfo NodeAnnouncementInfo_read(LDKu8slice ser);
index d14cd5cc40e4c8e49a8a0289482efcc62c35b166..233038bb69174d61c310d8bf8e544fe3c12809b8 100644 (file)
@@ -153,33 +153,6 @@ public:
        const LDKUserConfig* operator &() const { return &self; }
        const LDKUserConfig* operator ->() const { return &self; }
 };
-class ChainError {
-private:
-       LDKChainError self;
-public:
-       ChainError(const ChainError&) = delete;
-       ChainError(ChainError&& o) : self(o.self) { memset(&o, 0, sizeof(ChainError)); }
-       ChainError(LDKChainError&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChainError)); }
-       operator LDKChainError() { LDKChainError res = self; memset(&self, 0, sizeof(LDKChainError)); return res; }
-       LDKChainError* operator &() { return &self; }
-       LDKChainError* operator ->() { return &self; }
-       const LDKChainError* operator &() const { return &self; }
-       const LDKChainError* operator ->() const { return &self; }
-};
-class ChainWatchInterface {
-private:
-       LDKChainWatchInterface self;
-public:
-       ChainWatchInterface(const ChainWatchInterface&) = delete;
-       ~ChainWatchInterface() { ChainWatchInterface_free(self); }
-       ChainWatchInterface(ChainWatchInterface&& o) : self(o.self) { memset(&o, 0, sizeof(ChainWatchInterface)); }
-       ChainWatchInterface(LDKChainWatchInterface&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChainWatchInterface)); }
-       operator LDKChainWatchInterface() { LDKChainWatchInterface res = self; memset(&self, 0, sizeof(LDKChainWatchInterface)); return res; }
-       LDKChainWatchInterface* operator &() { return &self; }
-       LDKChainWatchInterface* operator ->() { return &self; }
-       const LDKChainWatchInterface* operator &() const { return &self; }
-       const LDKChainWatchInterface* operator ->() const { return &self; }
-};
 class BroadcasterInterface {
 private:
        LDKBroadcasterInterface self;
@@ -194,20 +167,6 @@ public:
        const LDKBroadcasterInterface* operator &() const { return &self; }
        const LDKBroadcasterInterface* operator ->() const { return &self; }
 };
-class ChainListener {
-private:
-       LDKChainListener self;
-public:
-       ChainListener(const ChainListener&) = delete;
-       ~ChainListener() { ChainListener_free(self); }
-       ChainListener(ChainListener&& o) : self(o.self) { memset(&o, 0, sizeof(ChainListener)); }
-       ChainListener(LDKChainListener&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChainListener)); }
-       operator LDKChainListener() { LDKChainListener res = self; memset(&self, 0, sizeof(LDKChainListener)); return res; }
-       LDKChainListener* operator &() { return &self; }
-       LDKChainListener* operator ->() { return &self; }
-       const LDKChainListener* operator &() const { return &self; }
-       const LDKChainListener* operator ->() const { return &self; }
-};
 class ConfirmationTarget {
 private:
        LDKConfirmationTarget self;
@@ -235,47 +194,102 @@ public:
        const LDKFeeEstimator* operator &() const { return &self; }
        const LDKFeeEstimator* operator ->() const { return &self; }
 };
-class ChainWatchedUtil {
+class ChainMonitor {
+private:
+       LDKChainMonitor self;
+public:
+       ChainMonitor(const ChainMonitor&) = delete;
+       ~ChainMonitor() { ChainMonitor_free(self); }
+       ChainMonitor(ChainMonitor&& o) : self(o.self) { memset(&o, 0, sizeof(ChainMonitor)); }
+       ChainMonitor(LDKChainMonitor&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChainMonitor)); }
+       operator LDKChainMonitor() { LDKChainMonitor res = self; memset(&self, 0, sizeof(LDKChainMonitor)); return res; }
+       LDKChainMonitor* operator &() { return &self; }
+       LDKChainMonitor* operator ->() { return &self; }
+       const LDKChainMonitor* operator &() const { return &self; }
+       const LDKChainMonitor* operator ->() const { return &self; }
+};
+class ChannelMonitorUpdate {
+private:
+       LDKChannelMonitorUpdate self;
+public:
+       ChannelMonitorUpdate(const ChannelMonitorUpdate&) = delete;
+       ~ChannelMonitorUpdate() { ChannelMonitorUpdate_free(self); }
+       ChannelMonitorUpdate(ChannelMonitorUpdate&& o) : self(o.self) { memset(&o, 0, sizeof(ChannelMonitorUpdate)); }
+       ChannelMonitorUpdate(LDKChannelMonitorUpdate&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChannelMonitorUpdate)); }
+       operator LDKChannelMonitorUpdate() { LDKChannelMonitorUpdate res = self; memset(&self, 0, sizeof(LDKChannelMonitorUpdate)); return res; }
+       LDKChannelMonitorUpdate* operator &() { return &self; }
+       LDKChannelMonitorUpdate* operator ->() { return &self; }
+       const LDKChannelMonitorUpdate* operator &() const { return &self; }
+       const LDKChannelMonitorUpdate* operator ->() const { return &self; }
+};
+class ChannelMonitorUpdateErr {
+private:
+       LDKChannelMonitorUpdateErr self;
+public:
+       ChannelMonitorUpdateErr(const ChannelMonitorUpdateErr&) = delete;
+       ChannelMonitorUpdateErr(ChannelMonitorUpdateErr&& o) : self(o.self) { memset(&o, 0, sizeof(ChannelMonitorUpdateErr)); }
+       ChannelMonitorUpdateErr(LDKChannelMonitorUpdateErr&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChannelMonitorUpdateErr)); }
+       operator LDKChannelMonitorUpdateErr() { LDKChannelMonitorUpdateErr res = self; memset(&self, 0, sizeof(LDKChannelMonitorUpdateErr)); return res; }
+       LDKChannelMonitorUpdateErr* operator &() { return &self; }
+       LDKChannelMonitorUpdateErr* operator ->() { return &self; }
+       const LDKChannelMonitorUpdateErr* operator &() const { return &self; }
+       const LDKChannelMonitorUpdateErr* operator ->() const { return &self; }
+};
+class MonitorUpdateError {
+private:
+       LDKMonitorUpdateError self;
+public:
+       MonitorUpdateError(const MonitorUpdateError&) = delete;
+       ~MonitorUpdateError() { MonitorUpdateError_free(self); }
+       MonitorUpdateError(MonitorUpdateError&& o) : self(o.self) { memset(&o, 0, sizeof(MonitorUpdateError)); }
+       MonitorUpdateError(LDKMonitorUpdateError&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKMonitorUpdateError)); }
+       operator LDKMonitorUpdateError() { LDKMonitorUpdateError res = self; memset(&self, 0, sizeof(LDKMonitorUpdateError)); return res; }
+       LDKMonitorUpdateError* operator &() { return &self; }
+       LDKMonitorUpdateError* operator ->() { return &self; }
+       const LDKMonitorUpdateError* operator &() const { return &self; }
+       const LDKMonitorUpdateError* operator ->() const { return &self; }
+};
+class MonitorEvent {
 private:
-       LDKChainWatchedUtil self;
+       LDKMonitorEvent self;
 public:
-       ChainWatchedUtil(const ChainWatchedUtil&) = delete;
-       ~ChainWatchedUtil() { ChainWatchedUtil_free(self); }
-       ChainWatchedUtil(ChainWatchedUtil&& o) : self(o.self) { memset(&o, 0, sizeof(ChainWatchedUtil)); }
-       ChainWatchedUtil(LDKChainWatchedUtil&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChainWatchedUtil)); }
-       operator LDKChainWatchedUtil() { LDKChainWatchedUtil res = self; memset(&self, 0, sizeof(LDKChainWatchedUtil)); return res; }
-       LDKChainWatchedUtil* operator &() { return &self; }
-       LDKChainWatchedUtil* operator ->() { return &self; }
-       const LDKChainWatchedUtil* operator &() const { return &self; }
-       const LDKChainWatchedUtil* operator ->() const { return &self; }
+       MonitorEvent(const MonitorEvent&) = delete;
+       ~MonitorEvent() { MonitorEvent_free(self); }
+       MonitorEvent(MonitorEvent&& o) : self(o.self) { memset(&o, 0, sizeof(MonitorEvent)); }
+       MonitorEvent(LDKMonitorEvent&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKMonitorEvent)); }
+       operator LDKMonitorEvent() { LDKMonitorEvent res = self; memset(&self, 0, sizeof(LDKMonitorEvent)); return res; }
+       LDKMonitorEvent* operator &() { return &self; }
+       LDKMonitorEvent* operator ->() { return &self; }
+       const LDKMonitorEvent* operator &() const { return &self; }
+       const LDKMonitorEvent* operator ->() const { return &self; }
 };
-class BlockNotifier {
+class HTLCUpdate {
 private:
-       LDKBlockNotifier self;
+       LDKHTLCUpdate self;
 public:
-       BlockNotifier(const BlockNotifier&) = delete;
-       ~BlockNotifier() { BlockNotifier_free(self); }
-       BlockNotifier(BlockNotifier&& o) : self(o.self) { memset(&o, 0, sizeof(BlockNotifier)); }
-       BlockNotifier(LDKBlockNotifier&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKBlockNotifier)); }
-       operator LDKBlockNotifier() { LDKBlockNotifier res = self; memset(&self, 0, sizeof(LDKBlockNotifier)); return res; }
-       LDKBlockNotifier* operator &() { return &self; }
-       LDKBlockNotifier* operator ->() { return &self; }
-       const LDKBlockNotifier* operator &() const { return &self; }
-       const LDKBlockNotifier* operator ->() const { return &self; }
+       HTLCUpdate(const HTLCUpdate&) = delete;
+       ~HTLCUpdate() { HTLCUpdate_free(self); }
+       HTLCUpdate(HTLCUpdate&& o) : self(o.self) { memset(&o, 0, sizeof(HTLCUpdate)); }
+       HTLCUpdate(LDKHTLCUpdate&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKHTLCUpdate)); }
+       operator LDKHTLCUpdate() { LDKHTLCUpdate res = self; memset(&self, 0, sizeof(LDKHTLCUpdate)); return res; }
+       LDKHTLCUpdate* operator &() { return &self; }
+       LDKHTLCUpdate* operator ->() { return &self; }
+       const LDKHTLCUpdate* operator &() const { return &self; }
+       const LDKHTLCUpdate* operator ->() const { return &self; }
 };
-class ChainWatchInterfaceUtil {
+class ChannelMonitor {
 private:
-       LDKChainWatchInterfaceUtil self;
+       LDKChannelMonitor self;
 public:
-       ChainWatchInterfaceUtil(const ChainWatchInterfaceUtil&) = delete;
-       ~ChainWatchInterfaceUtil() { ChainWatchInterfaceUtil_free(self); }
-       ChainWatchInterfaceUtil(ChainWatchInterfaceUtil&& o) : self(o.self) { memset(&o, 0, sizeof(ChainWatchInterfaceUtil)); }
-       ChainWatchInterfaceUtil(LDKChainWatchInterfaceUtil&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChainWatchInterfaceUtil)); }
-       operator LDKChainWatchInterfaceUtil() { LDKChainWatchInterfaceUtil res = self; memset(&self, 0, sizeof(LDKChainWatchInterfaceUtil)); return res; }
-       LDKChainWatchInterfaceUtil* operator &() { return &self; }
-       LDKChainWatchInterfaceUtil* operator ->() { return &self; }
-       const LDKChainWatchInterfaceUtil* operator &() const { return &self; }
-       const LDKChainWatchInterfaceUtil* operator ->() const { return &self; }
+       ChannelMonitor(const ChannelMonitor&) = delete;
+       ~ChannelMonitor() { ChannelMonitor_free(self); }
+       ChannelMonitor(ChannelMonitor&& o) : self(o.self) { memset(&o, 0, sizeof(ChannelMonitor)); }
+       ChannelMonitor(LDKChannelMonitor&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChannelMonitor)); }
+       operator LDKChannelMonitor() { LDKChannelMonitor res = self; memset(&self, 0, sizeof(LDKChannelMonitor)); return res; }
+       LDKChannelMonitor* operator &() { return &self; }
+       LDKChannelMonitor* operator ->() { return &self; }
+       const LDKChannelMonitor* operator &() const { return &self; }
+       const LDKChannelMonitor* operator ->() const { return &self; }
 };
 class OutPoint {
 private:
@@ -361,6 +375,61 @@ public:
        const LDKKeysManager* operator &() const { return &self; }
        const LDKKeysManager* operator ->() const { return &self; }
 };
+class AccessError {
+private:
+       LDKAccessError self;
+public:
+       AccessError(const AccessError&) = delete;
+       AccessError(AccessError&& o) : self(o.self) { memset(&o, 0, sizeof(AccessError)); }
+       AccessError(LDKAccessError&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKAccessError)); }
+       operator LDKAccessError() { LDKAccessError res = self; memset(&self, 0, sizeof(LDKAccessError)); return res; }
+       LDKAccessError* operator &() { return &self; }
+       LDKAccessError* operator ->() { return &self; }
+       const LDKAccessError* operator &() const { return &self; }
+       const LDKAccessError* operator ->() const { return &self; }
+};
+class Access {
+private:
+       LDKAccess self;
+public:
+       Access(const Access&) = delete;
+       ~Access() { Access_free(self); }
+       Access(Access&& o) : self(o.self) { memset(&o, 0, sizeof(Access)); }
+       Access(LDKAccess&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKAccess)); }
+       operator LDKAccess() { LDKAccess res = self; memset(&self, 0, sizeof(LDKAccess)); return res; }
+       LDKAccess* operator &() { return &self; }
+       LDKAccess* operator ->() { return &self; }
+       const LDKAccess* operator &() const { return &self; }
+       const LDKAccess* operator ->() const { return &self; }
+};
+class Watch {
+private:
+       LDKWatch self;
+public:
+       Watch(const Watch&) = delete;
+       ~Watch() { Watch_free(self); }
+       Watch(Watch&& o) : self(o.self) { memset(&o, 0, sizeof(Watch)); }
+       Watch(LDKWatch&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKWatch)); }
+       operator LDKWatch() { LDKWatch res = self; memset(&self, 0, sizeof(LDKWatch)); return res; }
+       LDKWatch* operator &() { return &self; }
+       LDKWatch* operator ->() { return &self; }
+       const LDKWatch* operator &() const { return &self; }
+       const LDKWatch* operator ->() const { return &self; }
+};
+class Filter {
+private:
+       LDKFilter self;
+public:
+       Filter(const Filter&) = delete;
+       ~Filter() { Filter_free(self); }
+       Filter(Filter&& o) : self(o.self) { memset(&o, 0, sizeof(Filter)); }
+       Filter(LDKFilter&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKFilter)); }
+       operator LDKFilter() { LDKFilter res = self; memset(&self, 0, sizeof(LDKFilter)); return res; }
+       LDKFilter* operator &() { return &self; }
+       LDKFilter* operator ->() { return &self; }
+       const LDKFilter* operator &() const { return &self; }
+       const LDKFilter* operator ->() const { return &self; }
+};
 class ChannelManager {
 private:
        LDKChannelManager self;
@@ -417,103 +486,6 @@ public:
        const LDKChannelManagerReadArgs* operator &() const { return &self; }
        const LDKChannelManagerReadArgs* operator ->() const { return &self; }
 };
-class ChannelMonitorUpdate {
-private:
-       LDKChannelMonitorUpdate self;
-public:
-       ChannelMonitorUpdate(const ChannelMonitorUpdate&) = delete;
-       ~ChannelMonitorUpdate() { ChannelMonitorUpdate_free(self); }
-       ChannelMonitorUpdate(ChannelMonitorUpdate&& o) : self(o.self) { memset(&o, 0, sizeof(ChannelMonitorUpdate)); }
-       ChannelMonitorUpdate(LDKChannelMonitorUpdate&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChannelMonitorUpdate)); }
-       operator LDKChannelMonitorUpdate() { LDKChannelMonitorUpdate res = self; memset(&self, 0, sizeof(LDKChannelMonitorUpdate)); return res; }
-       LDKChannelMonitorUpdate* operator &() { return &self; }
-       LDKChannelMonitorUpdate* operator ->() { return &self; }
-       const LDKChannelMonitorUpdate* operator &() const { return &self; }
-       const LDKChannelMonitorUpdate* operator ->() const { return &self; }
-};
-class ChannelMonitorUpdateErr {
-private:
-       LDKChannelMonitorUpdateErr self;
-public:
-       ChannelMonitorUpdateErr(const ChannelMonitorUpdateErr&) = delete;
-       ChannelMonitorUpdateErr(ChannelMonitorUpdateErr&& o) : self(o.self) { memset(&o, 0, sizeof(ChannelMonitorUpdateErr)); }
-       ChannelMonitorUpdateErr(LDKChannelMonitorUpdateErr&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChannelMonitorUpdateErr)); }
-       operator LDKChannelMonitorUpdateErr() { LDKChannelMonitorUpdateErr res = self; memset(&self, 0, sizeof(LDKChannelMonitorUpdateErr)); return res; }
-       LDKChannelMonitorUpdateErr* operator &() { return &self; }
-       LDKChannelMonitorUpdateErr* operator ->() { return &self; }
-       const LDKChannelMonitorUpdateErr* operator &() const { return &self; }
-       const LDKChannelMonitorUpdateErr* operator ->() const { return &self; }
-};
-class MonitorUpdateError {
-private:
-       LDKMonitorUpdateError self;
-public:
-       MonitorUpdateError(const MonitorUpdateError&) = delete;
-       ~MonitorUpdateError() { MonitorUpdateError_free(self); }
-       MonitorUpdateError(MonitorUpdateError&& o) : self(o.self) { memset(&o, 0, sizeof(MonitorUpdateError)); }
-       MonitorUpdateError(LDKMonitorUpdateError&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKMonitorUpdateError)); }
-       operator LDKMonitorUpdateError() { LDKMonitorUpdateError res = self; memset(&self, 0, sizeof(LDKMonitorUpdateError)); return res; }
-       LDKMonitorUpdateError* operator &() { return &self; }
-       LDKMonitorUpdateError* operator ->() { return &self; }
-       const LDKMonitorUpdateError* operator &() const { return &self; }
-       const LDKMonitorUpdateError* operator ->() const { return &self; }
-};
-class MonitorEvent {
-private:
-       LDKMonitorEvent self;
-public:
-       MonitorEvent(const MonitorEvent&) = delete;
-       ~MonitorEvent() { MonitorEvent_free(self); }
-       MonitorEvent(MonitorEvent&& o) : self(o.self) { memset(&o, 0, sizeof(MonitorEvent)); }
-       MonitorEvent(LDKMonitorEvent&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKMonitorEvent)); }
-       operator LDKMonitorEvent() { LDKMonitorEvent res = self; memset(&self, 0, sizeof(LDKMonitorEvent)); return res; }
-       LDKMonitorEvent* operator &() { return &self; }
-       LDKMonitorEvent* operator ->() { return &self; }
-       const LDKMonitorEvent* operator &() const { return &self; }
-       const LDKMonitorEvent* operator ->() const { return &self; }
-};
-class HTLCUpdate {
-private:
-       LDKHTLCUpdate self;
-public:
-       HTLCUpdate(const HTLCUpdate&) = delete;
-       ~HTLCUpdate() { HTLCUpdate_free(self); }
-       HTLCUpdate(HTLCUpdate&& o) : self(o.self) { memset(&o, 0, sizeof(HTLCUpdate)); }
-       HTLCUpdate(LDKHTLCUpdate&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKHTLCUpdate)); }
-       operator LDKHTLCUpdate() { LDKHTLCUpdate res = self; memset(&self, 0, sizeof(LDKHTLCUpdate)); return res; }
-       LDKHTLCUpdate* operator &() { return &self; }
-       LDKHTLCUpdate* operator ->() { return &self; }
-       const LDKHTLCUpdate* operator &() const { return &self; }
-       const LDKHTLCUpdate* operator ->() const { return &self; }
-};
-class ChannelMonitor {
-private:
-       LDKChannelMonitor self;
-public:
-       ChannelMonitor(const ChannelMonitor&) = delete;
-       ~ChannelMonitor() { ChannelMonitor_free(self); }
-       ChannelMonitor(ChannelMonitor&& o) : self(o.self) { memset(&o, 0, sizeof(ChannelMonitor)); }
-       ChannelMonitor(LDKChannelMonitor&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChannelMonitor)); }
-       operator LDKChannelMonitor() { LDKChannelMonitor res = self; memset(&self, 0, sizeof(LDKChannelMonitor)); return res; }
-       LDKChannelMonitor* operator &() { return &self; }
-       LDKChannelMonitor* operator ->() { return &self; }
-       const LDKChannelMonitor* operator &() const { return &self; }
-       const LDKChannelMonitor* operator ->() const { return &self; }
-};
-class ManyChannelMonitor {
-private:
-       LDKManyChannelMonitor self;
-public:
-       ManyChannelMonitor(const ManyChannelMonitor&) = delete;
-       ~ManyChannelMonitor() { ManyChannelMonitor_free(self); }
-       ManyChannelMonitor(ManyChannelMonitor&& o) : self(o.self) { memset(&o, 0, sizeof(ManyChannelMonitor)); }
-       ManyChannelMonitor(LDKManyChannelMonitor&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKManyChannelMonitor)); }
-       operator LDKManyChannelMonitor() { LDKManyChannelMonitor res = self; memset(&self, 0, sizeof(LDKManyChannelMonitor)); return res; }
-       LDKManyChannelMonitor* operator &() { return &self; }
-       LDKManyChannelMonitor* operator ->() { return &self; }
-       const LDKManyChannelMonitor* operator &() const { return &self; }
-       const LDKManyChannelMonitor* operator ->() const { return &self; }
-};
 class DecodeError {
 private:
        LDKDecodeError self;
@@ -1396,131 +1368,159 @@ public:
        const LDKNodeInfo* operator &() const { return &self; }
        const LDKNodeInfo* operator ->() const { return &self; }
 };
-class CResult_PublicKeySecpErrorZ {
+class CVec_UpdateFulfillHTLCZ {
 private:
-       LDKCResult_PublicKeySecpErrorZ self;
+       LDKCVec_UpdateFulfillHTLCZ self;
 public:
-       CResult_PublicKeySecpErrorZ(const CResult_PublicKeySecpErrorZ&) = delete;
-       ~CResult_PublicKeySecpErrorZ() { CResult_PublicKeySecpErrorZ_free(self); }
-       CResult_PublicKeySecpErrorZ(CResult_PublicKeySecpErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PublicKeySecpErrorZ)); }
-       CResult_PublicKeySecpErrorZ(LDKCResult_PublicKeySecpErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PublicKeySecpErrorZ)); }
-       operator LDKCResult_PublicKeySecpErrorZ() { LDKCResult_PublicKeySecpErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PublicKeySecpErrorZ)); return res; }
-       LDKCResult_PublicKeySecpErrorZ* operator &() { return &self; }
-       LDKCResult_PublicKeySecpErrorZ* operator ->() { return &self; }
-       const LDKCResult_PublicKeySecpErrorZ* operator &() const { return &self; }
-       const LDKCResult_PublicKeySecpErrorZ* operator ->() const { return &self; }
+       CVec_UpdateFulfillHTLCZ(const CVec_UpdateFulfillHTLCZ&) = delete;
+       ~CVec_UpdateFulfillHTLCZ() { CVec_UpdateFulfillHTLCZ_free(self); }
+       CVec_UpdateFulfillHTLCZ(CVec_UpdateFulfillHTLCZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_UpdateFulfillHTLCZ)); }
+       CVec_UpdateFulfillHTLCZ(LDKCVec_UpdateFulfillHTLCZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_UpdateFulfillHTLCZ)); }
+       operator LDKCVec_UpdateFulfillHTLCZ() { LDKCVec_UpdateFulfillHTLCZ res = self; memset(&self, 0, sizeof(LDKCVec_UpdateFulfillHTLCZ)); return res; }
+       LDKCVec_UpdateFulfillHTLCZ* operator &() { return &self; }
+       LDKCVec_UpdateFulfillHTLCZ* operator ->() { return &self; }
+       const LDKCVec_UpdateFulfillHTLCZ* operator &() const { return &self; }
+       const LDKCVec_UpdateFulfillHTLCZ* operator ->() const { return &self; }
 };
-class CVec_u8Z {
+class CResult_NoneAPIErrorZ {
 private:
-       LDKCVec_u8Z self;
+       LDKCResult_NoneAPIErrorZ self;
 public:
-       CVec_u8Z(const CVec_u8Z&) = delete;
-       ~CVec_u8Z() { CVec_u8Z_free(self); }
-       CVec_u8Z(CVec_u8Z&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_u8Z)); }
-       CVec_u8Z(LDKCVec_u8Z&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_u8Z)); }
-       operator LDKCVec_u8Z() { LDKCVec_u8Z res = self; memset(&self, 0, sizeof(LDKCVec_u8Z)); return res; }
-       LDKCVec_u8Z* operator &() { return &self; }
-       LDKCVec_u8Z* operator ->() { return &self; }
-       const LDKCVec_u8Z* operator &() const { return &self; }
-       const LDKCVec_u8Z* operator ->() const { return &self; }
+       CResult_NoneAPIErrorZ(const CResult_NoneAPIErrorZ&) = delete;
+       ~CResult_NoneAPIErrorZ() { CResult_NoneAPIErrorZ_free(self); }
+       CResult_NoneAPIErrorZ(CResult_NoneAPIErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NoneAPIErrorZ)); }
+       CResult_NoneAPIErrorZ(LDKCResult_NoneAPIErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NoneAPIErrorZ)); }
+       operator LDKCResult_NoneAPIErrorZ() { LDKCResult_NoneAPIErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NoneAPIErrorZ)); return res; }
+       LDKCResult_NoneAPIErrorZ* operator &() { return &self; }
+       LDKCResult_NoneAPIErrorZ* operator ->() { return &self; }
+       const LDKCResult_NoneAPIErrorZ* operator &() const { return &self; }
+       const LDKCResult_NoneAPIErrorZ* operator ->() const { return &self; }
 };
-class CResult_NoneMonitorUpdateErrorZ {
+class C2Tuple_SignatureCVec_SignatureZZ {
 private:
-       LDKCResult_NoneMonitorUpdateErrorZ self;
+       LDKC2Tuple_SignatureCVec_SignatureZZ self;
 public:
-       CResult_NoneMonitorUpdateErrorZ(const CResult_NoneMonitorUpdateErrorZ&) = delete;
-       ~CResult_NoneMonitorUpdateErrorZ() { CResult_NoneMonitorUpdateErrorZ_free(self); }
-       CResult_NoneMonitorUpdateErrorZ(CResult_NoneMonitorUpdateErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NoneMonitorUpdateErrorZ)); }
-       CResult_NoneMonitorUpdateErrorZ(LDKCResult_NoneMonitorUpdateErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NoneMonitorUpdateErrorZ)); }
-       operator LDKCResult_NoneMonitorUpdateErrorZ() { LDKCResult_NoneMonitorUpdateErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NoneMonitorUpdateErrorZ)); return res; }
-       LDKCResult_NoneMonitorUpdateErrorZ* operator &() { return &self; }
-       LDKCResult_NoneMonitorUpdateErrorZ* operator ->() { return &self; }
-       const LDKCResult_NoneMonitorUpdateErrorZ* operator &() const { return &self; }
-       const LDKCResult_NoneMonitorUpdateErrorZ* operator ->() const { return &self; }
+       C2Tuple_SignatureCVec_SignatureZZ(const C2Tuple_SignatureCVec_SignatureZZ&) = delete;
+       ~C2Tuple_SignatureCVec_SignatureZZ() { C2Tuple_SignatureCVec_SignatureZZ_free(self); }
+       C2Tuple_SignatureCVec_SignatureZZ(C2Tuple_SignatureCVec_SignatureZZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_SignatureCVec_SignatureZZ)); }
+       C2Tuple_SignatureCVec_SignatureZZ(LDKC2Tuple_SignatureCVec_SignatureZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ)); }
+       operator LDKC2Tuple_SignatureCVec_SignatureZZ() { LDKC2Tuple_SignatureCVec_SignatureZZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ)); return res; }
+       LDKC2Tuple_SignatureCVec_SignatureZZ* operator &() { return &self; }
+       LDKC2Tuple_SignatureCVec_SignatureZZ* operator ->() { return &self; }
+       const LDKC2Tuple_SignatureCVec_SignatureZZ* operator &() const { return &self; }
+       const LDKC2Tuple_SignatureCVec_SignatureZZ* operator ->() const { return &self; }
 };
-class C2Tuple_OutPointScriptZ {
+class CVec_ChannelDetailsZ {
 private:
-       LDKC2Tuple_OutPointScriptZ self;
+       LDKCVec_ChannelDetailsZ self;
 public:
-       C2Tuple_OutPointScriptZ(const C2Tuple_OutPointScriptZ&) = delete;
-       ~C2Tuple_OutPointScriptZ() { C2Tuple_OutPointScriptZ_free(self); }
-       C2Tuple_OutPointScriptZ(C2Tuple_OutPointScriptZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_OutPointScriptZ)); }
-       C2Tuple_OutPointScriptZ(LDKC2Tuple_OutPointScriptZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_OutPointScriptZ)); }
-       operator LDKC2Tuple_OutPointScriptZ() { LDKC2Tuple_OutPointScriptZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_OutPointScriptZ)); return res; }
-       LDKC2Tuple_OutPointScriptZ* operator &() { return &self; }
-       LDKC2Tuple_OutPointScriptZ* operator ->() { return &self; }
-       const LDKC2Tuple_OutPointScriptZ* operator &() const { return &self; }
-       const LDKC2Tuple_OutPointScriptZ* operator ->() const { return &self; }
-};
-class CVec_u64Z {
-private:
-       LDKCVec_u64Z self;
+       CVec_ChannelDetailsZ(const CVec_ChannelDetailsZ&) = delete;
+       ~CVec_ChannelDetailsZ() { CVec_ChannelDetailsZ_free(self); }
+       CVec_ChannelDetailsZ(CVec_ChannelDetailsZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_ChannelDetailsZ)); }
+       CVec_ChannelDetailsZ(LDKCVec_ChannelDetailsZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_ChannelDetailsZ)); }
+       operator LDKCVec_ChannelDetailsZ() { LDKCVec_ChannelDetailsZ res = self; memset(&self, 0, sizeof(LDKCVec_ChannelDetailsZ)); return res; }
+       LDKCVec_ChannelDetailsZ* operator &() { return &self; }
+       LDKCVec_ChannelDetailsZ* operator ->() { return &self; }
+       const LDKCVec_ChannelDetailsZ* operator &() const { return &self; }
+       const LDKCVec_ChannelDetailsZ* operator ->() const { return &self; }
+};
+class CVec_UpdateFailHTLCZ {
+private:
+       LDKCVec_UpdateFailHTLCZ self;
 public:
-       CVec_u64Z(const CVec_u64Z&) = delete;
-       ~CVec_u64Z() { CVec_u64Z_free(self); }
-       CVec_u64Z(CVec_u64Z&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_u64Z)); }
-       CVec_u64Z(LDKCVec_u64Z&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_u64Z)); }
-       operator LDKCVec_u64Z() { LDKCVec_u64Z res = self; memset(&self, 0, sizeof(LDKCVec_u64Z)); return res; }
-       LDKCVec_u64Z* operator &() { return &self; }
-       LDKCVec_u64Z* operator ->() { return &self; }
-       const LDKCVec_u64Z* operator &() const { return &self; }
-       const LDKCVec_u64Z* 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_CVec_RouteHopZZ {
+class CVec_UpdateFailMalformedHTLCZ {
 private:
-       LDKCVec_CVec_RouteHopZZ self;
+       LDKCVec_UpdateFailMalformedHTLCZ self;
 public:
-       CVec_CVec_RouteHopZZ(const CVec_CVec_RouteHopZZ&) = delete;
-       ~CVec_CVec_RouteHopZZ() { CVec_CVec_RouteHopZZ_free(self); }
-       CVec_CVec_RouteHopZZ(CVec_CVec_RouteHopZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_CVec_RouteHopZZ)); }
-       CVec_CVec_RouteHopZZ(LDKCVec_CVec_RouteHopZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_CVec_RouteHopZZ)); }
-       operator LDKCVec_CVec_RouteHopZZ() { LDKCVec_CVec_RouteHopZZ res = self; memset(&self, 0, sizeof(LDKCVec_CVec_RouteHopZZ)); return res; }
-       LDKCVec_CVec_RouteHopZZ* operator &() { return &self; }
-       LDKCVec_CVec_RouteHopZZ* operator ->() { return &self; }
-       const LDKCVec_CVec_RouteHopZZ* operator &() const { return &self; }
-       const LDKCVec_CVec_RouteHopZZ* operator ->() const { return &self; }
+       CVec_UpdateFailMalformedHTLCZ(const CVec_UpdateFailMalformedHTLCZ&) = delete;
+       ~CVec_UpdateFailMalformedHTLCZ() { CVec_UpdateFailMalformedHTLCZ_free(self); }
+       CVec_UpdateFailMalformedHTLCZ(CVec_UpdateFailMalformedHTLCZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_UpdateFailMalformedHTLCZ)); }
+       CVec_UpdateFailMalformedHTLCZ(LDKCVec_UpdateFailMalformedHTLCZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_UpdateFailMalformedHTLCZ)); }
+       operator LDKCVec_UpdateFailMalformedHTLCZ() { LDKCVec_UpdateFailMalformedHTLCZ res = self; memset(&self, 0, sizeof(LDKCVec_UpdateFailMalformedHTLCZ)); return res; }
+       LDKCVec_UpdateFailMalformedHTLCZ* operator &() { return &self; }
+       LDKCVec_UpdateFailMalformedHTLCZ* operator ->() { return &self; }
+       const LDKCVec_UpdateFailMalformedHTLCZ* operator &() const { return &self; }
+       const LDKCVec_UpdateFailMalformedHTLCZ* operator ->() const { return &self; }
 };
-class CVec_TransactionZ {
+class CVec_C2Tuple_usizeTransactionZZ {
 private:
-       LDKCVec_TransactionZ self;
+       LDKCVec_C2Tuple_usizeTransactionZZ 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_C2Tuple_usizeTransactionZZ(const CVec_C2Tuple_usizeTransactionZZ&) = delete;
+       ~CVec_C2Tuple_usizeTransactionZZ() { CVec_C2Tuple_usizeTransactionZZ_free(self); }
+       CVec_C2Tuple_usizeTransactionZZ(CVec_C2Tuple_usizeTransactionZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C2Tuple_usizeTransactionZZ)); }
+       CVec_C2Tuple_usizeTransactionZZ(LDKCVec_C2Tuple_usizeTransactionZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C2Tuple_usizeTransactionZZ)); }
+       operator LDKCVec_C2Tuple_usizeTransactionZZ() { LDKCVec_C2Tuple_usizeTransactionZZ res = self; memset(&self, 0, sizeof(LDKCVec_C2Tuple_usizeTransactionZZ)); return res; }
+       LDKCVec_C2Tuple_usizeTransactionZZ* operator &() { return &self; }
+       LDKCVec_C2Tuple_usizeTransactionZZ* operator ->() { return &self; }
+       const LDKCVec_C2Tuple_usizeTransactionZZ* operator &() const { return &self; }
+       const LDKCVec_C2Tuple_usizeTransactionZZ* operator ->() const { return &self; }
 };
-class CResult_C2Tuple_Scriptu64ZChainErrorZ {
+class CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
 private:
-       LDKCResult_C2Tuple_Scriptu64ZChainErrorZ self;
+       LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ self;
 public:
-       CResult_C2Tuple_Scriptu64ZChainErrorZ(const CResult_C2Tuple_Scriptu64ZChainErrorZ&) = delete;
-       ~CResult_C2Tuple_Scriptu64ZChainErrorZ() { CResult_C2Tuple_Scriptu64ZChainErrorZ_free(self); }
-       CResult_C2Tuple_Scriptu64ZChainErrorZ(CResult_C2Tuple_Scriptu64ZChainErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_C2Tuple_Scriptu64ZChainErrorZ)); }
-       CResult_C2Tuple_Scriptu64ZChainErrorZ(LDKCResult_C2Tuple_Scriptu64ZChainErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_C2Tuple_Scriptu64ZChainErrorZ)); }
-       operator LDKCResult_C2Tuple_Scriptu64ZChainErrorZ() { LDKCResult_C2Tuple_Scriptu64ZChainErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_C2Tuple_Scriptu64ZChainErrorZ)); return res; }
-       LDKCResult_C2Tuple_Scriptu64ZChainErrorZ* operator &() { return &self; }
-       LDKCResult_C2Tuple_Scriptu64ZChainErrorZ* operator ->() { return &self; }
-       const LDKCResult_C2Tuple_Scriptu64ZChainErrorZ* operator &() const { return &self; }
-       const LDKCResult_C2Tuple_Scriptu64ZChainErrorZ* operator ->() const { return &self; }
+       CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ(const CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ&) = delete;
+       ~CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ() { CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(self); }
+       CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ(CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ)); }
+       CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ)); }
+       operator LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ() { LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ res = self; memset(&self, 0, sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ)); return res; }
+       LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* operator &() { return &self; }
+       LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* operator ->() { return &self; }
+       const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* operator &() const { return &self; }
+       const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* operator ->() const { return &self; }
 };
-class CResult_CVec_SignatureZNoneZ {
+class C2Tuple_OutPointScriptZ {
 private:
-       LDKCResult_CVec_SignatureZNoneZ self;
+       LDKC2Tuple_OutPointScriptZ self;
 public:
-       CResult_CVec_SignatureZNoneZ(const CResult_CVec_SignatureZNoneZ&) = delete;
-       ~CResult_CVec_SignatureZNoneZ() { CResult_CVec_SignatureZNoneZ_free(self); }
-       CResult_CVec_SignatureZNoneZ(CResult_CVec_SignatureZNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_CVec_SignatureZNoneZ)); }
-       CResult_CVec_SignatureZNoneZ(LDKCResult_CVec_SignatureZNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_CVec_SignatureZNoneZ)); }
-       operator LDKCResult_CVec_SignatureZNoneZ() { LDKCResult_CVec_SignatureZNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_CVec_SignatureZNoneZ)); return res; }
-       LDKCResult_CVec_SignatureZNoneZ* operator &() { return &self; }
-       LDKCResult_CVec_SignatureZNoneZ* operator ->() { return &self; }
-       const LDKCResult_CVec_SignatureZNoneZ* operator &() const { return &self; }
-       const LDKCResult_CVec_SignatureZNoneZ* operator ->() const { return &self; }
+       C2Tuple_OutPointScriptZ(const C2Tuple_OutPointScriptZ&) = delete;
+       ~C2Tuple_OutPointScriptZ() { C2Tuple_OutPointScriptZ_free(self); }
+       C2Tuple_OutPointScriptZ(C2Tuple_OutPointScriptZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_OutPointScriptZ)); }
+       C2Tuple_OutPointScriptZ(LDKC2Tuple_OutPointScriptZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_OutPointScriptZ)); }
+       operator LDKC2Tuple_OutPointScriptZ() { LDKC2Tuple_OutPointScriptZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_OutPointScriptZ)); return res; }
+       LDKC2Tuple_OutPointScriptZ* operator &() { return &self; }
+       LDKC2Tuple_OutPointScriptZ* operator ->() { return &self; }
+       const LDKC2Tuple_OutPointScriptZ* operator &() const { return &self; }
+       const LDKC2Tuple_OutPointScriptZ* operator ->() const { return &self; }
+};
+class C2Tuple_u64u64Z {
+private:
+       LDKC2Tuple_u64u64Z self;
+public:
+       C2Tuple_u64u64Z(const C2Tuple_u64u64Z&) = delete;
+       ~C2Tuple_u64u64Z() { C2Tuple_u64u64Z_free(self); }
+       C2Tuple_u64u64Z(C2Tuple_u64u64Z&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_u64u64Z)); }
+       C2Tuple_u64u64Z(LDKC2Tuple_u64u64Z&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_u64u64Z)); }
+       operator LDKC2Tuple_u64u64Z() { LDKC2Tuple_u64u64Z res = self; memset(&self, 0, sizeof(LDKC2Tuple_u64u64Z)); return res; }
+       LDKC2Tuple_u64u64Z* operator &() { return &self; }
+       LDKC2Tuple_u64u64Z* operator ->() { return &self; }
+       const LDKC2Tuple_u64u64Z* operator &() const { return &self; }
+       const LDKC2Tuple_u64u64Z* operator ->() const { return &self; }
+};
+class CResult_boolLightningErrorZ {
+private:
+       LDKCResult_boolLightningErrorZ self;
+public:
+       CResult_boolLightningErrorZ(const CResult_boolLightningErrorZ&) = delete;
+       ~CResult_boolLightningErrorZ() { CResult_boolLightningErrorZ_free(self); }
+       CResult_boolLightningErrorZ(CResult_boolLightningErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_boolLightningErrorZ)); }
+       CResult_boolLightningErrorZ(LDKCResult_boolLightningErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_boolLightningErrorZ)); }
+       operator LDKCResult_boolLightningErrorZ() { LDKCResult_boolLightningErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_boolLightningErrorZ)); return res; }
+       LDKCResult_boolLightningErrorZ* operator &() { return &self; }
+       LDKCResult_boolLightningErrorZ* operator ->() { return &self; }
+       const LDKCResult_boolLightningErrorZ* operator &() const { return &self; }
+       const LDKCResult_boolLightningErrorZ* operator ->() const { return &self; }
 };
 class CVec_NodeAnnouncementZ {
 private:
@@ -1536,159 +1536,145 @@ public:
        const LDKCVec_NodeAnnouncementZ* operator &() const { return &self; }
        const LDKCVec_NodeAnnouncementZ* operator ->() const { return &self; }
 };
-class CResult_RouteLightningErrorZ {
-private:
-       LDKCResult_RouteLightningErrorZ self;
-public:
-       CResult_RouteLightningErrorZ(const CResult_RouteLightningErrorZ&) = delete;
-       ~CResult_RouteLightningErrorZ() { CResult_RouteLightningErrorZ_free(self); }
-       CResult_RouteLightningErrorZ(CResult_RouteLightningErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_RouteLightningErrorZ)); }
-       CResult_RouteLightningErrorZ(LDKCResult_RouteLightningErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_RouteLightningErrorZ)); }
-       operator LDKCResult_RouteLightningErrorZ() { LDKCResult_RouteLightningErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_RouteLightningErrorZ)); return res; }
-       LDKCResult_RouteLightningErrorZ* operator &() { return &self; }
-       LDKCResult_RouteLightningErrorZ* operator ->() { return &self; }
-       const LDKCResult_RouteLightningErrorZ* operator &() const { return &self; }
-       const LDKCResult_RouteLightningErrorZ* operator ->() const { return &self; }
-};
-class CResult_boolPeerHandleErrorZ {
+class CResult_NoneChannelMonitorUpdateErrZ {
 private:
-       LDKCResult_boolPeerHandleErrorZ self;
+       LDKCResult_NoneChannelMonitorUpdateErrZ self;
 public:
-       CResult_boolPeerHandleErrorZ(const CResult_boolPeerHandleErrorZ&) = delete;
-       ~CResult_boolPeerHandleErrorZ() { CResult_boolPeerHandleErrorZ_free(self); }
-       CResult_boolPeerHandleErrorZ(CResult_boolPeerHandleErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_boolPeerHandleErrorZ)); }
-       CResult_boolPeerHandleErrorZ(LDKCResult_boolPeerHandleErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_boolPeerHandleErrorZ)); }
-       operator LDKCResult_boolPeerHandleErrorZ() { LDKCResult_boolPeerHandleErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_boolPeerHandleErrorZ)); return res; }
-       LDKCResult_boolPeerHandleErrorZ* operator &() { return &self; }
-       LDKCResult_boolPeerHandleErrorZ* operator ->() { return &self; }
-       const LDKCResult_boolPeerHandleErrorZ* operator &() const { return &self; }
-       const LDKCResult_boolPeerHandleErrorZ* operator ->() const { return &self; }
+       CResult_NoneChannelMonitorUpdateErrZ(const CResult_NoneChannelMonitorUpdateErrZ&) = delete;
+       ~CResult_NoneChannelMonitorUpdateErrZ() { CResult_NoneChannelMonitorUpdateErrZ_free(self); }
+       CResult_NoneChannelMonitorUpdateErrZ(CResult_NoneChannelMonitorUpdateErrZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NoneChannelMonitorUpdateErrZ)); }
+       CResult_NoneChannelMonitorUpdateErrZ(LDKCResult_NoneChannelMonitorUpdateErrZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ)); }
+       operator LDKCResult_NoneChannelMonitorUpdateErrZ() { LDKCResult_NoneChannelMonitorUpdateErrZ res = self; memset(&self, 0, sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ)); return res; }
+       LDKCResult_NoneChannelMonitorUpdateErrZ* operator &() { return &self; }
+       LDKCResult_NoneChannelMonitorUpdateErrZ* operator ->() { return &self; }
+       const LDKCResult_NoneChannelMonitorUpdateErrZ* operator &() const { return &self; }
+       const LDKCResult_NoneChannelMonitorUpdateErrZ* operator ->() const { return &self; }
 };
-class C2Tuple_SignatureCVec_SignatureZZ {
+class CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
 private:
-       LDKC2Tuple_SignatureCVec_SignatureZZ self;
+       LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ self;
 public:
-       C2Tuple_SignatureCVec_SignatureZZ(const C2Tuple_SignatureCVec_SignatureZZ&) = delete;
-       ~C2Tuple_SignatureCVec_SignatureZZ() { C2Tuple_SignatureCVec_SignatureZZ_free(self); }
-       C2Tuple_SignatureCVec_SignatureZZ(C2Tuple_SignatureCVec_SignatureZZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_SignatureCVec_SignatureZZ)); }
-       C2Tuple_SignatureCVec_SignatureZZ(LDKC2Tuple_SignatureCVec_SignatureZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ)); }
-       operator LDKC2Tuple_SignatureCVec_SignatureZZ() { LDKC2Tuple_SignatureCVec_SignatureZZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ)); return res; }
-       LDKC2Tuple_SignatureCVec_SignatureZZ* operator &() { return &self; }
-       LDKC2Tuple_SignatureCVec_SignatureZZ* operator ->() { return &self; }
-       const LDKC2Tuple_SignatureCVec_SignatureZZ* operator &() const { return &self; }
-       const LDKC2Tuple_SignatureCVec_SignatureZZ* operator ->() const { return &self; }
+       CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ(const CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ&) = delete;
+       ~CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ() { CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(self); }
+       CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ(CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ)); }
+       CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ)); }
+       operator LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ() { LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ)); return res; }
+       LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* operator &() { return &self; }
+       LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* operator ->() { return &self; }
+       const LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* operator &() const { return &self; }
+       const LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* operator ->() const { return &self; }
 };
-class CVec_HTLCOutputInCommitmentZ {
+class CVec_PublicKeyZ {
 private:
-       LDKCVec_HTLCOutputInCommitmentZ self;
+       LDKCVec_PublicKeyZ self;
 public:
-       CVec_HTLCOutputInCommitmentZ(const CVec_HTLCOutputInCommitmentZ&) = delete;
-       ~CVec_HTLCOutputInCommitmentZ() { CVec_HTLCOutputInCommitmentZ_free(self); }
-       CVec_HTLCOutputInCommitmentZ(CVec_HTLCOutputInCommitmentZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_HTLCOutputInCommitmentZ)); }
-       CVec_HTLCOutputInCommitmentZ(LDKCVec_HTLCOutputInCommitmentZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_HTLCOutputInCommitmentZ)); }
-       operator LDKCVec_HTLCOutputInCommitmentZ() { LDKCVec_HTLCOutputInCommitmentZ res = self; memset(&self, 0, sizeof(LDKCVec_HTLCOutputInCommitmentZ)); return res; }
-       LDKCVec_HTLCOutputInCommitmentZ* operator &() { return &self; }
-       LDKCVec_HTLCOutputInCommitmentZ* operator ->() { return &self; }
-       const LDKCVec_HTLCOutputInCommitmentZ* operator &() const { return &self; }
-       const LDKCVec_HTLCOutputInCommitmentZ* 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 C2Tuple_Scriptu64Z {
+class CResult_SignatureNoneZ {
 private:
-       LDKC2Tuple_Scriptu64Z self;
+       LDKCResult_SignatureNoneZ self;
 public:
-       C2Tuple_Scriptu64Z(const C2Tuple_Scriptu64Z&) = delete;
-       ~C2Tuple_Scriptu64Z() { C2Tuple_Scriptu64Z_free(self); }
-       C2Tuple_Scriptu64Z(C2Tuple_Scriptu64Z&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_Scriptu64Z)); }
-       C2Tuple_Scriptu64Z(LDKC2Tuple_Scriptu64Z&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_Scriptu64Z)); }
-       operator LDKC2Tuple_Scriptu64Z() { LDKC2Tuple_Scriptu64Z res = self; memset(&self, 0, sizeof(LDKC2Tuple_Scriptu64Z)); return res; }
-       LDKC2Tuple_Scriptu64Z* operator &() { return &self; }
-       LDKC2Tuple_Scriptu64Z* operator ->() { return &self; }
-       const LDKC2Tuple_Scriptu64Z* operator &() const { return &self; }
-       const LDKC2Tuple_Scriptu64Z* operator ->() const { return &self; }
+       CResult_SignatureNoneZ(const CResult_SignatureNoneZ&) = delete;
+       ~CResult_SignatureNoneZ() { CResult_SignatureNoneZ_free(self); }
+       CResult_SignatureNoneZ(CResult_SignatureNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_SignatureNoneZ)); }
+       CResult_SignatureNoneZ(LDKCResult_SignatureNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_SignatureNoneZ)); }
+       operator LDKCResult_SignatureNoneZ() { LDKCResult_SignatureNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_SignatureNoneZ)); return res; }
+       LDKCResult_SignatureNoneZ* operator &() { return &self; }
+       LDKCResult_SignatureNoneZ* operator ->() { return &self; }
+       const LDKCResult_SignatureNoneZ* operator &() const { return &self; }
+       const LDKCResult_SignatureNoneZ* operator ->() const { return &self; }
 };
-class CVec_ChannelMonitorZ {
+class CVec_TransactionZ {
 private:
-       LDKCVec_ChannelMonitorZ self;
+       LDKCVec_TransactionZ self;
 public:
-       CVec_ChannelMonitorZ(const CVec_ChannelMonitorZ&) = delete;
-       ~CVec_ChannelMonitorZ() { CVec_ChannelMonitorZ_free(self); }
-       CVec_ChannelMonitorZ(CVec_ChannelMonitorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_ChannelMonitorZ)); }
-       CVec_ChannelMonitorZ(LDKCVec_ChannelMonitorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_ChannelMonitorZ)); }
-       operator LDKCVec_ChannelMonitorZ() { LDKCVec_ChannelMonitorZ res = self; memset(&self, 0, sizeof(LDKCVec_ChannelMonitorZ)); return res; }
-       LDKCVec_ChannelMonitorZ* operator &() { return &self; }
-       LDKCVec_ChannelMonitorZ* operator ->() { return &self; }
-       const LDKCVec_ChannelMonitorZ* operator &() const { return &self; }
-       const LDKCVec_ChannelMonitorZ* operator ->() const { return &self; }
+       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 C2Tuple_Txidu32Z {
+class CVec_MessageSendEventZ {
 private:
-       LDKC2Tuple_Txidu32Z self;
+       LDKCVec_MessageSendEventZ self;
 public:
-       C2Tuple_Txidu32Z(const C2Tuple_Txidu32Z&) = delete;
-       ~C2Tuple_Txidu32Z() { C2Tuple_Txidu32Z_free(self); }
-       C2Tuple_Txidu32Z(C2Tuple_Txidu32Z&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_Txidu32Z)); }
-       C2Tuple_Txidu32Z(LDKC2Tuple_Txidu32Z&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_Txidu32Z)); }
-       operator LDKC2Tuple_Txidu32Z() { LDKC2Tuple_Txidu32Z res = self; memset(&self, 0, sizeof(LDKC2Tuple_Txidu32Z)); return res; }
-       LDKC2Tuple_Txidu32Z* operator &() { return &self; }
-       LDKC2Tuple_Txidu32Z* operator ->() { return &self; }
-       const LDKC2Tuple_Txidu32Z* operator &() const { return &self; }
-       const LDKC2Tuple_Txidu32Z* operator ->() const { return &self; }
+       CVec_MessageSendEventZ(const CVec_MessageSendEventZ&) = delete;
+       ~CVec_MessageSendEventZ() { CVec_MessageSendEventZ_free(self); }
+       CVec_MessageSendEventZ(CVec_MessageSendEventZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_MessageSendEventZ)); }
+       CVec_MessageSendEventZ(LDKCVec_MessageSendEventZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_MessageSendEventZ)); }
+       operator LDKCVec_MessageSendEventZ() { LDKCVec_MessageSendEventZ res = self; memset(&self, 0, sizeof(LDKCVec_MessageSendEventZ)); return res; }
+       LDKCVec_MessageSendEventZ* operator &() { return &self; }
+       LDKCVec_MessageSendEventZ* operator ->() { return &self; }
+       const LDKCVec_MessageSendEventZ* operator &() const { return &self; }
+       const LDKCVec_MessageSendEventZ* operator ->() const { return &self; }
 };
-class CVec_ChannelDetailsZ {
+class CVec_u8Z {
 private:
-       LDKCVec_ChannelDetailsZ self;
+       LDKCVec_u8Z self;
 public:
-       CVec_ChannelDetailsZ(const CVec_ChannelDetailsZ&) = delete;
-       ~CVec_ChannelDetailsZ() { CVec_ChannelDetailsZ_free(self); }
-       CVec_ChannelDetailsZ(CVec_ChannelDetailsZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_ChannelDetailsZ)); }
-       CVec_ChannelDetailsZ(LDKCVec_ChannelDetailsZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_ChannelDetailsZ)); }
-       operator LDKCVec_ChannelDetailsZ() { LDKCVec_ChannelDetailsZ res = self; memset(&self, 0, sizeof(LDKCVec_ChannelDetailsZ)); return res; }
-       LDKCVec_ChannelDetailsZ* operator &() { return &self; }
-       LDKCVec_ChannelDetailsZ* operator ->() { return &self; }
-       const LDKCVec_ChannelDetailsZ* operator &() const { return &self; }
-       const LDKCVec_ChannelDetailsZ* operator ->() const { return &self; }
+       CVec_u8Z(const CVec_u8Z&) = delete;
+       ~CVec_u8Z() { CVec_u8Z_free(self); }
+       CVec_u8Z(CVec_u8Z&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_u8Z)); }
+       CVec_u8Z(LDKCVec_u8Z&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_u8Z)); }
+       operator LDKCVec_u8Z() { LDKCVec_u8Z res = self; memset(&self, 0, sizeof(LDKCVec_u8Z)); return res; }
+       LDKCVec_u8Z* operator &() { return &self; }
+       LDKCVec_u8Z* operator ->() { return &self; }
+       const LDKCVec_u8Z* operator &() const { return &self; }
+       const LDKCVec_u8Z* operator ->() const { return &self; }
 };
-class C2Tuple_u64u64Z {
+class CResult_PublicKeySecpErrorZ {
 private:
-       LDKC2Tuple_u64u64Z self;
+       LDKCResult_PublicKeySecpErrorZ self;
 public:
-       C2Tuple_u64u64Z(const C2Tuple_u64u64Z&) = delete;
-       ~C2Tuple_u64u64Z() { C2Tuple_u64u64Z_free(self); }
-       C2Tuple_u64u64Z(C2Tuple_u64u64Z&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_u64u64Z)); }
-       C2Tuple_u64u64Z(LDKC2Tuple_u64u64Z&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_u64u64Z)); }
-       operator LDKC2Tuple_u64u64Z() { LDKC2Tuple_u64u64Z res = self; memset(&self, 0, sizeof(LDKC2Tuple_u64u64Z)); return res; }
-       LDKC2Tuple_u64u64Z* operator &() { return &self; }
-       LDKC2Tuple_u64u64Z* operator ->() { return &self; }
-       const LDKC2Tuple_u64u64Z* operator &() const { return &self; }
-       const LDKC2Tuple_u64u64Z* operator ->() const { return &self; }
+       CResult_PublicKeySecpErrorZ(const CResult_PublicKeySecpErrorZ&) = delete;
+       ~CResult_PublicKeySecpErrorZ() { CResult_PublicKeySecpErrorZ_free(self); }
+       CResult_PublicKeySecpErrorZ(CResult_PublicKeySecpErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PublicKeySecpErrorZ)); }
+       CResult_PublicKeySecpErrorZ(LDKCResult_PublicKeySecpErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PublicKeySecpErrorZ)); }
+       operator LDKCResult_PublicKeySecpErrorZ() { LDKCResult_PublicKeySecpErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PublicKeySecpErrorZ)); return res; }
+       LDKCResult_PublicKeySecpErrorZ* operator &() { return &self; }
+       LDKCResult_PublicKeySecpErrorZ* operator ->() { return &self; }
+       const LDKCResult_PublicKeySecpErrorZ* operator &() const { return &self; }
+       const LDKCResult_PublicKeySecpErrorZ* operator ->() const { return &self; }
 };
-class CResult_NonePaymentSendFailureZ {
+class CVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ {
 private:
-       LDKCResult_NonePaymentSendFailureZ self;
+       LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ self;
 public:
-       CResult_NonePaymentSendFailureZ(const CResult_NonePaymentSendFailureZ&) = delete;
-       ~CResult_NonePaymentSendFailureZ() { CResult_NonePaymentSendFailureZ_free(self); }
-       CResult_NonePaymentSendFailureZ(CResult_NonePaymentSendFailureZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NonePaymentSendFailureZ)); }
-       CResult_NonePaymentSendFailureZ(LDKCResult_NonePaymentSendFailureZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NonePaymentSendFailureZ)); }
-       operator LDKCResult_NonePaymentSendFailureZ() { LDKCResult_NonePaymentSendFailureZ res = self; memset(&self, 0, sizeof(LDKCResult_NonePaymentSendFailureZ)); return res; }
-       LDKCResult_NonePaymentSendFailureZ* operator &() { return &self; }
-       LDKCResult_NonePaymentSendFailureZ* operator ->() { return &self; }
-       const LDKCResult_NonePaymentSendFailureZ* operator &() const { return &self; }
-       const LDKCResult_NonePaymentSendFailureZ* operator ->() const { return &self; }
+       CVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ(const CVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ&) = delete;
+       ~CVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ() { CVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ_free(self); }
+       CVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ(CVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ)); }
+       CVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ(LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ)); }
+       operator LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ() { LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ res = self; memset(&self, 0, sizeof(LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ)); return res; }
+       LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ* operator &() { return &self; }
+       LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ* operator ->() { return &self; }
+       const LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ* operator &() const { return &self; }
+       const LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ* operator ->() const { return &self; }
 };
-class CResult_NoneChannelMonitorUpdateErrZ {
+class CResult_NoneMonitorUpdateErrorZ {
 private:
-       LDKCResult_NoneChannelMonitorUpdateErrZ self;
+       LDKCResult_NoneMonitorUpdateErrorZ self;
 public:
-       CResult_NoneChannelMonitorUpdateErrZ(const CResult_NoneChannelMonitorUpdateErrZ&) = delete;
-       ~CResult_NoneChannelMonitorUpdateErrZ() { CResult_NoneChannelMonitorUpdateErrZ_free(self); }
-       CResult_NoneChannelMonitorUpdateErrZ(CResult_NoneChannelMonitorUpdateErrZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NoneChannelMonitorUpdateErrZ)); }
-       CResult_NoneChannelMonitorUpdateErrZ(LDKCResult_NoneChannelMonitorUpdateErrZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ)); }
-       operator LDKCResult_NoneChannelMonitorUpdateErrZ() { LDKCResult_NoneChannelMonitorUpdateErrZ res = self; memset(&self, 0, sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ)); return res; }
-       LDKCResult_NoneChannelMonitorUpdateErrZ* operator &() { return &self; }
-       LDKCResult_NoneChannelMonitorUpdateErrZ* operator ->() { return &self; }
-       const LDKCResult_NoneChannelMonitorUpdateErrZ* operator &() const { return &self; }
-       const LDKCResult_NoneChannelMonitorUpdateErrZ* operator ->() const { return &self; }
+       CResult_NoneMonitorUpdateErrorZ(const CResult_NoneMonitorUpdateErrorZ&) = delete;
+       ~CResult_NoneMonitorUpdateErrorZ() { CResult_NoneMonitorUpdateErrorZ_free(self); }
+       CResult_NoneMonitorUpdateErrorZ(CResult_NoneMonitorUpdateErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NoneMonitorUpdateErrorZ)); }
+       CResult_NoneMonitorUpdateErrorZ(LDKCResult_NoneMonitorUpdateErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NoneMonitorUpdateErrorZ)); }
+       operator LDKCResult_NoneMonitorUpdateErrorZ() { LDKCResult_NoneMonitorUpdateErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NoneMonitorUpdateErrorZ)); return res; }
+       LDKCResult_NoneMonitorUpdateErrorZ* operator &() { return &self; }
+       LDKCResult_NoneMonitorUpdateErrorZ* operator ->() { return &self; }
+       const LDKCResult_NoneMonitorUpdateErrorZ* operator &() const { return &self; }
+       const LDKCResult_NoneMonitorUpdateErrorZ* operator ->() const { return &self; }
 };
 class CVec_MonitorEventZ {
 private:
@@ -1704,33 +1690,19 @@ public:
        const LDKCVec_MonitorEventZ* operator &() const { return &self; }
        const LDKCVec_MonitorEventZ* operator ->() const { return &self; }
 };
-class CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
-private:
-       LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ self;
-public:
-       CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ(const CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ&) = delete;
-       ~CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ() { CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(self); }
-       CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ(CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ)); }
-       CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ)); }
-       operator LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ() { LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ res = self; memset(&self, 0, sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ)); return res; }
-       LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* operator &() { return &self; }
-       LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* operator ->() { return &self; }
-       const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* operator &() const { return &self; }
-       const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* operator ->() const { return &self; }
-};
-class C2Tuple_HTLCOutputInCommitmentSignatureZ {
+class CResult_boolPeerHandleErrorZ {
 private:
-       LDKC2Tuple_HTLCOutputInCommitmentSignatureZ self;
+       LDKCResult_boolPeerHandleErrorZ self;
 public:
-       C2Tuple_HTLCOutputInCommitmentSignatureZ(const C2Tuple_HTLCOutputInCommitmentSignatureZ&) = delete;
-       ~C2Tuple_HTLCOutputInCommitmentSignatureZ() { C2Tuple_HTLCOutputInCommitmentSignatureZ_free(self); }
-       C2Tuple_HTLCOutputInCommitmentSignatureZ(C2Tuple_HTLCOutputInCommitmentSignatureZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_HTLCOutputInCommitmentSignatureZ)); }
-       C2Tuple_HTLCOutputInCommitmentSignatureZ(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ)); }
-       operator LDKC2Tuple_HTLCOutputInCommitmentSignatureZ() { LDKC2Tuple_HTLCOutputInCommitmentSignatureZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ)); return res; }
-       LDKC2Tuple_HTLCOutputInCommitmentSignatureZ* operator &() { return &self; }
-       LDKC2Tuple_HTLCOutputInCommitmentSignatureZ* operator ->() { return &self; }
-       const LDKC2Tuple_HTLCOutputInCommitmentSignatureZ* operator &() const { return &self; }
-       const LDKC2Tuple_HTLCOutputInCommitmentSignatureZ* operator ->() const { return &self; }
+       CResult_boolPeerHandleErrorZ(const CResult_boolPeerHandleErrorZ&) = delete;
+       ~CResult_boolPeerHandleErrorZ() { CResult_boolPeerHandleErrorZ_free(self); }
+       CResult_boolPeerHandleErrorZ(CResult_boolPeerHandleErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_boolPeerHandleErrorZ)); }
+       CResult_boolPeerHandleErrorZ(LDKCResult_boolPeerHandleErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_boolPeerHandleErrorZ)); }
+       operator LDKCResult_boolPeerHandleErrorZ() { LDKCResult_boolPeerHandleErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_boolPeerHandleErrorZ)); return res; }
+       LDKCResult_boolPeerHandleErrorZ* operator &() { return &self; }
+       LDKCResult_boolPeerHandleErrorZ* operator ->() { return &self; }
+       const LDKCResult_boolPeerHandleErrorZ* operator &() const { return &self; }
+       const LDKCResult_boolPeerHandleErrorZ* operator ->() const { return &self; }
 };
 class CResult_SecretKeySecpErrorZ {
 private:
@@ -1746,33 +1718,47 @@ public:
        const LDKCResult_SecretKeySecpErrorZ* operator &() const { return &self; }
        const LDKCResult_SecretKeySecpErrorZ* operator ->() const { return &self; }
 };
-class CVec_RouteHintZ {
+class C2Tuple_HTLCOutputInCommitmentSignatureZ {
 private:
-       LDKCVec_RouteHintZ self;
+       LDKC2Tuple_HTLCOutputInCommitmentSignatureZ self;
 public:
-       CVec_RouteHintZ(const CVec_RouteHintZ&) = delete;
-       ~CVec_RouteHintZ() { CVec_RouteHintZ_free(self); }
-       CVec_RouteHintZ(CVec_RouteHintZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_RouteHintZ)); }
-       CVec_RouteHintZ(LDKCVec_RouteHintZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_RouteHintZ)); }
-       operator LDKCVec_RouteHintZ() { LDKCVec_RouteHintZ res = self; memset(&self, 0, sizeof(LDKCVec_RouteHintZ)); return res; }
-       LDKCVec_RouteHintZ* operator &() { return &self; }
-       LDKCVec_RouteHintZ* operator ->() { return &self; }
-       const LDKCVec_RouteHintZ* operator &() const { return &self; }
-       const LDKCVec_RouteHintZ* operator ->() const { return &self; }
+       C2Tuple_HTLCOutputInCommitmentSignatureZ(const C2Tuple_HTLCOutputInCommitmentSignatureZ&) = delete;
+       ~C2Tuple_HTLCOutputInCommitmentSignatureZ() { C2Tuple_HTLCOutputInCommitmentSignatureZ_free(self); }
+       C2Tuple_HTLCOutputInCommitmentSignatureZ(C2Tuple_HTLCOutputInCommitmentSignatureZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_HTLCOutputInCommitmentSignatureZ)); }
+       C2Tuple_HTLCOutputInCommitmentSignatureZ(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ)); }
+       operator LDKC2Tuple_HTLCOutputInCommitmentSignatureZ() { LDKC2Tuple_HTLCOutputInCommitmentSignatureZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ)); return res; }
+       LDKC2Tuple_HTLCOutputInCommitmentSignatureZ* operator &() { return &self; }
+       LDKC2Tuple_HTLCOutputInCommitmentSignatureZ* operator ->() { return &self; }
+       const LDKC2Tuple_HTLCOutputInCommitmentSignatureZ* operator &() const { return &self; }
+       const LDKC2Tuple_HTLCOutputInCommitmentSignatureZ* operator ->() const { return &self; }
 };
-class CVec_UpdateFailMalformedHTLCZ {
+class CResult_CVec_SignatureZNoneZ {
 private:
-       LDKCVec_UpdateFailMalformedHTLCZ self;
+       LDKCResult_CVec_SignatureZNoneZ self;
 public:
-       CVec_UpdateFailMalformedHTLCZ(const CVec_UpdateFailMalformedHTLCZ&) = delete;
-       ~CVec_UpdateFailMalformedHTLCZ() { CVec_UpdateFailMalformedHTLCZ_free(self); }
-       CVec_UpdateFailMalformedHTLCZ(CVec_UpdateFailMalformedHTLCZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_UpdateFailMalformedHTLCZ)); }
-       CVec_UpdateFailMalformedHTLCZ(LDKCVec_UpdateFailMalformedHTLCZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_UpdateFailMalformedHTLCZ)); }
-       operator LDKCVec_UpdateFailMalformedHTLCZ() { LDKCVec_UpdateFailMalformedHTLCZ res = self; memset(&self, 0, sizeof(LDKCVec_UpdateFailMalformedHTLCZ)); return res; }
-       LDKCVec_UpdateFailMalformedHTLCZ* operator &() { return &self; }
-       LDKCVec_UpdateFailMalformedHTLCZ* operator ->() { return &self; }
-       const LDKCVec_UpdateFailMalformedHTLCZ* operator &() const { return &self; }
-       const LDKCVec_UpdateFailMalformedHTLCZ* operator ->() const { return &self; }
+       CResult_CVec_SignatureZNoneZ(const CResult_CVec_SignatureZNoneZ&) = delete;
+       ~CResult_CVec_SignatureZNoneZ() { CResult_CVec_SignatureZNoneZ_free(self); }
+       CResult_CVec_SignatureZNoneZ(CResult_CVec_SignatureZNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_CVec_SignatureZNoneZ)); }
+       CResult_CVec_SignatureZNoneZ(LDKCResult_CVec_SignatureZNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_CVec_SignatureZNoneZ)); }
+       operator LDKCResult_CVec_SignatureZNoneZ() { LDKCResult_CVec_SignatureZNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_CVec_SignatureZNoneZ)); return res; }
+       LDKCResult_CVec_SignatureZNoneZ* operator &() { return &self; }
+       LDKCResult_CVec_SignatureZNoneZ* operator ->() { return &self; }
+       const LDKCResult_CVec_SignatureZNoneZ* operator &() const { return &self; }
+       const LDKCResult_CVec_SignatureZNoneZ* operator ->() const { return &self; }
+};
+class C2Tuple_TxidCVec_TxOutZZ {
+private:
+       LDKC2Tuple_TxidCVec_TxOutZZ 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; }
 };
 class CVec_RouteHopZ {
 private:
@@ -1788,47 +1774,75 @@ public:
        const LDKCVec_RouteHopZ* operator &() const { return &self; }
        const LDKCVec_RouteHopZ* operator ->() const { return &self; }
 };
-class CVec_SpendableOutputDescriptorZ {
+class CVec_CVec_RouteHopZZ {
 private:
-       LDKCVec_SpendableOutputDescriptorZ self;
+       LDKCVec_CVec_RouteHopZZ self;
 public:
-       CVec_SpendableOutputDescriptorZ(const CVec_SpendableOutputDescriptorZ&) = delete;
-       ~CVec_SpendableOutputDescriptorZ() { CVec_SpendableOutputDescriptorZ_free(self); }
-       CVec_SpendableOutputDescriptorZ(CVec_SpendableOutputDescriptorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_SpendableOutputDescriptorZ)); }
-       CVec_SpendableOutputDescriptorZ(LDKCVec_SpendableOutputDescriptorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_SpendableOutputDescriptorZ)); }
-       operator LDKCVec_SpendableOutputDescriptorZ() { LDKCVec_SpendableOutputDescriptorZ res = self; memset(&self, 0, sizeof(LDKCVec_SpendableOutputDescriptorZ)); return res; }
-       LDKCVec_SpendableOutputDescriptorZ* operator &() { return &self; }
-       LDKCVec_SpendableOutputDescriptorZ* operator ->() { return &self; }
-       const LDKCVec_SpendableOutputDescriptorZ* operator &() const { return &self; }
-       const LDKCVec_SpendableOutputDescriptorZ* operator ->() const { return &self; }
+       CVec_CVec_RouteHopZZ(const CVec_CVec_RouteHopZZ&) = delete;
+       ~CVec_CVec_RouteHopZZ() { CVec_CVec_RouteHopZZ_free(self); }
+       CVec_CVec_RouteHopZZ(CVec_CVec_RouteHopZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_CVec_RouteHopZZ)); }
+       CVec_CVec_RouteHopZZ(LDKCVec_CVec_RouteHopZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_CVec_RouteHopZZ)); }
+       operator LDKCVec_CVec_RouteHopZZ() { LDKCVec_CVec_RouteHopZZ res = self; memset(&self, 0, sizeof(LDKCVec_CVec_RouteHopZZ)); return res; }
+       LDKCVec_CVec_RouteHopZZ* operator &() { return &self; }
+       LDKCVec_CVec_RouteHopZZ* operator ->() { return &self; }
+       const LDKCVec_CVec_RouteHopZZ* operator &() const { return &self; }
+       const LDKCVec_CVec_RouteHopZZ* operator ->() const { return &self; }
 };
-class CResult_boolLightningErrorZ {
+class CResult_NonePaymentSendFailureZ {
 private:
-       LDKCResult_boolLightningErrorZ self;
+       LDKCResult_NonePaymentSendFailureZ self;
 public:
-       CResult_boolLightningErrorZ(const CResult_boolLightningErrorZ&) = delete;
-       ~CResult_boolLightningErrorZ() { CResult_boolLightningErrorZ_free(self); }
-       CResult_boolLightningErrorZ(CResult_boolLightningErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_boolLightningErrorZ)); }
-       CResult_boolLightningErrorZ(LDKCResult_boolLightningErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_boolLightningErrorZ)); }
-       operator LDKCResult_boolLightningErrorZ() { LDKCResult_boolLightningErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_boolLightningErrorZ)); return res; }
-       LDKCResult_boolLightningErrorZ* operator &() { return &self; }
-       LDKCResult_boolLightningErrorZ* operator ->() { return &self; }
-       const LDKCResult_boolLightningErrorZ* operator &() const { return &self; }
-       const LDKCResult_boolLightningErrorZ* operator ->() const { return &self; }
+       CResult_NonePaymentSendFailureZ(const CResult_NonePaymentSendFailureZ&) = delete;
+       ~CResult_NonePaymentSendFailureZ() { CResult_NonePaymentSendFailureZ_free(self); }
+       CResult_NonePaymentSendFailureZ(CResult_NonePaymentSendFailureZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NonePaymentSendFailureZ)); }
+       CResult_NonePaymentSendFailureZ(LDKCResult_NonePaymentSendFailureZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NonePaymentSendFailureZ)); }
+       operator LDKCResult_NonePaymentSendFailureZ() { LDKCResult_NonePaymentSendFailureZ res = self; memset(&self, 0, sizeof(LDKCResult_NonePaymentSendFailureZ)); return res; }
+       LDKCResult_NonePaymentSendFailureZ* operator &() { return &self; }
+       LDKCResult_NonePaymentSendFailureZ* operator ->() { return &self; }
+       const LDKCResult_NonePaymentSendFailureZ* operator &() const { return &self; }
+       const LDKCResult_NonePaymentSendFailureZ* operator ->() const { return &self; }
+};
+class CVec_RouteHintZ {
+private:
+       LDKCVec_RouteHintZ self;
+public:
+       CVec_RouteHintZ(const CVec_RouteHintZ&) = delete;
+       ~CVec_RouteHintZ() { CVec_RouteHintZ_free(self); }
+       CVec_RouteHintZ(CVec_RouteHintZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_RouteHintZ)); }
+       CVec_RouteHintZ(LDKCVec_RouteHintZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_RouteHintZ)); }
+       operator LDKCVec_RouteHintZ() { LDKCVec_RouteHintZ res = self; memset(&self, 0, sizeof(LDKCVec_RouteHintZ)); return res; }
+       LDKCVec_RouteHintZ* operator &() { return &self; }
+       LDKCVec_RouteHintZ* operator ->() { return &self; }
+       const LDKCVec_RouteHintZ* operator &() const { return &self; }
+       const LDKCVec_RouteHintZ* operator ->() const { return &self; }
+};
+class CVec_u64Z {
+private:
+       LDKCVec_u64Z self;
+public:
+       CVec_u64Z(const CVec_u64Z&) = delete;
+       ~CVec_u64Z() { CVec_u64Z_free(self); }
+       CVec_u64Z(CVec_u64Z&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_u64Z)); }
+       CVec_u64Z(LDKCVec_u64Z&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_u64Z)); }
+       operator LDKCVec_u64Z() { LDKCVec_u64Z res = self; memset(&self, 0, sizeof(LDKCVec_u64Z)); return res; }
+       LDKCVec_u64Z* operator &() { return &self; }
+       LDKCVec_u64Z* operator ->() { return &self; }
+       const LDKCVec_u64Z* operator &() const { return &self; }
+       const LDKCVec_u64Z* operator ->() const { return &self; }
 };
-class CResult_NoneAPIErrorZ {
+class C2Tuple_usizeTransactionZ {
 private:
-       LDKCResult_NoneAPIErrorZ self;
+       LDKC2Tuple_usizeTransactionZ self;
 public:
-       CResult_NoneAPIErrorZ(const CResult_NoneAPIErrorZ&) = delete;
-       ~CResult_NoneAPIErrorZ() { CResult_NoneAPIErrorZ_free(self); }
-       CResult_NoneAPIErrorZ(CResult_NoneAPIErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NoneAPIErrorZ)); }
-       CResult_NoneAPIErrorZ(LDKCResult_NoneAPIErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NoneAPIErrorZ)); }
-       operator LDKCResult_NoneAPIErrorZ() { LDKCResult_NoneAPIErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NoneAPIErrorZ)); return res; }
-       LDKCResult_NoneAPIErrorZ* operator &() { return &self; }
-       LDKCResult_NoneAPIErrorZ* operator ->() { return &self; }
-       const LDKCResult_NoneAPIErrorZ* operator &() const { return &self; }
-       const LDKCResult_NoneAPIErrorZ* operator ->() const { return &self; }
+       C2Tuple_usizeTransactionZ(const C2Tuple_usizeTransactionZ&) = delete;
+       ~C2Tuple_usizeTransactionZ() { C2Tuple_usizeTransactionZ_free(self); }
+       C2Tuple_usizeTransactionZ(C2Tuple_usizeTransactionZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_usizeTransactionZ)); }
+       C2Tuple_usizeTransactionZ(LDKC2Tuple_usizeTransactionZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_usizeTransactionZ)); }
+       operator LDKC2Tuple_usizeTransactionZ() { LDKC2Tuple_usizeTransactionZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_usizeTransactionZ)); return res; }
+       LDKC2Tuple_usizeTransactionZ* operator &() { return &self; }
+       LDKC2Tuple_usizeTransactionZ* operator ->() { return &self; }
+       const LDKC2Tuple_usizeTransactionZ* operator &() const { return &self; }
+       const LDKC2Tuple_usizeTransactionZ* operator ->() const { return &self; }
 };
 class CVec_NetAddressZ {
 private:
@@ -1844,33 +1858,33 @@ public:
        const LDKCVec_NetAddressZ* operator &() const { return &self; }
        const LDKCVec_NetAddressZ* operator ->() const { return &self; }
 };
-class CResult_CVec_u8ZPeerHandleErrorZ {
+class CVec_EventZ {
 private:
-       LDKCResult_CVec_u8ZPeerHandleErrorZ self;
+       LDKCVec_EventZ self;
 public:
-       CResult_CVec_u8ZPeerHandleErrorZ(const CResult_CVec_u8ZPeerHandleErrorZ&) = delete;
-       ~CResult_CVec_u8ZPeerHandleErrorZ() { CResult_CVec_u8ZPeerHandleErrorZ_free(self); }
-       CResult_CVec_u8ZPeerHandleErrorZ(CResult_CVec_u8ZPeerHandleErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_CVec_u8ZPeerHandleErrorZ)); }
-       CResult_CVec_u8ZPeerHandleErrorZ(LDKCResult_CVec_u8ZPeerHandleErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ)); }
-       operator LDKCResult_CVec_u8ZPeerHandleErrorZ() { LDKCResult_CVec_u8ZPeerHandleErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ)); return res; }
-       LDKCResult_CVec_u8ZPeerHandleErrorZ* operator &() { return &self; }
-       LDKCResult_CVec_u8ZPeerHandleErrorZ* operator ->() { return &self; }
-       const LDKCResult_CVec_u8ZPeerHandleErrorZ* operator &() const { return &self; }
-       const LDKCResult_CVec_u8ZPeerHandleErrorZ* operator ->() const { return &self; }
+       CVec_EventZ(const CVec_EventZ&) = delete;
+       ~CVec_EventZ() { CVec_EventZ_free(self); }
+       CVec_EventZ(CVec_EventZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_EventZ)); }
+       CVec_EventZ(LDKCVec_EventZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_EventZ)); }
+       operator LDKCVec_EventZ() { LDKCVec_EventZ res = self; memset(&self, 0, sizeof(LDKCVec_EventZ)); return res; }
+       LDKCVec_EventZ* operator &() { return &self; }
+       LDKCVec_EventZ* operator ->() { return &self; }
+       const LDKCVec_EventZ* operator &() const { return &self; }
+       const LDKCVec_EventZ* operator ->() const { return &self; }
 };
-class CVec_usizeZ {
+class C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
 private:
-       LDKCVec_usizeZ self;
+       LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ self;
 public:
-       CVec_usizeZ(const CVec_usizeZ&) = delete;
-       ~CVec_usizeZ() { CVec_usizeZ_free(self); }
-       CVec_usizeZ(CVec_usizeZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_usizeZ)); }
-       CVec_usizeZ(LDKCVec_usizeZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_usizeZ)); }
-       operator LDKCVec_usizeZ() { LDKCVec_usizeZ res = self; memset(&self, 0, sizeof(LDKCVec_usizeZ)); return res; }
-       LDKCVec_usizeZ* operator &() { return &self; }
-       LDKCVec_usizeZ* operator ->() { return &self; }
-       const LDKCVec_usizeZ* operator &() const { return &self; }
-       const LDKCVec_usizeZ* operator ->() const { return &self; }
+       C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ(const C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ&) = delete;
+       ~C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ() { C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(self); }
+       C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ(C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ&& o) : self(o.self) { memset(&o, 0, sizeof(C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ)); }
+       C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ)); }
+       operator LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ() { LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ res = self; memset(&self, 0, sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ)); return res; }
+       LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* operator &() { return &self; }
+       LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* operator ->() { return &self; }
+       const LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* operator &() const { return &self; }
+       const LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* operator ->() const { return &self; }
 };
 class CResult_NonePeerHandleErrorZ {
 private:
@@ -1886,131 +1900,117 @@ public:
        const LDKCResult_NonePeerHandleErrorZ* operator &() const { return &self; }
        const LDKCResult_NonePeerHandleErrorZ* operator ->() const { return &self; }
 };
-class CResult_TxCreationKeysSecpErrorZ {
-private:
-       LDKCResult_TxCreationKeysSecpErrorZ self;
-public:
-       CResult_TxCreationKeysSecpErrorZ(const CResult_TxCreationKeysSecpErrorZ&) = delete;
-       ~CResult_TxCreationKeysSecpErrorZ() { CResult_TxCreationKeysSecpErrorZ_free(self); }
-       CResult_TxCreationKeysSecpErrorZ(CResult_TxCreationKeysSecpErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_TxCreationKeysSecpErrorZ)); }
-       CResult_TxCreationKeysSecpErrorZ(LDKCResult_TxCreationKeysSecpErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_TxCreationKeysSecpErrorZ)); }
-       operator LDKCResult_TxCreationKeysSecpErrorZ() { LDKCResult_TxCreationKeysSecpErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_TxCreationKeysSecpErrorZ)); return res; }
-       LDKCResult_TxCreationKeysSecpErrorZ* operator &() { return &self; }
-       LDKCResult_TxCreationKeysSecpErrorZ* operator ->() { return &self; }
-       const LDKCResult_TxCreationKeysSecpErrorZ* operator &() const { return &self; }
-       const LDKCResult_TxCreationKeysSecpErrorZ* operator ->() const { return &self; }
-};
-class CVec_PublicKeyZ {
+class CVec_SpendableOutputDescriptorZ {
 private:
-       LDKCVec_PublicKeyZ self;
+       LDKCVec_SpendableOutputDescriptorZ 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; }
+       CVec_SpendableOutputDescriptorZ(const CVec_SpendableOutputDescriptorZ&) = delete;
+       ~CVec_SpendableOutputDescriptorZ() { CVec_SpendableOutputDescriptorZ_free(self); }
+       CVec_SpendableOutputDescriptorZ(CVec_SpendableOutputDescriptorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_SpendableOutputDescriptorZ)); }
+       CVec_SpendableOutputDescriptorZ(LDKCVec_SpendableOutputDescriptorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_SpendableOutputDescriptorZ)); }
+       operator LDKCVec_SpendableOutputDescriptorZ() { LDKCVec_SpendableOutputDescriptorZ res = self; memset(&self, 0, sizeof(LDKCVec_SpendableOutputDescriptorZ)); return res; }
+       LDKCVec_SpendableOutputDescriptorZ* operator &() { return &self; }
+       LDKCVec_SpendableOutputDescriptorZ* operator ->() { return &self; }
+       const LDKCVec_SpendableOutputDescriptorZ* operator &() const { return &self; }
+       const LDKCVec_SpendableOutputDescriptorZ* operator ->() const { return &self; }
 };
-class CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
+class CResult_RouteLightningErrorZ {
 private:
-       LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ self;
+       LDKCResult_RouteLightningErrorZ self;
 public:
-       CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ(const CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ&) = delete;
-       ~CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ() { CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(self); }
-       CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ(CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ)); }
-       CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ)); }
-       operator LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ() { LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ)); return res; }
-       LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* operator &() { return &self; }
-       LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* operator ->() { return &self; }
-       const LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* operator &() const { return &self; }
-       const LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* operator ->() const { return &self; }
+       CResult_RouteLightningErrorZ(const CResult_RouteLightningErrorZ&) = delete;
+       ~CResult_RouteLightningErrorZ() { CResult_RouteLightningErrorZ_free(self); }
+       CResult_RouteLightningErrorZ(CResult_RouteLightningErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_RouteLightningErrorZ)); }
+       CResult_RouteLightningErrorZ(LDKCResult_RouteLightningErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_RouteLightningErrorZ)); }
+       operator LDKCResult_RouteLightningErrorZ() { LDKCResult_RouteLightningErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_RouteLightningErrorZ)); return res; }
+       LDKCResult_RouteLightningErrorZ* operator &() { return &self; }
+       LDKCResult_RouteLightningErrorZ* operator ->() { return &self; }
+       const LDKCResult_RouteLightningErrorZ* operator &() const { return &self; }
+       const LDKCResult_RouteLightningErrorZ* operator ->() const { return &self; }
 };
-class C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
+class CVec_TxOutZ {
 private:
-       LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ self;
+       LDKCVec_TxOutZ self;
 public:
-       C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ(const C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ&) = delete;
-       ~C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ() { C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(self); }
-       C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ(C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ&& o) : self(o.self) { memset(&o, 0, sizeof(C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ)); }
-       C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ)); }
-       operator LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ() { LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ res = self; memset(&self, 0, sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ)); return res; }
-       LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* operator &() { return &self; }
-       LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* operator ->() { return &self; }
-       const LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* operator &() const { return &self; }
-       const LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* operator ->() const { return &self; }
+       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 CVec_MessageSendEventZ {
+class CVec_ChannelMonitorZ {
 private:
-       LDKCVec_MessageSendEventZ self;
+       LDKCVec_ChannelMonitorZ self;
 public:
-       CVec_MessageSendEventZ(const CVec_MessageSendEventZ&) = delete;
-       ~CVec_MessageSendEventZ() { CVec_MessageSendEventZ_free(self); }
-       CVec_MessageSendEventZ(CVec_MessageSendEventZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_MessageSendEventZ)); }
-       CVec_MessageSendEventZ(LDKCVec_MessageSendEventZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_MessageSendEventZ)); }
-       operator LDKCVec_MessageSendEventZ() { LDKCVec_MessageSendEventZ res = self; memset(&self, 0, sizeof(LDKCVec_MessageSendEventZ)); return res; }
-       LDKCVec_MessageSendEventZ* operator &() { return &self; }
-       LDKCVec_MessageSendEventZ* operator ->() { return &self; }
-       const LDKCVec_MessageSendEventZ* operator &() const { return &self; }
-       const LDKCVec_MessageSendEventZ* operator ->() const { return &self; }
+       CVec_ChannelMonitorZ(const CVec_ChannelMonitorZ&) = delete;
+       ~CVec_ChannelMonitorZ() { CVec_ChannelMonitorZ_free(self); }
+       CVec_ChannelMonitorZ(CVec_ChannelMonitorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_ChannelMonitorZ)); }
+       CVec_ChannelMonitorZ(LDKCVec_ChannelMonitorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_ChannelMonitorZ)); }
+       operator LDKCVec_ChannelMonitorZ() { LDKCVec_ChannelMonitorZ res = self; memset(&self, 0, sizeof(LDKCVec_ChannelMonitorZ)); return res; }
+       LDKCVec_ChannelMonitorZ* operator &() { return &self; }
+       LDKCVec_ChannelMonitorZ* operator ->() { return &self; }
+       const LDKCVec_ChannelMonitorZ* operator &() const { return &self; }
+       const LDKCVec_ChannelMonitorZ* operator ->() const { return &self; }
 };
-class CVec_UpdateFailHTLCZ {
+class CResult_CVec_u8ZPeerHandleErrorZ {
 private:
-       LDKCVec_UpdateFailHTLCZ self;
+       LDKCResult_CVec_u8ZPeerHandleErrorZ 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; }
+       CResult_CVec_u8ZPeerHandleErrorZ(const CResult_CVec_u8ZPeerHandleErrorZ&) = delete;
+       ~CResult_CVec_u8ZPeerHandleErrorZ() { CResult_CVec_u8ZPeerHandleErrorZ_free(self); }
+       CResult_CVec_u8ZPeerHandleErrorZ(CResult_CVec_u8ZPeerHandleErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_CVec_u8ZPeerHandleErrorZ)); }
+       CResult_CVec_u8ZPeerHandleErrorZ(LDKCResult_CVec_u8ZPeerHandleErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ)); }
+       operator LDKCResult_CVec_u8ZPeerHandleErrorZ() { LDKCResult_CVec_u8ZPeerHandleErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ)); return res; }
+       LDKCResult_CVec_u8ZPeerHandleErrorZ* operator &() { return &self; }
+       LDKCResult_CVec_u8ZPeerHandleErrorZ* operator ->() { return &self; }
+       const LDKCResult_CVec_u8ZPeerHandleErrorZ* operator &() const { return &self; }
+       const LDKCResult_CVec_u8ZPeerHandleErrorZ* operator ->() const { return &self; }
 };
-class CVec_UpdateFulfillHTLCZ {
+class CResult_TxCreationKeysSecpErrorZ {
 private:
-       LDKCVec_UpdateFulfillHTLCZ self;
+       LDKCResult_TxCreationKeysSecpErrorZ self;
 public:
-       CVec_UpdateFulfillHTLCZ(const CVec_UpdateFulfillHTLCZ&) = delete;
-       ~CVec_UpdateFulfillHTLCZ() { CVec_UpdateFulfillHTLCZ_free(self); }
-       CVec_UpdateFulfillHTLCZ(CVec_UpdateFulfillHTLCZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_UpdateFulfillHTLCZ)); }
-       CVec_UpdateFulfillHTLCZ(LDKCVec_UpdateFulfillHTLCZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_UpdateFulfillHTLCZ)); }
-       operator LDKCVec_UpdateFulfillHTLCZ() { LDKCVec_UpdateFulfillHTLCZ res = self; memset(&self, 0, sizeof(LDKCVec_UpdateFulfillHTLCZ)); return res; }
-       LDKCVec_UpdateFulfillHTLCZ* operator &() { return &self; }
-       LDKCVec_UpdateFulfillHTLCZ* operator ->() { return &self; }
-       const LDKCVec_UpdateFulfillHTLCZ* operator &() const { return &self; }
-       const LDKCVec_UpdateFulfillHTLCZ* operator ->() const { return &self; }
+       CResult_TxCreationKeysSecpErrorZ(const CResult_TxCreationKeysSecpErrorZ&) = delete;
+       ~CResult_TxCreationKeysSecpErrorZ() { CResult_TxCreationKeysSecpErrorZ_free(self); }
+       CResult_TxCreationKeysSecpErrorZ(CResult_TxCreationKeysSecpErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_TxCreationKeysSecpErrorZ)); }
+       CResult_TxCreationKeysSecpErrorZ(LDKCResult_TxCreationKeysSecpErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_TxCreationKeysSecpErrorZ)); }
+       operator LDKCResult_TxCreationKeysSecpErrorZ() { LDKCResult_TxCreationKeysSecpErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_TxCreationKeysSecpErrorZ)); return res; }
+       LDKCResult_TxCreationKeysSecpErrorZ* operator &() { return &self; }
+       LDKCResult_TxCreationKeysSecpErrorZ* operator ->() { return &self; }
+       const LDKCResult_TxCreationKeysSecpErrorZ* operator &() const { return &self; }
+       const LDKCResult_TxCreationKeysSecpErrorZ* operator ->() const { return &self; }
 };
-class CVec_UpdateAddHTLCZ {
+class CVec_C2Tuple_TxidCVec_TxOutZZZ {
 private:
-       LDKCVec_UpdateAddHTLCZ self;
+       LDKCVec_C2Tuple_TxidCVec_TxOutZZZ self;
 public:
-       CVec_UpdateAddHTLCZ(const CVec_UpdateAddHTLCZ&) = delete;
-       ~CVec_UpdateAddHTLCZ() { CVec_UpdateAddHTLCZ_free(self); }
-       CVec_UpdateAddHTLCZ(CVec_UpdateAddHTLCZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_UpdateAddHTLCZ)); }
-       CVec_UpdateAddHTLCZ(LDKCVec_UpdateAddHTLCZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_UpdateAddHTLCZ)); }
-       operator LDKCVec_UpdateAddHTLCZ() { LDKCVec_UpdateAddHTLCZ res = self; memset(&self, 0, sizeof(LDKCVec_UpdateAddHTLCZ)); return res; }
-       LDKCVec_UpdateAddHTLCZ* operator &() { return &self; }
-       LDKCVec_UpdateAddHTLCZ* operator ->() { return &self; }
-       const LDKCVec_UpdateAddHTLCZ* operator &() const { return &self; }
-       const LDKCVec_UpdateAddHTLCZ* operator ->() const { return &self; }
+       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; }
 };
-class CVec_EventZ {
+class CResult_TxOutAccessErrorZ {
 private:
-       LDKCVec_EventZ self;
+       LDKCResult_TxOutAccessErrorZ self;
 public:
-       CVec_EventZ(const CVec_EventZ&) = delete;
-       ~CVec_EventZ() { CVec_EventZ_free(self); }
-       CVec_EventZ(CVec_EventZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_EventZ)); }
-       CVec_EventZ(LDKCVec_EventZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_EventZ)); }
-       operator LDKCVec_EventZ() { LDKCVec_EventZ res = self; memset(&self, 0, sizeof(LDKCVec_EventZ)); return res; }
-       LDKCVec_EventZ* operator &() { return &self; }
-       LDKCVec_EventZ* operator ->() { return &self; }
-       const LDKCVec_EventZ* operator &() const { return &self; }
-       const LDKCVec_EventZ* operator ->() const { return &self; }
+       CResult_TxOutAccessErrorZ(const CResult_TxOutAccessErrorZ&) = delete;
+       ~CResult_TxOutAccessErrorZ() { CResult_TxOutAccessErrorZ_free(self); }
+       CResult_TxOutAccessErrorZ(CResult_TxOutAccessErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_TxOutAccessErrorZ)); }
+       CResult_TxOutAccessErrorZ(LDKCResult_TxOutAccessErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_TxOutAccessErrorZ)); }
+       operator LDKCResult_TxOutAccessErrorZ() { LDKCResult_TxOutAccessErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_TxOutAccessErrorZ)); return res; }
+       LDKCResult_TxOutAccessErrorZ* operator &() { return &self; }
+       LDKCResult_TxOutAccessErrorZ* operator ->() { return &self; }
+       const LDKCResult_TxOutAccessErrorZ* operator &() const { return &self; }
+       const LDKCResult_TxOutAccessErrorZ* operator ->() const { return &self; }
 };
 class CVec_SignatureZ {
 private:
@@ -2026,32 +2026,32 @@ public:
        const LDKCVec_SignatureZ* operator &() const { return &self; }
        const LDKCVec_SignatureZ* operator ->() const { return &self; }
 };
-class CVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ {
+class CVec_UpdateAddHTLCZ {
 private:
-       LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ self;
+       LDKCVec_UpdateAddHTLCZ self;
 public:
-       CVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ(const CVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ&) = delete;
-       ~CVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ() { CVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ_free(self); }
-       CVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ(CVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ)); }
-       CVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ(LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ)); }
-       operator LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ() { LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ res = self; memset(&self, 0, sizeof(LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ)); return res; }
-       LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ* operator &() { return &self; }
-       LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ* operator ->() { return &self; }
-       const LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ* operator &() const { return &self; }
-       const LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ* operator ->() const { return &self; }
+       CVec_UpdateAddHTLCZ(const CVec_UpdateAddHTLCZ&) = delete;
+       ~CVec_UpdateAddHTLCZ() { CVec_UpdateAddHTLCZ_free(self); }
+       CVec_UpdateAddHTLCZ(CVec_UpdateAddHTLCZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_UpdateAddHTLCZ)); }
+       CVec_UpdateAddHTLCZ(LDKCVec_UpdateAddHTLCZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_UpdateAddHTLCZ)); }
+       operator LDKCVec_UpdateAddHTLCZ() { LDKCVec_UpdateAddHTLCZ res = self; memset(&self, 0, sizeof(LDKCVec_UpdateAddHTLCZ)); return res; }
+       LDKCVec_UpdateAddHTLCZ* operator &() { return &self; }
+       LDKCVec_UpdateAddHTLCZ* operator ->() { return &self; }
+       const LDKCVec_UpdateAddHTLCZ* operator &() const { return &self; }
+       const LDKCVec_UpdateAddHTLCZ* operator ->() const { return &self; }
 };
-class CResult_SignatureNoneZ {
+class CVec_HTLCOutputInCommitmentZ {
 private:
-       LDKCResult_SignatureNoneZ self;
+       LDKCVec_HTLCOutputInCommitmentZ self;
 public:
-       CResult_SignatureNoneZ(const CResult_SignatureNoneZ&) = delete;
-       ~CResult_SignatureNoneZ() { CResult_SignatureNoneZ_free(self); }
-       CResult_SignatureNoneZ(CResult_SignatureNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_SignatureNoneZ)); }
-       CResult_SignatureNoneZ(LDKCResult_SignatureNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_SignatureNoneZ)); }
-       operator LDKCResult_SignatureNoneZ() { LDKCResult_SignatureNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_SignatureNoneZ)); return res; }
-       LDKCResult_SignatureNoneZ* operator &() { return &self; }
-       LDKCResult_SignatureNoneZ* operator ->() { return &self; }
-       const LDKCResult_SignatureNoneZ* operator &() const { return &self; }
-       const LDKCResult_SignatureNoneZ* operator ->() const { return &self; }
+       CVec_HTLCOutputInCommitmentZ(const CVec_HTLCOutputInCommitmentZ&) = delete;
+       ~CVec_HTLCOutputInCommitmentZ() { CVec_HTLCOutputInCommitmentZ_free(self); }
+       CVec_HTLCOutputInCommitmentZ(CVec_HTLCOutputInCommitmentZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_HTLCOutputInCommitmentZ)); }
+       CVec_HTLCOutputInCommitmentZ(LDKCVec_HTLCOutputInCommitmentZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_HTLCOutputInCommitmentZ)); }
+       operator LDKCVec_HTLCOutputInCommitmentZ() { LDKCVec_HTLCOutputInCommitmentZ res = self; memset(&self, 0, sizeof(LDKCVec_HTLCOutputInCommitmentZ)); return res; }
+       LDKCVec_HTLCOutputInCommitmentZ* operator &() { return &self; }
+       LDKCVec_HTLCOutputInCommitmentZ* operator ->() { return &self; }
+       const LDKCVec_HTLCOutputInCommitmentZ* operator &() const { return &self; }
+       const LDKCVec_HTLCOutputInCommitmentZ* operator ->() const { return &self; }
 };
 }
index e328836e1bc7416abc4c795b2402054632ace747..ca6cdc69fa95cc4fa20ce4223797bfe6025071da 100644 (file)
@@ -16,12 +16,18 @@ struct nativeChannelConfigOpaque;
 typedef struct nativeChannelConfigOpaque LDKnativeChannelConfig;
 struct nativeUserConfigOpaque;
 typedef struct nativeUserConfigOpaque LDKnativeUserConfig;
-struct nativeChainWatchedUtilOpaque;
-typedef struct nativeChainWatchedUtilOpaque LDKnativeChainWatchedUtil;
-struct nativeBlockNotifierOpaque;
-typedef struct nativeBlockNotifierOpaque LDKnativeBlockNotifier;
-struct nativeChainWatchInterfaceUtilOpaque;
-typedef struct nativeChainWatchInterfaceUtilOpaque LDKnativeChainWatchInterfaceUtil;
+struct nativeChainMonitorOpaque;
+typedef struct nativeChainMonitorOpaque LDKnativeChainMonitor;
+struct nativeChannelMonitorUpdateOpaque;
+typedef struct nativeChannelMonitorUpdateOpaque LDKnativeChannelMonitorUpdate;
+struct nativeMonitorUpdateErrorOpaque;
+typedef struct nativeMonitorUpdateErrorOpaque LDKnativeMonitorUpdateError;
+struct nativeMonitorEventOpaque;
+typedef struct nativeMonitorEventOpaque LDKnativeMonitorEvent;
+struct nativeHTLCUpdateOpaque;
+typedef struct nativeHTLCUpdateOpaque LDKnativeHTLCUpdate;
+struct nativeChannelMonitorOpaque;
+typedef struct nativeChannelMonitorOpaque LDKnativeChannelMonitor;
 struct nativeOutPointOpaque;
 typedef struct nativeOutPointOpaque LDKnativeOutPoint;
 struct LDKChannelKeys;
@@ -38,16 +44,6 @@ struct nativePaymentSendFailureOpaque;
 typedef struct nativePaymentSendFailureOpaque LDKnativePaymentSendFailure;
 struct nativeChannelManagerReadArgsOpaque;
 typedef struct nativeChannelManagerReadArgsOpaque LDKnativeChannelManagerReadArgs;
-struct nativeChannelMonitorUpdateOpaque;
-typedef struct nativeChannelMonitorUpdateOpaque LDKnativeChannelMonitorUpdate;
-struct nativeMonitorUpdateErrorOpaque;
-typedef struct nativeMonitorUpdateErrorOpaque LDKnativeMonitorUpdateError;
-struct nativeMonitorEventOpaque;
-typedef struct nativeMonitorEventOpaque LDKnativeMonitorEvent;
-struct nativeHTLCUpdateOpaque;
-typedef struct nativeHTLCUpdateOpaque LDKnativeHTLCUpdate;
-struct nativeChannelMonitorOpaque;
-typedef struct nativeChannelMonitorOpaque LDKnativeChannelMonitor;
 struct nativeDecodeErrorOpaque;
 typedef struct nativeDecodeErrorOpaque LDKnativeDecodeError;
 struct nativeInitOpaque;
index 16463a1894e33c13db7da4467ece14a4512ba0bc..873f815f4ba9715ffaee3bf841bfb95a54008c19 100644 (file)
@@ -14,50 +14,91 @@ pub type CVec_EventZ = crate::c_types::CVecTempl<crate::util::events::Event>;
 pub static CVec_EventZ_free: extern "C" fn(CVec_EventZ) = crate::c_types::CVecTempl_free::<crate::util::events::Event>;
 
 #[no_mangle]
-pub type C2Tuple_Txidu32Z = crate::c_types::C2TupleTempl<crate::c_types::ThirtyTwoBytes, u32>;
+pub type C2Tuple_usizeTransactionZ = crate::c_types::C2TupleTempl<usize, crate::c_types::Transaction>;
 #[no_mangle]
-pub static C2Tuple_Txidu32Z_free: extern "C" fn(C2Tuple_Txidu32Z) = crate::c_types::C2TupleTempl_free::<crate::c_types::ThirtyTwoBytes, u32>;
+pub static C2Tuple_usizeTransactionZ_free: extern "C" fn(C2Tuple_usizeTransactionZ) = crate::c_types::C2TupleTempl_free::<usize, crate::c_types::Transaction>;
 #[no_mangle]
-pub extern "C" fn C2Tuple_Txidu32Z_new(a: crate::c_types::ThirtyTwoBytes, b: u32) -> C2Tuple_Txidu32Z {
-       C2Tuple_Txidu32Z {
+pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
+       C2Tuple_usizeTransactionZ {
                a: Box::into_raw(Box::new(a)),
                b: Box::into_raw(Box::new(b)),
        }
 }
 
 #[no_mangle]
-pub type C2Tuple_Scriptu64Z = crate::c_types::C2TupleTempl<crate::c_types::derived::CVec_u8Z, u64>;
+pub type CVec_C2Tuple_usizeTransactionZZ = crate::c_types::CVecTempl<crate::c_types::C2TupleTempl<usize, crate::c_types::Transaction>>;
 #[no_mangle]
-pub static C2Tuple_Scriptu64Z_free: extern "C" fn(C2Tuple_Scriptu64Z) = crate::c_types::C2TupleTempl_free::<crate::c_types::derived::CVec_u8Z, u64>;
+pub static CVec_C2Tuple_usizeTransactionZZ_free: extern "C" fn(CVec_C2Tuple_usizeTransactionZZ) = crate::c_types::CVecTempl_free::<crate::c_types::C2TupleTempl<usize, crate::c_types::Transaction>>;
+
+#[no_mangle]
+pub type CResult_NoneChannelMonitorUpdateErrZ = crate::c_types::CResultTempl<u8, crate::chain::channelmonitor::ChannelMonitorUpdateErr>;
+#[no_mangle]
+pub static CResult_NoneChannelMonitorUpdateErrZ_free: extern "C" fn(CResult_NoneChannelMonitorUpdateErrZ) = crate::c_types::CResultTempl_free::<u8, crate::chain::channelmonitor::ChannelMonitorUpdateErr>;
+#[no_mangle]
+pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_ok() -> CResult_NoneChannelMonitorUpdateErrZ {
+       crate::c_types::CResultTempl::ok(0)
+}
+
+#[no_mangle]
+pub static CResult_NoneChannelMonitorUpdateErrZ_err: extern "C" fn (crate::chain::channelmonitor::ChannelMonitorUpdateErr) -> CResult_NoneChannelMonitorUpdateErrZ =
+       crate::c_types::CResultTempl::<u8, crate::chain::channelmonitor::ChannelMonitorUpdateErr>::err;
+
 #[no_mangle]
-pub extern "C" fn C2Tuple_Scriptu64Z_new(a: crate::c_types::derived::CVec_u8Z, b: u64) -> C2Tuple_Scriptu64Z {
-       C2Tuple_Scriptu64Z {
+pub type CVec_MonitorEventZ = crate::c_types::CVecTempl<crate::chain::channelmonitor::MonitorEvent>;
+#[no_mangle]
+pub static CVec_MonitorEventZ_free: extern "C" fn(CVec_MonitorEventZ) = crate::c_types::CVecTempl_free::<crate::chain::channelmonitor::MonitorEvent>;
+
+#[no_mangle]
+pub type CResult_NoneMonitorUpdateErrorZ = crate::c_types::CResultTempl<u8, crate::chain::channelmonitor::MonitorUpdateError>;
+#[no_mangle]
+pub static CResult_NoneMonitorUpdateErrorZ_free: extern "C" fn(CResult_NoneMonitorUpdateErrorZ) = crate::c_types::CResultTempl_free::<u8, crate::chain::channelmonitor::MonitorUpdateError>;
+#[no_mangle]
+pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_ok() -> CResult_NoneMonitorUpdateErrorZ {
+       crate::c_types::CResultTempl::ok(0)
+}
+
+#[no_mangle]
+pub static CResult_NoneMonitorUpdateErrorZ_err: extern "C" fn (crate::chain::channelmonitor::MonitorUpdateError) -> CResult_NoneMonitorUpdateErrorZ =
+       crate::c_types::CResultTempl::<u8, crate::chain::channelmonitor::MonitorUpdateError>::err;
+
+#[no_mangle]
+pub type C2Tuple_OutPointScriptZ = crate::c_types::C2TupleTempl<crate::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z>;
+#[no_mangle]
+pub static C2Tuple_OutPointScriptZ_free: extern "C" fn(C2Tuple_OutPointScriptZ) = crate::c_types::C2TupleTempl_free::<crate::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z>;
+#[no_mangle]
+pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
+       C2Tuple_OutPointScriptZ {
                a: Box::into_raw(Box::new(a)),
                b: Box::into_raw(Box::new(b)),
        }
 }
 
 #[no_mangle]
-pub type CResult_C2Tuple_Scriptu64ZChainErrorZ = crate::c_types::CResultTempl<crate::c_types::C2TupleTempl<crate::c_types::derived::CVec_u8Z, u64>, crate::chain::chaininterface::ChainError>;
+pub type CVec_TransactionZ = crate::c_types::CVecTempl<crate::c_types::Transaction>;
 #[no_mangle]
-pub static CResult_C2Tuple_Scriptu64ZChainErrorZ_free: extern "C" fn(CResult_C2Tuple_Scriptu64ZChainErrorZ) = crate::c_types::CResultTempl_free::<crate::c_types::C2TupleTempl<crate::c_types::derived::CVec_u8Z, u64>, crate::chain::chaininterface::ChainError>;
-#[no_mangle]
-pub static CResult_C2Tuple_Scriptu64ZChainErrorZ_ok: extern "C" fn (C2Tuple_Scriptu64Z) -> CResult_C2Tuple_Scriptu64ZChainErrorZ =
-       crate::c_types::CResultTempl::<crate::c_types::C2TupleTempl<crate::c_types::derived::CVec_u8Z, u64>, crate::chain::chaininterface::ChainError>::ok;
+pub static CVec_TransactionZ_free: extern "C" fn(CVec_TransactionZ) = crate::c_types::CVecTempl_free::<crate::c_types::Transaction>;
 
 #[no_mangle]
-pub static CResult_C2Tuple_Scriptu64ZChainErrorZ_err: extern "C" fn (crate::chain::chaininterface::ChainError) -> CResult_C2Tuple_Scriptu64ZChainErrorZ =
-       crate::c_types::CResultTempl::<crate::c_types::C2TupleTempl<crate::c_types::derived::CVec_u8Z, u64>, crate::chain::chaininterface::ChainError>::err;
+pub type CVec_TxOutZ = crate::c_types::CVecTempl<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>;
 
 #[no_mangle]
-pub type CVec_usizeZ = crate::c_types::CVecTempl<usize>;
+pub type C2Tuple_TxidCVec_TxOutZZ = crate::c_types::C2TupleTempl<crate::c_types::ThirtyTwoBytes, crate::c_types::CVecTempl<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>>;
 #[no_mangle]
-pub static CVec_usizeZ_free: extern "C" fn(CVec_usizeZ) = crate::c_types::CVecTempl_free::<usize>;
+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: Box::into_raw(Box::new(a)),
+               b: Box::into_raw(Box::new(b)),
+       }
+}
 
 #[no_mangle]
-pub type CVec_TransactionZ = crate::c_types::CVecTempl<crate::c_types::derived::CVec_u8Z>;
+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>>>;
 #[no_mangle]
-pub static CVec_TransactionZ_free: extern "C" fn(CVec_TransactionZ) = crate::c_types::CVecTempl_free::<crate::c_types::derived::CVec_u8Z>;
+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>>>;
 
 #[no_mangle]
 pub type C2Tuple_u64u64Z = crate::c_types::C2TupleTempl<u64, u64>;
@@ -132,6 +173,18 @@ pub extern "C" fn CResult_CVec_SignatureZNoneZ_err() -> CResult_CVec_SignatureZN
        crate::c_types::CResultTempl::err(0)
 }
 
+#[no_mangle]
+pub type CResult_TxOutAccessErrorZ = crate::c_types::CResultTempl<crate::c_types::TxOut, crate::chain::AccessError>;
+#[no_mangle]
+pub static CResult_TxOutAccessErrorZ_free: extern "C" fn(CResult_TxOutAccessErrorZ) = crate::c_types::CResultTempl_free::<crate::c_types::TxOut, crate::chain::AccessError>;
+#[no_mangle]
+pub static CResult_TxOutAccessErrorZ_ok: extern "C" fn (crate::c_types::TxOut) -> CResult_TxOutAccessErrorZ =
+       crate::c_types::CResultTempl::<crate::c_types::TxOut, crate::chain::AccessError>::ok;
+
+#[no_mangle]
+pub static CResult_TxOutAccessErrorZ_err: extern "C" fn (crate::chain::AccessError) -> CResult_TxOutAccessErrorZ =
+       crate::c_types::CResultTempl::<crate::c_types::TxOut, crate::chain::AccessError>::err;
+
 #[no_mangle]
 pub type CResult_NoneAPIErrorZ = crate::c_types::CResultTempl<u8, crate::util::errors::APIError>;
 #[no_mangle]
@@ -169,52 +222,9 @@ pub type CVec_NetAddressZ = crate::c_types::CVecTempl<crate::ln::msgs::NetAddres
 pub static CVec_NetAddressZ_free: extern "C" fn(CVec_NetAddressZ) = crate::c_types::CVecTempl_free::<crate::ln::msgs::NetAddress>;
 
 #[no_mangle]
-pub type CVec_ChannelMonitorZ = crate::c_types::CVecTempl<crate::ln::channelmonitor::ChannelMonitor>;
-#[no_mangle]
-pub static CVec_ChannelMonitorZ_free: extern "C" fn(CVec_ChannelMonitorZ) = crate::c_types::CVecTempl_free::<crate::ln::channelmonitor::ChannelMonitor>;
-
-#[no_mangle]
-pub type CResult_NoneChannelMonitorUpdateErrZ = crate::c_types::CResultTempl<u8, crate::ln::channelmonitor::ChannelMonitorUpdateErr>;
-#[no_mangle]
-pub static CResult_NoneChannelMonitorUpdateErrZ_free: extern "C" fn(CResult_NoneChannelMonitorUpdateErrZ) = crate::c_types::CResultTempl_free::<u8, crate::ln::channelmonitor::ChannelMonitorUpdateErr>;
-#[no_mangle]
-pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_ok() -> CResult_NoneChannelMonitorUpdateErrZ {
-       crate::c_types::CResultTempl::ok(0)
-}
-
-#[no_mangle]
-pub static CResult_NoneChannelMonitorUpdateErrZ_err: extern "C" fn (crate::ln::channelmonitor::ChannelMonitorUpdateErr) -> CResult_NoneChannelMonitorUpdateErrZ =
-       crate::c_types::CResultTempl::<u8, crate::ln::channelmonitor::ChannelMonitorUpdateErr>::err;
-
-#[no_mangle]
-pub type CVec_MonitorEventZ = crate::c_types::CVecTempl<crate::ln::channelmonitor::MonitorEvent>;
-#[no_mangle]
-pub static CVec_MonitorEventZ_free: extern "C" fn(CVec_MonitorEventZ) = crate::c_types::CVecTempl_free::<crate::ln::channelmonitor::MonitorEvent>;
-
-#[no_mangle]
-pub type CResult_NoneMonitorUpdateErrorZ = crate::c_types::CResultTempl<u8, crate::ln::channelmonitor::MonitorUpdateError>;
+pub type CVec_ChannelMonitorZ = crate::c_types::CVecTempl<crate::chain::channelmonitor::ChannelMonitor>;
 #[no_mangle]
-pub static CResult_NoneMonitorUpdateErrorZ_free: extern "C" fn(CResult_NoneMonitorUpdateErrorZ) = crate::c_types::CResultTempl_free::<u8, crate::ln::channelmonitor::MonitorUpdateError>;
-#[no_mangle]
-pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_ok() -> CResult_NoneMonitorUpdateErrorZ {
-       crate::c_types::CResultTempl::ok(0)
-}
-
-#[no_mangle]
-pub static CResult_NoneMonitorUpdateErrorZ_err: extern "C" fn (crate::ln::channelmonitor::MonitorUpdateError) -> CResult_NoneMonitorUpdateErrorZ =
-       crate::c_types::CResultTempl::<u8, crate::ln::channelmonitor::MonitorUpdateError>::err;
-
-#[no_mangle]
-pub type C2Tuple_OutPointScriptZ = crate::c_types::C2TupleTempl<crate::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z>;
-#[no_mangle]
-pub static C2Tuple_OutPointScriptZ_free: extern "C" fn(C2Tuple_OutPointScriptZ) = crate::c_types::C2TupleTempl_free::<crate::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z>;
-#[no_mangle]
-pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
-       C2Tuple_OutPointScriptZ {
-               a: Box::into_raw(Box::new(a)),
-               b: Box::into_raw(Box::new(b)),
-       }
-}
+pub static CVec_ChannelMonitorZ_free: extern "C" fn(CVec_ChannelMonitorZ) = crate::c_types::CVecTempl_free::<crate::chain::channelmonitor::ChannelMonitor>;
 
 #[no_mangle]
 pub type CVec_u64Z = crate::c_types::CVecTempl<u64>;
index 5a08dddb850dafd2670ccdef9835858a51d72c09..ef524b568de24cbdaf1d2c880171bd1c8be71c81 100644 (file)
@@ -8,136 +8,6 @@ use std::ffi::c_void;
 use bitcoin::hashes::Hash;
 use crate::c_types::*;
 
-/// Used to give chain error details upstream
-#[must_use]
-#[derive(Clone)]
-#[repr(C)]
-pub enum ChainError {
-       /// Client doesn't support UTXO lookup (but the chain hash matches our genesis block hash)
-       NotSupported,
-       /// Chain isn't the one watched
-       NotWatched,
-       /// Tx doesn't exist or is unconfirmed
-       UnknownTx,
-}
-use lightning::chain::chaininterface::ChainError as nativeChainError;
-impl ChainError {
-       #[allow(unused)]
-       pub(crate) fn to_native(&self) -> nativeChainError {
-               match self {
-                       ChainError::NotSupported => nativeChainError::NotSupported,
-                       ChainError::NotWatched => nativeChainError::NotWatched,
-                       ChainError::UnknownTx => nativeChainError::UnknownTx,
-               }
-       }
-       #[allow(unused)]
-       pub(crate) fn into_native(self) -> nativeChainError {
-               match self {
-                       ChainError::NotSupported => nativeChainError::NotSupported,
-                       ChainError::NotWatched => nativeChainError::NotWatched,
-                       ChainError::UnknownTx => nativeChainError::UnknownTx,
-               }
-       }
-       #[allow(unused)]
-       pub(crate) fn from_native(native: &nativeChainError) -> Self {
-               match native {
-                       nativeChainError::NotSupported => ChainError::NotSupported,
-                       nativeChainError::NotWatched => ChainError::NotWatched,
-                       nativeChainError::UnknownTx => ChainError::UnknownTx,
-               }
-       }
-       #[allow(unused)]
-       pub(crate) fn native_into(native: nativeChainError) -> Self {
-               match native {
-                       nativeChainError::NotSupported => ChainError::NotSupported,
-                       nativeChainError::NotWatched => ChainError::NotWatched,
-                       nativeChainError::UnknownTx => ChainError::UnknownTx,
-               }
-       }
-}
-/// An interface to request notification of certain scripts as they appear the
-/// chain.
-///
-/// Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
-/// called from inside the library in response to ChainListener events, P2P events, or timer
-/// events).
-#[repr(C)]
-pub struct ChainWatchInterface {
-       pub this_arg: *mut c_void,
-       /// Provides a txid/random-scriptPubKey-in-the-tx which much be watched for.
-       pub install_watch_tx: extern "C" fn (this_arg: *const c_void, txid: *const [u8; 32], script_pub_key: crate::c_types::u8slice),
-       /// Provides an outpoint which must be watched for, providing any transactions which spend the
-       /// given outpoint.
-       pub install_watch_outpoint: extern "C" fn (this_arg: *const c_void, outpoint: crate::c_types::derived::C2Tuple_Txidu32Z, out_script: crate::c_types::u8slice),
-       /// Indicates that a listener needs to see all transactions.
-       pub watch_all_txn: extern "C" fn (this_arg: *const c_void),
-       /// Gets the script and value in satoshis for a given unspent transaction output given a
-       /// short_channel_id (aka unspent_tx_output_identier). For BTC/tBTC channels the top three
-       /// bytes are the block height, the next 3 the transaction index within the block, and the
-       /// final two the output within the transaction.
-       #[must_use]
-       pub get_chain_utxo: extern "C" fn (this_arg: *const c_void, genesis_hash: crate::c_types::ThirtyTwoBytes, unspent_tx_output_identifier: u64) -> crate::c_types::derived::CResult_C2Tuple_Scriptu64ZChainErrorZ,
-       /// Gets the list of transaction indices within a given block that the ChainWatchInterface is
-       /// watching for.
-       #[must_use]
-       pub filter_block: extern "C" fn (this_arg: *const c_void, block: crate::c_types::u8slice) -> crate::c_types::derived::CVec_usizeZ,
-       /// Returns a usize that changes when the ChainWatchInterface's watched data is modified.
-       /// Users of `filter_block` should pre-save a copy of `reentered`'s return value and use it to
-       /// determine whether they need to re-filter a given block.
-       #[must_use]
-       pub reentered: extern "C" fn (this_arg: *const c_void) -> usize,
-       pub free: Option<extern "C" fn(this_arg: *mut c_void)>,
-}
-unsafe impl Sync for ChainWatchInterface {}
-unsafe impl Send for ChainWatchInterface {}
-
-use lightning::chain::chaininterface::ChainWatchInterface as rustChainWatchInterface;
-impl rustChainWatchInterface for ChainWatchInterface {
-       fn install_watch_tx(&self, txid: &bitcoin::hash_types::Txid, script_pub_key: &bitcoin::blockdata::script::Script) {
-               (self.install_watch_tx)(self.this_arg, txid.as_inner(), crate::c_types::u8slice::from_slice(&script_pub_key[..]))
-       }
-       fn install_watch_outpoint(&self, outpoint: (bitcoin::hash_types::Txid, u32), out_script: &bitcoin::blockdata::script::Script) {
-               let (mut orig_outpoint_0, mut orig_outpoint_1) = outpoint; let mut local_outpoint = (crate::c_types::ThirtyTwoBytes { data: orig_outpoint_0.into_inner() }, orig_outpoint_1).into();
-               (self.install_watch_outpoint)(self.this_arg, local_outpoint, crate::c_types::u8slice::from_slice(&out_script[..]))
-       }
-       fn watch_all_txn(&self) {
-               (self.watch_all_txn)(self.this_arg)
-       }
-       fn get_chain_utxo(&self, genesis_hash: bitcoin::hash_types::BlockHash, unspent_tx_output_identifier: u64) -> Result<(bitcoin::blockdata::script::Script, u64), lightning::chain::chaininterface::ChainError> {
-               let mut ret = (self.get_chain_utxo)(self.this_arg, crate::c_types::ThirtyTwoBytes { data: genesis_hash.into_inner() }, unspent_tx_output_identifier);
-               let mut local_ret = match ret.result_ok { true => Ok( { let (mut orig_ret_0_0, mut orig_ret_0_1) = (*unsafe { Box::from_raw(ret.contents.result.take_ptr()) }).to_rust(); let mut local_ret_0 = (::bitcoin::blockdata::script::Script::from(orig_ret_0_0.into_rust()), orig_ret_0_1); local_ret_0 }), false => Err( { (*unsafe { Box::from_raw(ret.contents.err.take_ptr()) }).into_native() })};
-               local_ret
-       }
-       fn filter_block(&self, block: &bitcoin::blockdata::block::Block) -> Vec<usize> {
-               let mut local_block = ::bitcoin::consensus::encode::serialize(block);
-               let mut ret = (self.filter_block)(self.this_arg, crate::c_types::u8slice::from_slice(&local_block));
-               let mut local_ret = Vec::new(); for mut item in ret.into_rust().drain(..) { local_ret.push( { item }); };
-               local_ret
-       }
-       fn reentered(&self) -> usize {
-               let mut ret = (self.reentered)(self.this_arg);
-               ret
-       }
-}
-
-// We're essentially a pointer already, or at least a set of pointers, so allow us to be used
-// directly as a Deref trait in higher-level structs:
-impl std::ops::Deref for ChainWatchInterface {
-       type Target = Self;
-       fn deref(&self) -> &Self {
-               self
-       }
-}
-/// Calls the free function if one is set
-#[no_mangle]
-pub extern "C" fn ChainWatchInterface_free(this_ptr: ChainWatchInterface) { }
-impl Drop for ChainWatchInterface {
-       fn drop(&mut self) {
-               if let Some(f) = self.free {
-                       f(self.this_arg);
-               }
-       }
-}
 /// An interface to send a transaction to the Bitcoin network.
 #[repr(C)]
 pub struct BroadcasterInterface {
@@ -153,7 +23,7 @@ use lightning::chain::chaininterface::BroadcasterInterface as rustBroadcasterInt
 impl rustBroadcasterInterface for BroadcasterInterface {
        fn broadcast_transaction(&self, tx: &bitcoin::blockdata::transaction::Transaction) {
                let mut local_tx = ::bitcoin::consensus::encode::serialize(tx);
-               (self.broadcast_transaction)(self.this_arg, crate::c_types::Transaction::from_slice(&local_tx))
+               (self.broadcast_transaction)(self.this_arg, crate::c_types::Transaction::from_vec(local_tx))
        }
 }
 
@@ -175,67 +45,6 @@ impl Drop for BroadcasterInterface {
                }
        }
 }
-/// A trait indicating a desire to listen for events from the chain
-#[repr(C)]
-pub struct ChainListener {
-       pub this_arg: *mut c_void,
-       /// Notifies a listener that a block was connected.
-       ///
-       /// The txn_matched array should be set to references to transactions which matched the
-       /// relevant installed watch outpoints/txn, or the full set of transactions in the block.
-       ///
-       /// Note that if txn_matched includes only matched transactions, and a new
-       /// transaction/outpoint is watched during a block_connected call, the block *must* be
-       /// re-scanned with the new transaction/outpoints and block_connected should be called
-       /// again with the same header and (at least) the new transactions.
-       ///
-       /// Note that if non-new transaction/outpoints are be registered during a call, a second call
-       /// *must not* happen.
-       ///
-       /// This also means those counting confirmations using block_connected callbacks should watch
-       /// for duplicate headers and not count them towards confirmations!
-       pub block_connected: extern "C" fn (this_arg: *const c_void, header: *const [u8; 80], height: u32, txn_matched: crate::c_types::derived::CVec_TransactionZ, indexes_of_txn_matched: crate::c_types::usizeslice),
-       /// Notifies a listener that a block was disconnected.
-       /// Unlike block_connected, this *must* never be called twice for the same disconnect event.
-       /// Height must be the one of the block which was disconnected (not new height of the best chain)
-       pub block_disconnected: extern "C" fn (this_arg: *const c_void, header: *const [u8; 80], disconnected_height: u32),
-       pub free: Option<extern "C" fn(this_arg: *mut c_void)>,
-}
-unsafe impl Sync for ChainListener {}
-unsafe impl Send for ChainListener {}
-
-use lightning::chain::chaininterface::ChainListener as rustChainListener;
-impl rustChainListener for ChainListener {
-       fn block_connected(&self, header: &bitcoin::blockdata::block::BlockHeader, height: u32, txn_matched: &[&bitcoin::blockdata::transaction::Transaction], indexes_of_txn_matched: &[usize]) {
-               let mut local_header = { let mut s = [0u8; 80]; s[..].copy_from_slice(&::bitcoin::consensus::encode::serialize(header)); s };
-               let mut local_txn_matched = Vec::new(); for item in txn_matched.iter() { local_txn_matched.push( { let mut local_txn_matched_0 = ::bitcoin::consensus::encode::serialize(&**item); local_txn_matched_0.into() }); };
-               let mut local_indexes_of_txn_matched = crate::c_types::usizeslice::from_slice(indexes_of_txn_matched);
-               (self.block_connected)(self.this_arg, &local_header, height, local_txn_matched.into(), local_indexes_of_txn_matched)
-       }
-       fn block_disconnected(&self, header: &bitcoin::blockdata::block::BlockHeader, disconnected_height: u32) {
-               let mut local_header = { let mut s = [0u8; 80]; s[..].copy_from_slice(&::bitcoin::consensus::encode::serialize(header)); s };
-               (self.block_disconnected)(self.this_arg, &local_header, disconnected_height)
-       }
-}
-
-// 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 ChainListener {
-       type Target = Self;
-       fn deref(&self) -> &Self {
-               self
-       }
-}
-/// Calls the free function if one is set
-#[no_mangle]
-pub extern "C" fn ChainListener_free(this_ptr: ChainListener) { }
-impl Drop for ChainListener {
-       fn drop(&mut self) {
-               if let Some(f) = self.free {
-                       f(self.this_arg);
-               }
-       }
-}
 /// An enum that represents the speed at which we want a transaction to confirm used for feerate
 /// estimation.
 #[must_use]
@@ -288,8 +97,7 @@ impl ConfirmationTarget {
 /// horizons.
 ///
 /// Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
-/// called from inside the library in response to ChainListener events, P2P events, or timer
-/// events).
+/// called from inside the library in response to chain events, P2P events, or timer events).
 #[repr(C)]
 pub struct FeeEstimator {
        pub this_arg: *mut c_void,
@@ -337,270 +145,3 @@ impl Drop for FeeEstimator {
 
 #[no_mangle]
 pub static MIN_RELAY_FEE_SAT_PER_1000_WEIGHT: u64 = lightning::chain::chaininterface::MIN_RELAY_FEE_SAT_PER_1000_WEIGHT;
-
-use lightning::chain::chaininterface::ChainWatchedUtil as nativeChainWatchedUtilImport;
-type nativeChainWatchedUtil = nativeChainWatchedUtilImport;
-
-/// Utility for tracking registered txn/outpoints and checking for matches
-#[must_use]
-#[repr(C)]
-pub struct ChainWatchedUtil {
-       /// Nearly everyhwere, inner must be non-null, however in places where
-       /// the Rust equivalent takes an Option, it may be set to null to indicate None.
-       pub inner: *mut nativeChainWatchedUtil,
-       pub is_owned: bool,
-}
-
-impl Drop for ChainWatchedUtil {
-       fn drop(&mut self) {
-               if self.is_owned && !self.inner.is_null() {
-                       let _ = unsafe { Box::from_raw(self.inner) };
-               }
-       }
-}
-#[no_mangle]
-pub extern "C" fn ChainWatchedUtil_free(this_ptr: ChainWatchedUtil) { }
-#[allow(unused)]
-/// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn ChainWatchedUtil_free_void(this_ptr: *mut c_void) {
-       unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChainWatchedUtil); }
-}
-#[allow(unused)]
-/// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
-impl ChainWatchedUtil {
-       pub(crate) fn take_ptr(mut self) -> *mut nativeChainWatchedUtil {
-               assert!(self.is_owned);
-               let ret = self.inner;
-               self.inner = std::ptr::null_mut();
-               ret
-       }
-}
-/// Constructs an empty (watches nothing) ChainWatchedUtil
-#[must_use]
-#[no_mangle]
-pub extern "C" fn ChainWatchedUtil_new() -> ChainWatchedUtil {
-       let mut ret = lightning::chain::chaininterface::ChainWatchedUtil::new();
-       ChainWatchedUtil { inner: Box::into_raw(Box::new(ret)), is_owned: true }
-}
-
-/// Registers a tx for monitoring, returning true if it was a new tx and false if we'd already
-/// been watching for it.
-#[must_use]
-#[no_mangle]
-pub extern "C" fn ChainWatchedUtil_register_tx(this_arg: &mut ChainWatchedUtil, txid: *const [u8; 32], script_pub_key: crate::c_types::u8slice) -> bool {
-       let mut ret = unsafe { &mut (*(this_arg.inner as *mut nativeChainWatchedUtil)) }.register_tx(&::bitcoin::hash_types::Txid::from_slice(&unsafe { &*txid }[..]).unwrap(), &::bitcoin::blockdata::script::Script::from(Vec::from(script_pub_key.to_slice())));
-       ret
-}
-
-/// Registers an outpoint for monitoring, returning true if it was a new outpoint and false if
-/// we'd already been watching for it
-#[must_use]
-#[no_mangle]
-pub extern "C" fn ChainWatchedUtil_register_outpoint(this_arg: &mut ChainWatchedUtil, mut outpoint: crate::c_types::derived::C2Tuple_Txidu32Z, _script_pub_key: crate::c_types::u8slice) -> bool {
-       let (mut orig_outpoint_0, mut orig_outpoint_1) = outpoint.to_rust(); let mut local_outpoint = (::bitcoin::hash_types::Txid::from_slice(&orig_outpoint_0.data[..]).unwrap(), orig_outpoint_1);
-       let mut ret = unsafe { &mut (*(this_arg.inner as *mut nativeChainWatchedUtil)) }.register_outpoint(local_outpoint, &::bitcoin::blockdata::script::Script::from(Vec::from(_script_pub_key.to_slice())));
-       ret
-}
-
-/// Sets us to match all transactions, returning true if this is a new setting and false if
-/// we'd already been set to match everything.
-#[must_use]
-#[no_mangle]
-pub extern "C" fn ChainWatchedUtil_watch_all(this_arg: &mut ChainWatchedUtil) -> bool {
-       let mut ret = unsafe { &mut (*(this_arg.inner as *mut nativeChainWatchedUtil)) }.watch_all();
-       ret
-}
-
-/// Checks if a given transaction matches the current filter.
-#[must_use]
-#[no_mangle]
-pub extern "C" fn ChainWatchedUtil_does_match_tx(this_arg: &ChainWatchedUtil, tx: crate::c_types::Transaction) -> bool {
-       let mut ret = unsafe { &*this_arg.inner }.does_match_tx(&tx.into_bitcoin());
-       ret
-}
-
-
-use lightning::chain::chaininterface::BlockNotifier as nativeBlockNotifierImport;
-type nativeBlockNotifier = nativeBlockNotifierImport<'static, crate::chain::chaininterface::ChainListener, crate::chain::chaininterface::ChainWatchInterface>;
-
-/// Utility for notifying listeners about new blocks, and handling block rescans if new watch
-/// data is registered.
-///
-/// Rather than using a plain BlockNotifier, it is preferable to use either a BlockNotifierArc
-/// or a BlockNotifierRef for conciseness. See their documentation for more details, but essentially
-/// you should default to using a BlockNotifierRef, and use a BlockNotifierArc instead when you
-/// require ChainListeners with static lifetimes, such as when you're using lightning-net-tokio.
-#[must_use]
-#[repr(C)]
-pub struct BlockNotifier {
-       /// Nearly everyhwere, inner must be non-null, however in places where
-       /// the Rust equivalent takes an Option, it may be set to null to indicate None.
-       pub inner: *mut nativeBlockNotifier,
-       pub is_owned: bool,
-}
-
-impl Drop for BlockNotifier {
-       fn drop(&mut self) {
-               if self.is_owned && !self.inner.is_null() {
-                       let _ = unsafe { Box::from_raw(self.inner) };
-               }
-       }
-}
-#[no_mangle]
-pub extern "C" fn BlockNotifier_free(this_ptr: BlockNotifier) { }
-#[allow(unused)]
-/// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn BlockNotifier_free_void(this_ptr: *mut c_void) {
-       unsafe { let _ = Box::from_raw(this_ptr as *mut nativeBlockNotifier); }
-}
-#[allow(unused)]
-/// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
-impl BlockNotifier {
-       pub(crate) fn take_ptr(mut self) -> *mut nativeBlockNotifier {
-               assert!(self.is_owned);
-               let ret = self.inner;
-               self.inner = std::ptr::null_mut();
-               ret
-       }
-}
-/// Constructs a new BlockNotifier without any listeners.
-#[must_use]
-#[no_mangle]
-pub extern "C" fn BlockNotifier_new(mut chain_monitor: crate::chain::chaininterface::ChainWatchInterface) -> crate::chain::chaininterface::BlockNotifier {
-       let mut ret = lightning::chain::chaininterface::BlockNotifier::new(chain_monitor);
-       crate::chain::chaininterface::BlockNotifier { inner: Box::into_raw(Box::new(ret)), is_owned: true }
-}
-
-/// Register the given listener to receive events.
-#[no_mangle]
-pub extern "C" fn BlockNotifier_register_listener(this_arg: &BlockNotifier, mut listener: crate::chain::chaininterface::ChainListener) {
-       unsafe { &*this_arg.inner }.register_listener(listener)
-}
-
-/// Notify listeners that a block was connected given a full, unfiltered block.
-///
-/// Handles re-scanning the block and calling block_connected again if listeners register new
-/// watch data during the callbacks for you (see ChainListener::block_connected for more info).
-#[no_mangle]
-pub extern "C" fn BlockNotifier_block_connected(this_arg: &BlockNotifier, block: crate::c_types::u8slice, mut height: u32) {
-       unsafe { &*this_arg.inner }.block_connected(&::bitcoin::consensus::encode::deserialize(block.to_slice()).unwrap(), height)
-}
-
-/// Notify listeners that a block was connected, given pre-filtered list of transactions in the
-/// block which matched the filter (probably using does_match_tx).
-///
-/// Returns true if notified listeners registered additional watch data (implying that the
-/// block must be re-scanned and this function called again prior to further block_connected
-/// calls, see ChainListener::block_connected for more info).
-#[must_use]
-#[no_mangle]
-pub extern "C" fn BlockNotifier_block_connected_checked(this_arg: &BlockNotifier, header: *const [u8; 80], mut height: u32, mut txn_matched: crate::c_types::derived::CVec_TransactionZ, mut indexes_of_txn_matched: crate::c_types::usizeslice) -> bool {
-       let mut local_txn_matched = Vec::new(); for mut item in txn_matched.into_rust().drain(..) { local_txn_matched.push( { ::bitcoin::consensus::encode::deserialize(&item.into_rust()[..]).unwrap() }); };
-       let mut ret = unsafe { &*this_arg.inner }.block_connected_checked(&::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), height, &local_txn_matched.iter().collect::<Vec<_>>()[..], indexes_of_txn_matched.to_slice());
-       ret
-}
-
-/// Notify listeners that a block was disconnected.
-#[no_mangle]
-pub extern "C" fn BlockNotifier_block_disconnected(this_arg: &BlockNotifier, header: *const [u8; 80], mut disconnected_height: u32) {
-       unsafe { &*this_arg.inner }.block_disconnected(&::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), disconnected_height)
-}
-
-
-use lightning::chain::chaininterface::ChainWatchInterfaceUtil as nativeChainWatchInterfaceUtilImport;
-type nativeChainWatchInterfaceUtil = nativeChainWatchInterfaceUtilImport;
-
-/// Utility to capture some common parts of ChainWatchInterface implementors.
-///
-/// Keeping a local copy of this in a ChainWatchInterface implementor is likely useful.
-#[must_use]
-#[repr(C)]
-pub struct ChainWatchInterfaceUtil {
-       /// Nearly everyhwere, inner must be non-null, however in places where
-       /// the Rust equivalent takes an Option, it may be set to null to indicate None.
-       pub inner: *mut nativeChainWatchInterfaceUtil,
-       pub is_owned: bool,
-}
-
-impl Drop for ChainWatchInterfaceUtil {
-       fn drop(&mut self) {
-               if self.is_owned && !self.inner.is_null() {
-                       let _ = unsafe { Box::from_raw(self.inner) };
-               }
-       }
-}
-#[no_mangle]
-pub extern "C" fn ChainWatchInterfaceUtil_free(this_ptr: ChainWatchInterfaceUtil) { }
-#[allow(unused)]
-/// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn ChainWatchInterfaceUtil_free_void(this_ptr: *mut c_void) {
-       unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChainWatchInterfaceUtil); }
-}
-#[allow(unused)]
-/// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
-impl ChainWatchInterfaceUtil {
-       pub(crate) fn take_ptr(mut self) -> *mut nativeChainWatchInterfaceUtil {
-               assert!(self.is_owned);
-               let ret = self.inner;
-               self.inner = std::ptr::null_mut();
-               ret
-       }
-}
-#[no_mangle]
-pub extern "C" fn ChainWatchInterfaceUtil_as_ChainWatchInterface(this_arg: *const ChainWatchInterfaceUtil) -> crate::chain::chaininterface::ChainWatchInterface {
-       crate::chain::chaininterface::ChainWatchInterface {
-               this_arg: unsafe { (*this_arg).inner as *mut c_void },
-               free: None,
-               install_watch_tx: ChainWatchInterfaceUtil_ChainWatchInterface_install_watch_tx,
-               install_watch_outpoint: ChainWatchInterfaceUtil_ChainWatchInterface_install_watch_outpoint,
-               watch_all_txn: ChainWatchInterfaceUtil_ChainWatchInterface_watch_all_txn,
-               get_chain_utxo: ChainWatchInterfaceUtil_ChainWatchInterface_get_chain_utxo,
-               filter_block: ChainWatchInterfaceUtil_ChainWatchInterface_filter_block,
-               reentered: ChainWatchInterfaceUtil_ChainWatchInterface_reentered,
-       }
-}
-use lightning::chain::chaininterface::ChainWatchInterface as ChainWatchInterfaceTraitImport;
-extern "C" fn ChainWatchInterfaceUtil_ChainWatchInterface_install_watch_tx(this_arg: *const c_void, txid: *const [u8; 32], script_pub_key: crate::c_types::u8slice) {
-       unsafe { &mut *(this_arg as *mut nativeChainWatchInterfaceUtil) }.install_watch_tx(&::bitcoin::hash_types::Txid::from_slice(&unsafe { &*txid }[..]).unwrap(), &::bitcoin::blockdata::script::Script::from(Vec::from(script_pub_key.to_slice())))
-}
-extern "C" fn ChainWatchInterfaceUtil_ChainWatchInterface_install_watch_outpoint(this_arg: *const c_void, mut outpoint: crate::c_types::derived::C2Tuple_Txidu32Z, out_script: crate::c_types::u8slice) {
-       let (mut orig_outpoint_0, mut orig_outpoint_1) = outpoint.to_rust(); let mut local_outpoint = (::bitcoin::hash_types::Txid::from_slice(&orig_outpoint_0.data[..]).unwrap(), orig_outpoint_1);
-       unsafe { &mut *(this_arg as *mut nativeChainWatchInterfaceUtil) }.install_watch_outpoint(local_outpoint, &::bitcoin::blockdata::script::Script::from(Vec::from(out_script.to_slice())))
-}
-extern "C" fn ChainWatchInterfaceUtil_ChainWatchInterface_watch_all_txn(this_arg: *const c_void) {
-       unsafe { &mut *(this_arg as *mut nativeChainWatchInterfaceUtil) }.watch_all_txn()
-}
-#[must_use]
-extern "C" fn ChainWatchInterfaceUtil_ChainWatchInterface_get_chain_utxo(this_arg: *const c_void, mut genesis_hash: crate::c_types::ThirtyTwoBytes, mut _unspent_tx_output_identifier: u64) -> crate::c_types::derived::CResult_C2Tuple_Scriptu64ZChainErrorZ {
-       let mut ret = unsafe { &mut *(this_arg as *mut nativeChainWatchInterfaceUtil) }.get_chain_utxo(::bitcoin::hash_types::BlockHash::from_slice(&genesis_hash.data[..]).unwrap(), _unspent_tx_output_identifier);
-       let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { let (mut orig_ret_0_0, mut orig_ret_0_1) = o; let mut local_ret_0 = (orig_ret_0_0.into_bytes().into(), orig_ret_0_1).into(); local_ret_0 }), Err(mut e) => crate::c_types::CResultTempl::err( { crate::chain::chaininterface::ChainError::native_into(e) }) };
-       local_ret
-}
-#[must_use]
-extern "C" fn ChainWatchInterfaceUtil_ChainWatchInterface_filter_block(this_arg: *const c_void, block: crate::c_types::u8slice) -> crate::c_types::derived::CVec_usizeZ {
-       let mut ret = unsafe { &mut *(this_arg as *mut nativeChainWatchInterfaceUtil) }.filter_block(&::bitcoin::consensus::encode::deserialize(block.to_slice()).unwrap());
-       let mut local_ret = Vec::new(); for item in ret.drain(..) { local_ret.push( { item }); };
-       local_ret.into()
-}
-#[must_use]
-extern "C" fn ChainWatchInterfaceUtil_ChainWatchInterface_reentered(this_arg: *const c_void) -> usize {
-       let mut ret = unsafe { &mut *(this_arg as *mut nativeChainWatchInterfaceUtil) }.reentered();
-       ret
-}
-
-/// Creates a new ChainWatchInterfaceUtil for the given network
-#[must_use]
-#[no_mangle]
-pub extern "C" fn ChainWatchInterfaceUtil_new(mut network: crate::bitcoin::network::Network) -> crate::chain::chaininterface::ChainWatchInterfaceUtil {
-       let mut ret = lightning::chain::chaininterface::ChainWatchInterfaceUtil::new(network.into_bitcoin());
-       crate::chain::chaininterface::ChainWatchInterfaceUtil { inner: Box::into_raw(Box::new(ret)), is_owned: true }
-}
-
-/// Checks if a given transaction matches the current filter.
-#[must_use]
-#[no_mangle]
-pub extern "C" fn ChainWatchInterfaceUtil_does_match_tx(this_arg: &ChainWatchInterfaceUtil, tx: crate::c_types::Transaction) -> bool {
-       let mut ret = unsafe { &*this_arg.inner }.does_match_tx(&tx.into_bitcoin());
-       ret
-}
-
diff --git a/lightning-c-bindings/src/chain/chainmonitor.rs b/lightning-c-bindings/src/chain/chainmonitor.rs
new file mode 100644 (file)
index 0000000..5e3db6d
--- /dev/null
@@ -0,0 +1,165 @@
+//! Logic to connect off-chain channel management with on-chain transaction monitoring.
+//!
+//! [`ChainMonitor`] is an implementation of [`chain::Watch`] used both to process blocks and to
+//! update [`ChannelMonitor`]s accordingly. If any on-chain events need further processing, it will
+//! make those available as [`MonitorEvent`]s to be consumed.
+//!
+//! `ChainMonitor` is parameterized by an optional chain source, which must implement the
+//! [`chain::Filter`] trait. This provides a mechanism to signal new relevant outputs back to light
+//! clients, such that transactions spending those outputs are included in block data.
+//!
+//! `ChainMonitor` may be used directly to monitor channels locally or as a part of a distributed
+//! setup to monitor channels remotely. In the latter case, a custom `chain::Watch` implementation
+//! would be responsible for routing each update to a remote server and for retrieving monitor
+//! events. The remote server would make use of `ChainMonitor` for block processing and for
+//! servicing `ChannelMonitor` updates from the client.
+//!
+//! [`ChainMonitor`]: struct.ChainMonitor.html
+//! [`chain::Filter`]: ../trait.Filter.html
+//! [`chain::Watch`]: ../trait.Watch.html
+//! [`ChannelMonitor`]: ../channelmonitor/struct.ChannelMonitor.html
+//! [`MonitorEvent`]: ../channelmonitor/enum.MonitorEvent.html
+
+use std::ffi::c_void;
+use bitcoin::hashes::Hash;
+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>;
+
+/// An implementation of [`chain::Watch`] for monitoring channels.
+///
+/// Connected and disconnected blocks must be provided to `ChainMonitor` as documented by
+/// [`chain::Watch`]. May be used in conjunction with [`ChannelManager`] to monitor channels locally
+/// or used independently to monitor channels remotely. See the [module-level documentation] for
+/// details.
+///
+/// [`chain::Watch`]: ../trait.Watch.html
+/// [`ChannelManager`]: ../../ln/channelmanager/struct.ChannelManager.html
+/// [module-level documentation]: index.html
+#[must_use]
+#[repr(C)]
+pub struct ChainMonitor {
+       /// Nearly everyhwere, inner must be non-null, however in places where
+       /// the Rust equivalent takes an Option, it may be set to null to indicate None.
+       pub inner: *mut nativeChainMonitor,
+       pub is_owned: bool,
+}
+
+impl Drop for ChainMonitor {
+       fn drop(&mut self) {
+               if self.is_owned && !self.inner.is_null() {
+                       let _ = unsafe { Box::from_raw(self.inner) };
+               }
+       }
+}
+#[no_mangle]
+pub extern "C" fn ChainMonitor_free(this_ptr: ChainMonitor) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+extern "C" fn ChainMonitor_free_void(this_ptr: *mut c_void) {
+       unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChainMonitor); }
+}
+#[allow(unused)]
+/// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
+impl ChainMonitor {
+       pub(crate) fn take_ptr(mut self) -> *mut nativeChainMonitor {
+               assert!(self.is_owned);
+               let ret = self.inner;
+               self.inner = std::ptr::null_mut();
+               ret
+       }
+}
+/// Dispatches to per-channel monitors, which are responsible for updating their on-chain view
+/// of a channel and reacting accordingly based on transactions in the connected block. See
+/// [`ChannelMonitor::block_connected`] for details. Any HTLCs that were resolved on chain will
+/// be returned by [`chain::Watch::release_pending_monitor_events`].
+///
+/// Calls back to [`chain::Filter`] if any monitor indicated new outputs to watch. Subsequent
+/// calls must not exclude any transactions matching the new outputs nor any in-block
+/// descendants of such transactions. It is not necessary to re-fetch the block to obtain
+/// updated `txdata`.
+///
+/// [`ChannelMonitor::block_connected`]: ../channelmonitor/struct.ChannelMonitor.html#method.block_connected
+/// [`chain::Watch::release_pending_monitor_events`]: ../trait.Watch.html#tymethod.release_pending_monitor_events
+/// [`chain::Filter`]: ../trait.Filter.html
+#[no_mangle]
+pub extern "C" fn ChainMonitor_block_connected(this_arg: &ChainMonitor, header: *const [u8; 80], mut txdata: crate::c_types::derived::CVec_C2Tuple_usizeTransactionZZ, mut height: u32) {
+       let mut local_txdata = Vec::new(); for mut item in txdata.into_rust().drain(..) { local_txdata.push( { let (mut orig_txdata_0_0, mut orig_txdata_0_1) = item.to_rust(); let mut local_txdata_0 = (orig_txdata_0_0, orig_txdata_0_1.into_bitcoin()); local_txdata_0 }); };
+       unsafe { &*this_arg.inner }.block_connected(&::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), &local_txdata.iter().map(|(a, b)| (*a, b)).collect::<Vec<_>>()[..], height)
+}
+
+/// Dispatches to per-channel monitors, which are responsible for updating their on-chain view
+/// of a channel based on the disconnected block. See [`ChannelMonitor::block_disconnected`] for
+/// details.
+///
+/// [`ChannelMonitor::block_disconnected`]: ../channelmonitor/struct.ChannelMonitor.html#method.block_disconnected
+#[no_mangle]
+pub extern "C" fn ChainMonitor_block_disconnected(this_arg: &ChainMonitor, header: *const [u8; 80], mut disconnected_height: u32) {
+       unsafe { &*this_arg.inner }.block_disconnected(&::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), disconnected_height)
+}
+
+/// Creates a new `ChainMonitor` used to watch on-chain activity pertaining to channels.
+///
+/// When an optional chain source implementing [`chain::Filter`] is provided, the chain monitor
+/// will call back to it indicating transactions and outputs of interest. This allows clients to
+/// pre-filter blocks or only fetch blocks matching a compact filter. Otherwise, clients may
+/// always need to fetch full blocks absent another means for determining which blocks contain
+/// transactions relevant to the watched channels.
+///
+/// [`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 {
+       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);
+       ChainMonitor { inner: Box::into_raw(Box::new(ret)), is_owned: true }
+}
+
+#[no_mangle]
+pub extern "C" fn ChainMonitor_as_Watch(this_arg: *const ChainMonitor) -> crate::chain::Watch {
+       crate::chain::Watch {
+               this_arg: unsafe { (*this_arg).inner as *mut c_void },
+               free: None,
+               watch_channel: ChainMonitor_Watch_watch_channel,
+               update_channel: ChainMonitor_Watch_update_channel,
+               release_pending_monitor_events: ChainMonitor_Watch_release_pending_monitor_events,
+       }
+}
+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()) });
+       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
+}
+#[must_use]
+extern "C" fn ChainMonitor_Watch_update_channel(this_arg: *const c_void, mut funding_txo: crate::chain::transaction::OutPoint, mut update: crate::chain::channelmonitor::ChannelMonitorUpdate) -> crate::c_types::derived::CResult_NoneChannelMonitorUpdateErrZ {
+       let mut ret = unsafe { &mut *(this_arg as *mut nativeChainMonitor) }.update_channel(*unsafe { Box::from_raw(funding_txo.take_ptr()) }, *unsafe { Box::from_raw(update.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
+}
+#[must_use]
+extern "C" fn ChainMonitor_Watch_release_pending_monitor_events(this_arg: *const c_void) -> crate::c_types::derived::CVec_MonitorEventZ {
+       let mut ret = unsafe { &mut *(this_arg as *mut nativeChainMonitor) }.release_pending_monitor_events();
+       let mut local_ret = Vec::new(); for item in ret.drain(..) { local_ret.push( { crate::chain::channelmonitor::MonitorEvent { inner: Box::into_raw(Box::new(item)), is_owned: true } }); };
+       local_ret.into()
+}
+
+#[no_mangle]
+pub extern "C" fn ChainMonitor_as_EventsProvider(this_arg: *const ChainMonitor) -> crate::util::events::EventsProvider {
+       crate::util::events::EventsProvider {
+               this_arg: unsafe { (*this_arg).inner as *mut c_void },
+               free: None,
+               get_and_clear_pending_events: ChainMonitor_EventsProvider_get_and_clear_pending_events,
+       }
+}
+use lightning::util::events::EventsProvider as EventsProviderTraitImport;
+#[must_use]
+extern "C" fn ChainMonitor_EventsProvider_get_and_clear_pending_events(this_arg: *const c_void) -> crate::c_types::derived::CVec_EventZ {
+       let mut ret = unsafe { &mut *(this_arg as *mut nativeChainMonitor) }.get_and_clear_pending_events();
+       let mut local_ret = Vec::new(); for item in ret.drain(..) { local_ret.push( { crate::util::events::Event::native_into(item) }); };
+       local_ret.into()
+}
+
diff --git a/lightning-c-bindings/src/chain/channelmonitor.rs b/lightning-c-bindings/src/chain/channelmonitor.rs
new file mode 100644 (file)
index 0000000..270afe3
--- /dev/null
@@ -0,0 +1,493 @@
+//! The logic to monitor for on-chain transactions and create the relevant claim responses lives
+//! here.
+//!
+//! ChannelMonitor objects are generated by ChannelManager in response to relevant
+//! messages/actions, and MUST be persisted to disk (and, preferably, remotely) before progress can
+//! be made in responding to certain messages, see [`chain::Watch`] for more.
+//!
+//! Note that ChannelMonitors are an important part of the lightning trust model and a copy of the
+//! latest ChannelMonitor must always be actively monitoring for chain updates (and no out-of-date
+//! ChannelMonitors should do so). Thus, if you're building rust-lightning into an HSM or other
+//! security-domain-separated system design, you should consider having multiple paths for
+//! ChannelMonitors to get out of the HSM and onto monitoring devices.
+//!
+//! [`chain::Watch`]: ../trait.Watch.html
+
+use std::ffi::c_void;
+use bitcoin::hashes::Hash;
+use crate::c_types::*;
+
+
+use lightning::chain::channelmonitor::ChannelMonitorUpdate as nativeChannelMonitorUpdateImport;
+type nativeChannelMonitorUpdate = nativeChannelMonitorUpdateImport;
+
+/// An update generated by the underlying Channel itself which contains some new information the
+/// ChannelMonitor should be made aware of.
+#[must_use]
+#[repr(C)]
+pub struct ChannelMonitorUpdate {
+       /// Nearly everyhwere, inner must be non-null, however in places where
+       /// the Rust equivalent takes an Option, it may be set to null to indicate None.
+       pub inner: *mut nativeChannelMonitorUpdate,
+       pub is_owned: bool,
+}
+
+impl Drop for ChannelMonitorUpdate {
+       fn drop(&mut self) {
+               if self.is_owned && !self.inner.is_null() {
+                       let _ = unsafe { Box::from_raw(self.inner) };
+               }
+       }
+}
+#[no_mangle]
+pub extern "C" fn ChannelMonitorUpdate_free(this_ptr: ChannelMonitorUpdate) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+extern "C" fn ChannelMonitorUpdate_free_void(this_ptr: *mut c_void) {
+       unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelMonitorUpdate); }
+}
+#[allow(unused)]
+/// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
+impl ChannelMonitorUpdate {
+       pub(crate) fn take_ptr(mut self) -> *mut nativeChannelMonitorUpdate {
+               assert!(self.is_owned);
+               let ret = self.inner;
+               self.inner = std::ptr::null_mut();
+               ret
+       }
+}
+impl Clone for ChannelMonitorUpdate {
+       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 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
+}
+/// 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.
+///
+/// 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.
+#[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;
+       (*inner_val)
+}
+/// 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.
+///
+/// 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.
+#[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 extern "C" fn ChannelMonitorUpdate_write(obj: *const ChannelMonitorUpdate) -> crate::c_types::derived::CVec_u8Z {
+       crate::c_types::serialize_obj(unsafe { &(*(*obj).inner) })
+}
+#[no_mangle]
+pub extern "C" fn ChannelMonitorUpdate_read(ser: crate::c_types::u8slice) -> ChannelMonitorUpdate {
+       if let Ok(res) = crate::c_types::deserialize_obj(ser) {
+               ChannelMonitorUpdate { inner: Box::into_raw(Box::new(res)), is_owned: true }
+       } else {
+               ChannelMonitorUpdate { inner: std::ptr::null_mut(), is_owned: true }
+       }
+}
+/// An error enum representing a failure to persist a channel monitor update.
+#[must_use]
+#[derive(Clone)]
+#[repr(C)]
+pub enum ChannelMonitorUpdateErr {
+       /// Used to indicate a temporary failure (eg connection to a watchtower or remote backup of
+       /// our state failed, but is expected to succeed at some point in the future).
+       ///
+       /// Such a failure will \"freeze\" a channel, preventing us from revoking old states or
+       /// submitting new commitment transactions to the counterparty. Once the update(s) which failed
+       /// have been successfully applied, ChannelManager::channel_monitor_updated can be used to
+       /// restore the channel to an operational state.
+       ///
+       /// Note that a given ChannelManager will *never* re-generate a given ChannelMonitorUpdate. If
+       /// you return a TemporaryFailure you must ensure that it is written to disk safely before
+       /// writing out the latest ChannelManager state.
+       ///
+       /// Even when a channel has been \"frozen\" updates to the ChannelMonitor can continue to occur
+       /// (eg if an inbound HTLC which we forwarded was claimed upstream resulting in us attempting
+       /// to claim it on this channel) and those updates must be applied wherever they can be. At
+       /// least one such updated ChannelMonitor must be persisted otherwise PermanentFailure should
+       /// be returned to get things on-chain ASAP using only the in-memory copy. Obviously updates to
+       /// the channel which would invalidate previous ChannelMonitors are not made when a channel has
+       /// been \"frozen\".
+       ///
+       /// Note that even if updates made after TemporaryFailure succeed you must still call
+       /// channel_monitor_updated to ensure you have the latest monitor and re-enable normal channel
+       /// operation.
+       ///
+       /// Note that the update being processed here will not be replayed for you when you call
+       /// ChannelManager::channel_monitor_updated, so you must store the update itself along
+       /// with the persisted ChannelMonitor on your own local disk prior to returning a
+       /// TemporaryFailure. You may, of course, employ a journaling approach, storing only the
+       /// ChannelMonitorUpdate on disk without updating the monitor itself, replaying the journal at
+       /// reload-time.
+       ///
+       /// For deployments where a copy of ChannelMonitors and other local state are backed up in a
+       /// remote location (with local copies persisted immediately), it is anticipated that all
+       /// updates will return TemporaryFailure until the remote copies could be updated.
+       TemporaryFailure,
+       /// Used to indicate no further channel monitor updates will be allowed (eg we've moved on to a
+       /// different watchtower and cannot update with all watchtowers that were previously informed
+       /// of this channel).
+       ///
+       /// At reception of this error, ChannelManager will force-close the channel and return at
+       /// least a final ChannelMonitorUpdate::ChannelForceClosed which must be delivered to at
+       /// least one ChannelMonitor copy. Revocation secret MUST NOT be released and offchain channel
+       /// update must be rejected.
+       ///
+       /// This failure may also signal a failure to update the local persisted copy of one of
+       /// the channel monitor instance.
+       ///
+       /// Note that even when you fail a holder commitment transaction update, you must store the
+       /// update to ensure you can claim from it in case of a duplicate copy of this ChannelMonitor
+       /// broadcasts it (e.g distributed channel-monitor deployment)
+       ///
+       /// In case of distributed watchtowers deployment, the new version must be written to disk, as
+       /// state may have been stored but rejected due to a block forcing a commitment broadcast. This
+       /// storage is used to claim outputs of rejected state confirmed onchain by another watchtower,
+       /// lagging behind on block processing.
+       PermanentFailure,
+}
+use lightning::chain::channelmonitor::ChannelMonitorUpdateErr as nativeChannelMonitorUpdateErr;
+impl ChannelMonitorUpdateErr {
+       #[allow(unused)]
+       pub(crate) fn to_native(&self) -> nativeChannelMonitorUpdateErr {
+               match self {
+                       ChannelMonitorUpdateErr::TemporaryFailure => nativeChannelMonitorUpdateErr::TemporaryFailure,
+                       ChannelMonitorUpdateErr::PermanentFailure => nativeChannelMonitorUpdateErr::PermanentFailure,
+               }
+       }
+       #[allow(unused)]
+       pub(crate) fn into_native(self) -> nativeChannelMonitorUpdateErr {
+               match self {
+                       ChannelMonitorUpdateErr::TemporaryFailure => nativeChannelMonitorUpdateErr::TemporaryFailure,
+                       ChannelMonitorUpdateErr::PermanentFailure => nativeChannelMonitorUpdateErr::PermanentFailure,
+               }
+       }
+       #[allow(unused)]
+       pub(crate) fn from_native(native: &nativeChannelMonitorUpdateErr) -> Self {
+               match native {
+                       nativeChannelMonitorUpdateErr::TemporaryFailure => ChannelMonitorUpdateErr::TemporaryFailure,
+                       nativeChannelMonitorUpdateErr::PermanentFailure => ChannelMonitorUpdateErr::PermanentFailure,
+               }
+       }
+       #[allow(unused)]
+       pub(crate) fn native_into(native: nativeChannelMonitorUpdateErr) -> Self {
+               match native {
+                       nativeChannelMonitorUpdateErr::TemporaryFailure => ChannelMonitorUpdateErr::TemporaryFailure,
+                       nativeChannelMonitorUpdateErr::PermanentFailure => ChannelMonitorUpdateErr::PermanentFailure,
+               }
+       }
+}
+
+use lightning::chain::channelmonitor::MonitorUpdateError as nativeMonitorUpdateErrorImport;
+type nativeMonitorUpdateError = nativeMonitorUpdateErrorImport;
+
+/// General Err type for ChannelMonitor actions. Generally, this implies that the data provided is
+/// inconsistent with the ChannelMonitor being called. eg for ChannelMonitor::update_monitor this
+/// means you tried to update a monitor for a different channel or the ChannelMonitorUpdate was
+/// corrupted.
+/// Contains a human-readable error message.
+#[must_use]
+#[repr(C)]
+pub struct MonitorUpdateError {
+       /// Nearly everyhwere, inner must be non-null, however in places where
+       /// the Rust equivalent takes an Option, it may be set to null to indicate None.
+       pub inner: *mut nativeMonitorUpdateError,
+       pub is_owned: bool,
+}
+
+impl Drop for MonitorUpdateError {
+       fn drop(&mut self) {
+               if self.is_owned && !self.inner.is_null() {
+                       let _ = unsafe { Box::from_raw(self.inner) };
+               }
+       }
+}
+#[no_mangle]
+pub extern "C" fn MonitorUpdateError_free(this_ptr: MonitorUpdateError) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+extern "C" fn MonitorUpdateError_free_void(this_ptr: *mut c_void) {
+       unsafe { let _ = Box::from_raw(this_ptr as *mut nativeMonitorUpdateError); }
+}
+#[allow(unused)]
+/// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
+impl MonitorUpdateError {
+       pub(crate) fn take_ptr(mut self) -> *mut nativeMonitorUpdateError {
+               assert!(self.is_owned);
+               let ret = self.inner;
+               self.inner = std::ptr::null_mut();
+               ret
+       }
+}
+
+use lightning::chain::channelmonitor::MonitorEvent as nativeMonitorEventImport;
+type nativeMonitorEvent = nativeMonitorEventImport;
+
+/// An event to be processed by the ChannelManager.
+#[must_use]
+#[repr(C)]
+pub struct MonitorEvent {
+       /// Nearly everyhwere, inner must be non-null, however in places where
+       /// the Rust equivalent takes an Option, it may be set to null to indicate None.
+       pub inner: *mut nativeMonitorEvent,
+       pub is_owned: bool,
+}
+
+impl Drop for MonitorEvent {
+       fn drop(&mut self) {
+               if self.is_owned && !self.inner.is_null() {
+                       let _ = unsafe { Box::from_raw(self.inner) };
+               }
+       }
+}
+#[no_mangle]
+pub extern "C" fn MonitorEvent_free(this_ptr: MonitorEvent) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+extern "C" fn MonitorEvent_free_void(this_ptr: *mut c_void) {
+       unsafe { let _ = Box::from_raw(this_ptr as *mut nativeMonitorEvent); }
+}
+#[allow(unused)]
+/// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
+impl MonitorEvent {
+       pub(crate) fn take_ptr(mut self) -> *mut nativeMonitorEvent {
+               assert!(self.is_owned);
+               let ret = self.inner;
+               self.inner = std::ptr::null_mut();
+               ret
+       }
+}
+
+use lightning::chain::channelmonitor::HTLCUpdate as nativeHTLCUpdateImport;
+type nativeHTLCUpdate = nativeHTLCUpdateImport;
+
+/// Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on
+/// chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the
+/// preimage claim backward will lead to loss of funds.
+///
+/// [`chain::Watch`]: ../trait.Watch.html
+#[must_use]
+#[repr(C)]
+pub struct HTLCUpdate {
+       /// Nearly everyhwere, inner must be non-null, however in places where
+       /// the Rust equivalent takes an Option, it may be set to null to indicate None.
+       pub inner: *mut nativeHTLCUpdate,
+       pub is_owned: bool,
+}
+
+impl Drop for HTLCUpdate {
+       fn drop(&mut self) {
+               if self.is_owned && !self.inner.is_null() {
+                       let _ = unsafe { Box::from_raw(self.inner) };
+               }
+       }
+}
+#[no_mangle]
+pub extern "C" fn HTLCUpdate_free(this_ptr: HTLCUpdate) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+extern "C" fn HTLCUpdate_free_void(this_ptr: *mut c_void) {
+       unsafe { let _ = Box::from_raw(this_ptr as *mut nativeHTLCUpdate); }
+}
+#[allow(unused)]
+/// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
+impl HTLCUpdate {
+       pub(crate) fn take_ptr(mut self) -> *mut nativeHTLCUpdate {
+               assert!(self.is_owned);
+               let ret = self.inner;
+               self.inner = std::ptr::null_mut();
+               ret
+       }
+}
+impl Clone for HTLCUpdate {
+       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 HTLCUpdate_clone_void(this_ptr: *const c_void) -> *mut c_void {
+       Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeHTLCUpdate)).clone() })) as *mut c_void
+}
+#[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) })
+}
+#[no_mangle]
+pub extern "C" fn HTLCUpdate_read(ser: crate::c_types::u8slice) -> HTLCUpdate {
+       if let Ok(res) = crate::c_types::deserialize_obj(ser) {
+               HTLCUpdate { inner: Box::into_raw(Box::new(res)), is_owned: true }
+       } else {
+               HTLCUpdate { inner: std::ptr::null_mut(), is_owned: true }
+       }
+}
+
+use lightning::chain::channelmonitor::ChannelMonitor as nativeChannelMonitorImport;
+type nativeChannelMonitor = nativeChannelMonitorImport<crate::chain::keysinterface::ChannelKeys>;
+
+/// A ChannelMonitor handles chain events (blocks connected and disconnected) and generates
+/// on-chain transactions to ensure no loss of funds occurs.
+///
+/// You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date
+/// information and are actively monitoring the chain.
+///
+/// Pending Events or updated HTLCs which have not yet been read out by
+/// get_and_clear_pending_monitor_events or get_and_clear_pending_events are serialized to disk and
+/// reloaded at deserialize-time. Thus, you must ensure that, when handling events, all events
+/// gotten are fully handled before re-serializing the new state.
+#[must_use]
+#[repr(C)]
+pub struct ChannelMonitor {
+       /// Nearly everyhwere, inner must be non-null, however in places where
+       /// the Rust equivalent takes an Option, it may be set to null to indicate None.
+       pub inner: *mut nativeChannelMonitor,
+       pub is_owned: bool,
+}
+
+impl Drop for ChannelMonitor {
+       fn drop(&mut self) {
+               if self.is_owned && !self.inner.is_null() {
+                       let _ = unsafe { Box::from_raw(self.inner) };
+               }
+       }
+}
+#[no_mangle]
+pub extern "C" fn ChannelMonitor_free(this_ptr: ChannelMonitor) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+extern "C" fn ChannelMonitor_free_void(this_ptr: *mut c_void) {
+       unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelMonitor); }
+}
+#[allow(unused)]
+/// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
+impl ChannelMonitor {
+       pub(crate) fn take_ptr(mut self) -> *mut nativeChannelMonitor {
+               assert!(self.is_owned);
+               let ret = self.inner;
+               self.inner = std::ptr::null_mut();
+               ret
+       }
+}
+/// Updates a ChannelMonitor on the basis of some new information provided by the Channel
+/// itself.
+///
+/// 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);
+       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
+}
+
+/// Gets the update_id from the latest ChannelMonitorUpdate which was applied to this
+/// ChannelMonitor.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn ChannelMonitor_get_latest_update_id(this_arg: &ChannelMonitor) -> u64 {
+       let mut ret = unsafe { &*this_arg.inner }.get_latest_update_id();
+       ret
+}
+
+/// Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn ChannelMonitor_get_funding_txo(this_arg: &ChannelMonitor) -> crate::c_types::derived::C2Tuple_OutPointScriptZ {
+       let mut ret = unsafe { &*this_arg.inner }.get_funding_txo();
+       let (ref orig_ret_0, ref orig_ret_1) = ret; let mut local_ret = (crate::chain::transaction::OutPoint { inner: unsafe { ( (&(*orig_ret_0) as *const _) as *mut _) }, is_owned: false }, orig_ret_1.clone().into_bytes().into()).into();
+       local_ret
+}
+
+/// Get the list of HTLCs who's status has been updated on chain. This should be called by
+/// ChannelManager via [`chain::Watch::release_pending_monitor_events`].
+///
+/// [`chain::Watch::release_pending_monitor_events`]: ../trait.Watch.html#tymethod.release_pending_monitor_events
+#[must_use]
+#[no_mangle]
+pub extern "C" fn ChannelMonitor_get_and_clear_pending_monitor_events(this_arg: &mut ChannelMonitor) -> crate::c_types::derived::CVec_MonitorEventZ {
+       let mut ret = unsafe { &mut (*(this_arg.inner as *mut nativeChannelMonitor)) }.get_and_clear_pending_monitor_events();
+       let mut local_ret = Vec::new(); for item in ret.drain(..) { local_ret.push( { crate::chain::channelmonitor::MonitorEvent { inner: Box::into_raw(Box::new(item)), is_owned: true } }); };
+       local_ret.into()
+}
+
+/// Gets the list of pending events which were generated by previous actions, clearing the list
+/// in the process.
+///
+/// This is called by ChainMonitor::get_and_clear_pending_events() and is equivalent to
+/// EventsProvider::get_and_clear_pending_events() except that it requires &mut self as we do
+/// no internal locking in ChannelMonitors.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn ChannelMonitor_get_and_clear_pending_events(this_arg: &mut ChannelMonitor) -> crate::c_types::derived::CVec_EventZ {
+       let mut ret = unsafe { &mut (*(this_arg.inner as *mut nativeChannelMonitor)) }.get_and_clear_pending_events();
+       let mut local_ret = Vec::new(); for item in ret.drain(..) { local_ret.push( { crate::util::events::Event::native_into(item) }); };
+       local_ret.into()
+}
+
+/// Used by ChannelManager deserialization to broadcast the latest holder state if its copy of
+/// the Channel was out-of-date. You may use it to get a broadcastable holder toxic tx in case of
+/// fallen-behind, i.e when receiving a channel_reestablish with a proof that our counterparty side knows
+/// a higher revocation secret than the holder commitment number we are aware of. Broadcasting these
+/// transactions are UNSAFE, as they allow counterparty side to punish you. Nevertheless you may want to
+/// broadcast them if counterparty don't close channel with his higher commitment transaction after a
+/// substantial amount of time (a month or even a year) to get back funds. Best may be to contact
+/// out-of-band the other node operator to coordinate with him if option is available to you.
+/// In any-case, choice is up to the user.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn ChannelMonitor_get_latest_holder_commitment_txn(this_arg: &mut ChannelMonitor, logger: &crate::util::logger::Logger) -> crate::c_types::derived::CVec_TransactionZ {
+       let mut ret = unsafe { &mut (*(this_arg.inner as *mut nativeChannelMonitor)) }.get_latest_holder_commitment_txn(logger);
+       let mut local_ret = Vec::new(); for item in ret.drain(..) { local_ret.push( { let mut local_ret_0 = ::bitcoin::consensus::encode::serialize(&item); crate::c_types::Transaction::from_vec(local_ret_0) }); };
+       local_ret.into()
+}
+
+/// Processes transactions in a newly connected block, which may result in any of the following:
+/// - update the monitor's state against resolved HTLCs
+/// - punish the counterparty in the case of seeing a revoked commitment transaction
+/// - force close the channel and claim/timeout incoming/outgoing HTLCs if near expiration
+/// - detect settled outputs for later spending
+/// - schedule and bump any in-flight claims
+///
+/// Returns any new outputs to watch from `txdata`; after called, these are also included in
+/// [`get_outputs_to_watch`].
+///
+/// [`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 {
+       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 }); };
+       local_ret.into()
+}
+
+/// Determines if the disconnected block contained any transactions of interest and updates
+/// appropriately.
+#[no_mangle]
+pub extern "C" fn ChannelMonitor_block_disconnected(this_arg: &mut ChannelMonitor, header: *const [u8; 80], mut height: u32, mut broadcaster: crate::chain::chaininterface::BroadcasterInterface, mut fee_estimator: crate::chain::chaininterface::FeeEstimator, mut logger: crate::util::logger::Logger) {
+       unsafe { &mut (*(this_arg.inner as *mut nativeChannelMonitor)) }.block_disconnected(&::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), height, broadcaster, fee_estimator, logger)
+}
+
index 290b295537fdf807e01c2f8f1a150275b7c13059..972e05b79f01afee9f686a86944623f9d404461c 100644 (file)
@@ -409,7 +409,7 @@ impl rustChannelKeys for ChannelKeys {
        fn sign_counterparty_commitment<T:bitcoin::secp256k1::Signing + bitcoin::secp256k1::Verification>(&self, feerate_per_kw: u32, commitment_tx: &bitcoin::blockdata::transaction::Transaction, keys: &lightning::ln::chan_utils::PreCalculatedTxCreationKeys, htlcs: &[&lightning::ln::chan_utils::HTLCOutputInCommitment], _secp_ctx: &bitcoin::secp256k1::Secp256k1<T>) -> Result<(bitcoin::secp256k1::Signature, Vec<bitcoin::secp256k1::Signature>), ()> {
                let mut local_commitment_tx = ::bitcoin::consensus::encode::serialize(commitment_tx);
                let mut local_htlcs = Vec::new(); for item in htlcs.iter() { local_htlcs.push( { crate::ln::chan_utils::HTLCOutputInCommitment { inner: unsafe { ( (&(**item) as *const _) as *mut _) }, is_owned: false } }); };
-               let mut ret = (self.sign_counterparty_commitment)(self.this_arg, feerate_per_kw, crate::c_types::Transaction::from_slice(&local_commitment_tx), &crate::ln::chan_utils::PreCalculatedTxCreationKeys { inner: unsafe { (keys as *const _) as *mut _ }, is_owned: false }, local_htlcs.into());
+               let mut ret = (self.sign_counterparty_commitment)(self.this_arg, feerate_per_kw, crate::c_types::Transaction::from_vec(local_commitment_tx), &crate::ln::chan_utils::PreCalculatedTxCreationKeys { inner: unsafe { (keys as *const _) as *mut _ }, is_owned: false }, local_htlcs.into());
                let mut local_ret = match ret.result_ok { true => Ok( { let (mut orig_ret_0_0, mut orig_ret_0_1) = (*unsafe { Box::from_raw(ret.contents.result.take_ptr()) }).to_rust(); let mut local_orig_ret_0_1 = Vec::new(); for mut item in orig_ret_0_1.into_rust().drain(..) { local_orig_ret_0_1.push( { item.into_rust() }); }; let mut local_ret_0 = (orig_ret_0_0.into_rust(), local_orig_ret_0_1); local_ret_0 }), false => Err( { () /*(*unsafe { Box::from_raw(ret.contents.err.take_ptr()) })*/ })};
                local_ret
        }
@@ -426,19 +426,19 @@ impl rustChannelKeys for ChannelKeys {
        fn sign_justice_transaction<T:bitcoin::secp256k1::Signing + bitcoin::secp256k1::Verification>(&self, justice_tx: &bitcoin::blockdata::transaction::Transaction, input: usize, amount: u64, per_commitment_key: &bitcoin::secp256k1::key::SecretKey, htlc: &Option<lightning::ln::chan_utils::HTLCOutputInCommitment>, _secp_ctx: &bitcoin::secp256k1::Secp256k1<T>) -> Result<bitcoin::secp256k1::Signature, ()> {
                let mut local_justice_tx = ::bitcoin::consensus::encode::serialize(justice_tx);
                let mut local_htlc = &crate::ln::chan_utils::HTLCOutputInCommitment { inner: unsafe { (if htlc.is_none() { std::ptr::null() } else {  { (htlc.as_ref().unwrap()) } } as *const _) as *mut _ }, is_owned: false };
-               let mut ret = (self.sign_justice_transaction)(self.this_arg, crate::c_types::Transaction::from_slice(&local_justice_tx), input, amount, per_commitment_key.as_ref(), local_htlc);
+               let mut ret = (self.sign_justice_transaction)(self.this_arg, crate::c_types::Transaction::from_vec(local_justice_tx), input, amount, per_commitment_key.as_ref(), local_htlc);
                let mut local_ret = match ret.result_ok { true => Ok( { (*unsafe { Box::from_raw(ret.contents.result.take_ptr()) }).into_rust() }), false => Err( { () /*(*unsafe { Box::from_raw(ret.contents.err.take_ptr()) })*/ })};
                local_ret
        }
        fn sign_counterparty_htlc_transaction<T:bitcoin::secp256k1::Signing + bitcoin::secp256k1::Verification>(&self, htlc_tx: &bitcoin::blockdata::transaction::Transaction, input: usize, amount: u64, per_commitment_point: &bitcoin::secp256k1::key::PublicKey, htlc: &lightning::ln::chan_utils::HTLCOutputInCommitment, _secp_ctx: &bitcoin::secp256k1::Secp256k1<T>) -> Result<bitcoin::secp256k1::Signature, ()> {
                let mut local_htlc_tx = ::bitcoin::consensus::encode::serialize(htlc_tx);
-               let mut ret = (self.sign_counterparty_htlc_transaction)(self.this_arg, crate::c_types::Transaction::from_slice(&local_htlc_tx), input, amount, crate::c_types::PublicKey::from_rust(&per_commitment_point), &crate::ln::chan_utils::HTLCOutputInCommitment { inner: unsafe { (htlc as *const _) as *mut _ }, is_owned: false });
+               let mut ret = (self.sign_counterparty_htlc_transaction)(self.this_arg, crate::c_types::Transaction::from_vec(local_htlc_tx), input, amount, crate::c_types::PublicKey::from_rust(&per_commitment_point), &crate::ln::chan_utils::HTLCOutputInCommitment { inner: unsafe { (htlc 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()) }).into_rust() }), false => Err( { () /*(*unsafe { Box::from_raw(ret.contents.err.take_ptr()) })*/ })};
                local_ret
        }
        fn sign_closing_transaction<T:bitcoin::secp256k1::Signing>(&self, closing_tx: &bitcoin::blockdata::transaction::Transaction, _secp_ctx: &bitcoin::secp256k1::Secp256k1<T>) -> Result<bitcoin::secp256k1::Signature, ()> {
                let mut local_closing_tx = ::bitcoin::consensus::encode::serialize(closing_tx);
-               let mut ret = (self.sign_closing_transaction)(self.this_arg, crate::c_types::Transaction::from_slice(&local_closing_tx));
+               let mut ret = (self.sign_closing_transaction)(self.this_arg, crate::c_types::Transaction::from_vec(local_closing_tx));
                let mut local_ret = match ret.result_ok { true => Ok( { (*unsafe { Box::from_raw(ret.contents.result.take_ptr()) }).into_rust() }), false => Err( { () /*(*unsafe { Box::from_raw(ret.contents.err.take_ptr()) })*/ })};
                local_ret
        }
@@ -750,7 +750,7 @@ extern "C" fn InMemoryChannelKeys_ChannelKeys_key_derivation_params(this_arg: *c
        local_ret
 }
 #[must_use]
-extern "C" fn InMemoryChannelKeys_ChannelKeys_sign_counterparty_commitment(this_arg: *const c_void, mut feerate_per_kw: u32, commitment_tx: crate::c_types::Transaction, pre_keys: &crate::ln::chan_utils::PreCalculatedTxCreationKeys, mut htlcs: crate::c_types::derived::CVec_HTLCOutputInCommitmentZ) -> crate::c_types::derived::CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
+extern "C" fn InMemoryChannelKeys_ChannelKeys_sign_counterparty_commitment(this_arg: *const c_void, mut feerate_per_kw: u32, mut commitment_tx: crate::c_types::Transaction, pre_keys: &crate::ln::chan_utils::PreCalculatedTxCreationKeys, mut htlcs: crate::c_types::derived::CVec_HTLCOutputInCommitmentZ) -> crate::c_types::derived::CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
        let mut local_htlcs = Vec::new(); for mut item in htlcs.as_slice().iter() { local_htlcs.push( { unsafe { &*item.inner } }); };
        let mut ret = unsafe { &mut *(this_arg as *mut nativeInMemoryChannelKeys) }.sign_counterparty_commitment(feerate_per_kw, &commitment_tx.into_bitcoin(), unsafe { &*pre_keys.inner }, &local_htlcs[..], &bitcoin::secp256k1::Secp256k1::new());
        let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { let (mut orig_ret_0_0, mut orig_ret_0_1) = o; let mut local_orig_ret_0_1 = Vec::new(); for item in orig_ret_0_1.drain(..) { local_orig_ret_0_1.push( { crate::c_types::Signature::from_rust(&item) }); }; let mut local_ret_0 = (crate::c_types::Signature::from_rust(&orig_ret_0_0), local_orig_ret_0_1.into()).into(); local_ret_0 }), Err(mut e) => crate::c_types::CResultTempl::err( { 0u8 /*e*/ }) };
@@ -769,20 +769,20 @@ extern "C" fn InMemoryChannelKeys_ChannelKeys_sign_holder_commitment_htlc_transa
        local_ret
 }
 #[must_use]
-extern "C" fn InMemoryChannelKeys_ChannelKeys_sign_justice_transaction(this_arg: *const c_void, justice_tx: crate::c_types::Transaction, mut input: usize, mut amount: u64, per_commitment_key: *const [u8; 32], htlc: &crate::ln::chan_utils::HTLCOutputInCommitment) -> crate::c_types::derived::CResult_SignatureNoneZ {
+extern "C" fn InMemoryChannelKeys_ChannelKeys_sign_justice_transaction(this_arg: *const c_void, mut justice_tx: crate::c_types::Transaction, mut input: usize, mut amount: u64, per_commitment_key: *const [u8; 32], htlc: &crate::ln::chan_utils::HTLCOutputInCommitment) -> crate::c_types::derived::CResult_SignatureNoneZ {
        let mut local_htlc = if htlc.inner.is_null() { None } else { Some((* { unsafe { &*htlc.inner } }).clone()) };
        let mut ret = unsafe { &mut *(this_arg as *mut nativeInMemoryChannelKeys) }.sign_justice_transaction(&justice_tx.into_bitcoin(), input, amount, &::bitcoin::secp256k1::key::SecretKey::from_slice(&unsafe { *per_commitment_key}[..]).unwrap(), &local_htlc, &bitcoin::secp256k1::Secp256k1::new());
        let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::Signature::from_rust(&o) }), Err(mut e) => crate::c_types::CResultTempl::err( { 0u8 /*e*/ }) };
        local_ret
 }
 #[must_use]
-extern "C" fn InMemoryChannelKeys_ChannelKeys_sign_counterparty_htlc_transaction(this_arg: *const c_void, htlc_tx: crate::c_types::Transaction, mut input: usize, mut amount: u64, per_commitment_point: crate::c_types::PublicKey, htlc: &crate::ln::chan_utils::HTLCOutputInCommitment) -> crate::c_types::derived::CResult_SignatureNoneZ {
+extern "C" fn InMemoryChannelKeys_ChannelKeys_sign_counterparty_htlc_transaction(this_arg: *const c_void, mut htlc_tx: crate::c_types::Transaction, mut input: usize, mut amount: u64, mut per_commitment_point: crate::c_types::PublicKey, htlc: &crate::ln::chan_utils::HTLCOutputInCommitment) -> crate::c_types::derived::CResult_SignatureNoneZ {
        let mut ret = unsafe { &mut *(this_arg as *mut nativeInMemoryChannelKeys) }.sign_counterparty_htlc_transaction(&htlc_tx.into_bitcoin(), input, amount, &per_commitment_point.into_rust(), unsafe { &*htlc.inner }, &bitcoin::secp256k1::Secp256k1::new());
        let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::Signature::from_rust(&o) }), Err(mut e) => crate::c_types::CResultTempl::err( { 0u8 /*e*/ }) };
        local_ret
 }
 #[must_use]
-extern "C" fn InMemoryChannelKeys_ChannelKeys_sign_closing_transaction(this_arg: *const c_void, closing_tx: crate::c_types::Transaction) -> crate::c_types::derived::CResult_SignatureNoneZ {
+extern "C" fn InMemoryChannelKeys_ChannelKeys_sign_closing_transaction(this_arg: *const c_void, mut closing_tx: crate::c_types::Transaction) -> crate::c_types::derived::CResult_SignatureNoneZ {
        let mut ret = unsafe { &mut *(this_arg as *mut nativeInMemoryChannelKeys) }.sign_closing_transaction(&closing_tx.into_bitcoin(), &bitcoin::secp256k1::Secp256k1::new());
        let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::Signature::from_rust(&o) }), Err(mut e) => crate::c_types::CResultTempl::err( { 0u8 /*e*/ }) };
        local_ret
index 44ce4c142203b805123a1af799c18ce67bb3227b..cbfa6074ada4f2f3055c733784c0a0a5e3552570 100644 (file)
@@ -5,5 +5,248 @@ use bitcoin::hashes::Hash;
 use crate::c_types::*;
 
 pub mod chaininterface;
+pub mod chainmonitor;
+pub mod channelmonitor;
 pub mod transaction;
 pub mod keysinterface;
+/// An error when accessing the chain via [`Access`].
+///
+/// [`Access`]: trait.Access.html
+#[must_use]
+#[derive(Clone)]
+#[repr(C)]
+pub enum AccessError {
+       /// The requested chain is unknown.
+       UnknownChain,
+       /// The requested transaction doesn't exist or hasn't confirmed.
+       UnknownTx,
+}
+use lightning::chain::AccessError as nativeAccessError;
+impl AccessError {
+       #[allow(unused)]
+       pub(crate) fn to_native(&self) -> nativeAccessError {
+               match self {
+                       AccessError::UnknownChain => nativeAccessError::UnknownChain,
+                       AccessError::UnknownTx => nativeAccessError::UnknownTx,
+               }
+       }
+       #[allow(unused)]
+       pub(crate) fn into_native(self) -> nativeAccessError {
+               match self {
+                       AccessError::UnknownChain => nativeAccessError::UnknownChain,
+                       AccessError::UnknownTx => nativeAccessError::UnknownTx,
+               }
+       }
+       #[allow(unused)]
+       pub(crate) fn from_native(native: &nativeAccessError) -> Self {
+               match native {
+                       nativeAccessError::UnknownChain => AccessError::UnknownChain,
+                       nativeAccessError::UnknownTx => AccessError::UnknownTx,
+               }
+       }
+       #[allow(unused)]
+       pub(crate) fn native_into(native: nativeAccessError) -> Self {
+               match native {
+                       nativeAccessError::UnknownChain => AccessError::UnknownChain,
+                       nativeAccessError::UnknownTx => AccessError::UnknownTx,
+               }
+       }
+}
+/// The `Access` trait defines behavior for accessing chain data and state, such as blocks and
+/// UTXOs.
+#[repr(C)]
+pub struct Access {
+       pub this_arg: *mut c_void,
+       /// Returns the transaction output of a funding transaction encoded by [`short_channel_id`].
+       /// Returns an error if `genesis_hash` is for a different chain or if such a transaction output
+       /// is unknown.
+       ///
+       /// [`short_channel_id`]: https://github.com/lightningnetwork/lightning-rfc/blob/master/07-routing-gossip.md#definition-of-short_channel_id
+       #[must_use]
+       pub get_utxo: extern "C" fn (this_arg: *const c_void, genesis_hash: *const [u8; 32], short_channel_id: u64) -> crate::c_types::derived::CResult_TxOutAccessErrorZ,
+       pub free: Option<extern "C" fn(this_arg: *mut c_void)>,
+}
+unsafe impl Send for Access {}
+unsafe impl Sync for Access {}
+
+use lightning::chain::Access as rustAccess;
+impl rustAccess for Access {
+       fn get_utxo(&self, genesis_hash: &bitcoin::hash_types::BlockHash, short_channel_id: u64) -> Result<bitcoin::blockdata::transaction::TxOut, lightning::chain::AccessError> {
+               let mut ret = (self.get_utxo)(self.this_arg, genesis_hash.as_inner(), short_channel_id);
+               let mut local_ret = match ret.result_ok { true => Ok( { (*unsafe { Box::from_raw(ret.contents.result.take_ptr()) }).into_rust() }), 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 Access {
+       type Target = Self;
+       fn deref(&self) -> &Self {
+               self
+       }
+}
+/// Calls the free function if one is set
+#[no_mangle]
+pub extern "C" fn Access_free(this_ptr: Access) { }
+impl Drop for Access {
+       fn drop(&mut self) {
+               if let Some(f) = self.free {
+                       f(self.this_arg);
+               }
+       }
+}
+/// The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as
+/// blocks are connected and disconnected.
+///
+/// Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are
+/// responsible for maintaining a set of monitors such that they can be updated accordingly as
+/// channel state changes and HTLCs are resolved. See method documentation for specific
+/// requirements.
+///
+/// Implementations **must** ensure that updates are successfully applied and persisted upon method
+/// completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down
+/// without taking any further action such as persisting the current state.
+///
+/// If an implementation maintains multiple instances of a channel's monitor (e.g., by storing
+/// backup copies), then it must ensure that updates are applied across all instances. Otherwise, it
+/// could result in a revoked transaction being broadcast, allowing the counterparty to claim all
+/// funds in the channel. See [`ChannelMonitorUpdateErr`] for more details about how to handle
+/// multiple instances.
+///
+/// [`ChannelMonitor`]: channelmonitor/struct.ChannelMonitor.html
+/// [`ChannelMonitorUpdateErr`]: channelmonitor/enum.ChannelMonitorUpdateErr.html
+/// [`PermanentFailure`]: channelmonitor/enum.ChannelMonitorUpdateErr.html#variant.PermanentFailure
+#[repr(C)]
+pub struct Watch {
+       pub this_arg: *mut c_void,
+       /// Watches a channel identified by `funding_txo` using `monitor`.
+       ///
+       /// Implementations are responsible for watching the chain for the funding transaction along
+       /// with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means
+       /// calling [`block_connected`] and [`block_disconnected`] on the monitor.
+       ///
+       /// [`get_outputs_to_watch`]: channelmonitor/struct.ChannelMonitor.html#method.get_outputs_to_watch
+       /// [`block_connected`]: channelmonitor/struct.ChannelMonitor.html#method.block_connected
+       /// [`block_disconnected`]: channelmonitor/struct.ChannelMonitor.html#method.block_disconnected
+       #[must_use]
+       pub watch_channel: extern "C" fn (this_arg: *const c_void, funding_txo: crate::chain::transaction::OutPoint, monitor: crate::chain::channelmonitor::ChannelMonitor) -> crate::c_types::derived::CResult_NoneChannelMonitorUpdateErrZ,
+       /// Updates a channel identified by `funding_txo` by applying `update` to its monitor.
+       ///
+       /// Implementations must call [`update_monitor`] with the given update. See
+       /// [`ChannelMonitorUpdateErr`] for invariants around returning an error.
+       ///
+       /// [`update_monitor`]: channelmonitor/struct.ChannelMonitor.html#method.update_monitor
+       /// [`ChannelMonitorUpdateErr`]: channelmonitor/enum.ChannelMonitorUpdateErr.html
+       #[must_use]
+       pub update_channel: extern "C" fn (this_arg: *const c_void, funding_txo: crate::chain::transaction::OutPoint, update: crate::chain::channelmonitor::ChannelMonitorUpdate) -> crate::c_types::derived::CResult_NoneChannelMonitorUpdateErrZ,
+       /// Returns any monitor events since the last call. Subsequent calls must only return new
+       /// events.
+       #[must_use]
+       pub release_pending_monitor_events: extern "C" fn (this_arg: *const c_void) -> crate::c_types::derived::CVec_MonitorEventZ,
+       pub free: Option<extern "C" fn(this_arg: *mut c_void)>,
+}
+unsafe impl Send for Watch {}
+unsafe impl Sync for Watch {}
+
+use lightning::chain::Watch as rustWatch;
+impl rustWatch for Watch {
+       type Keys = crate::chain::keysinterface::ChannelKeys;
+       fn watch_channel(&self, funding_txo: lightning::chain::transaction::OutPoint, monitor: lightning::chain::channelmonitor::ChannelMonitor<Self::Keys>) -> Result<(), lightning::chain::channelmonitor::ChannelMonitorUpdateErr> {
+               let mut ret = (self.watch_channel)(self.this_arg, crate::chain::transaction::OutPoint { inner: Box::into_raw(Box::new(funding_txo)), is_owned: true }, crate::chain::channelmonitor::ChannelMonitor { inner: Box::into_raw(Box::new(monitor)), is_owned: true });
+               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_channel(&self, funding_txo: lightning::chain::transaction::OutPoint, update: lightning::chain::channelmonitor::ChannelMonitorUpdate) -> Result<(), lightning::chain::channelmonitor::ChannelMonitorUpdateErr> {
+               let mut ret = (self.update_channel)(self.this_arg, crate::chain::transaction::OutPoint { inner: Box::into_raw(Box::new(funding_txo)), is_owned: true }, crate::chain::channelmonitor::ChannelMonitorUpdate { inner: Box::into_raw(Box::new(update)), is_owned: true });
+               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 release_pending_monitor_events(&self) -> Vec<lightning::chain::channelmonitor::MonitorEvent> {
+               let mut ret = (self.release_pending_monitor_events)(self.this_arg);
+               let mut local_ret = Vec::new(); for mut item in ret.into_rust().drain(..) { local_ret.push( { *unsafe { Box::from_raw(item.take_ptr()) } }); };
+               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 Watch {
+       type Target = Self;
+       fn deref(&self) -> &Self {
+               self
+       }
+}
+/// Calls the free function if one is set
+#[no_mangle]
+pub extern "C" fn Watch_free(this_ptr: Watch) { }
+impl Drop for Watch {
+       fn drop(&mut self) {
+               if let Some(f) = self.free {
+                       f(self.this_arg);
+               }
+       }
+}
+/// The `Filter` trait defines behavior for indicating chain activity of interest pertaining to
+/// channels.
+///
+/// This is useful in order to have a [`Watch`] implementation convey to a chain source which
+/// transactions to be notified of. Notification may take the form of pre-filtering blocks or, in
+/// the case of [BIP 157]/[BIP 158], only fetching a block if the compact filter matches. If
+/// receiving full blocks from a chain source, any further filtering is unnecessary.
+///
+/// After an output has been registered, subsequent block retrievals from the chain source must not
+/// exclude any transactions matching the new criteria nor any in-block descendants of such
+/// transactions.
+///
+/// Note that use as part of a [`Watch`] implementation involves reentrancy. Therefore, the `Filter`
+/// should not block on I/O. Implementations should instead queue the newly monitored data to be
+/// processed later. Then, in order to block until the data has been processed, any `Watch`
+/// invocation that has called the `Filter` must return [`TemporaryFailure`].
+///
+/// [`Watch`]: trait.Watch.html
+/// [`TemporaryFailure`]: channelmonitor/enum.ChannelMonitorUpdateErr.html#variant.TemporaryFailure
+/// [BIP 157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki
+/// [BIP 158]: https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki
+#[repr(C)]
+pub struct Filter {
+       pub this_arg: *mut c_void,
+       /// Registers interest in a transaction with `txid` and having an output with `script_pubkey` as
+       /// a spending condition.
+       pub register_tx: extern "C" fn (this_arg: *const c_void, txid: *const [u8; 32], script_pubkey: crate::c_types::u8slice),
+       /// Registers interest in spends of a transaction output identified by `outpoint` having
+       /// `script_pubkey` as the spending condition.
+       pub register_output: extern "C" fn (this_arg: *const c_void, outpoint: &crate::chain::transaction::OutPoint, script_pubkey: crate::c_types::u8slice),
+       pub free: Option<extern "C" fn(this_arg: *mut c_void)>,
+}
+unsafe impl Send for Filter {}
+unsafe impl Sync for Filter {}
+
+use lightning::chain::Filter as rustFilter;
+impl rustFilter for Filter {
+       fn register_tx(&self, txid: &bitcoin::hash_types::Txid, script_pubkey: &bitcoin::blockdata::script::Script) {
+               (self.register_tx)(self.this_arg, txid.as_inner(), crate::c_types::u8slice::from_slice(&script_pubkey[..]))
+       }
+       fn register_output(&self, outpoint: &lightning::chain::transaction::OutPoint, script_pubkey: &bitcoin::blockdata::script::Script) {
+               (self.register_output)(self.this_arg, &crate::chain::transaction::OutPoint { inner: unsafe { (outpoint as *const _) as *mut _ }, is_owned: false }, crate::c_types::u8slice::from_slice(&script_pubkey[..]))
+       }
+}
+
+// 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 Filter {
+       type Target = Self;
+       fn deref(&self) -> &Self {
+               self
+       }
+}
+/// Calls the free function if one is set
+#[no_mangle]
+pub extern "C" fn Filter_free(this_ptr: Filter) { }
+impl Drop for Filter {
+       fn drop(&mut self) {
+               if let Some(f) = self.free {
+                       f(self.this_arg);
+               }
+       }
+}
index 39236768def15fbc7de7dcbd2339f194764f793c..40033b15c8f28ba390cbdd1913e5c0bb6e37a56b 100644 (file)
@@ -1,4 +1,4 @@
-//! Contains simple structs describing parts of transactions on the chain.
+//! Types describing on-chain transactions.
 
 use std::ffi::c_void;
 use bitcoin::hashes::Hash;
index bf3953a09e40f9b20e2705afb91440c72fde0784..eec0b8a9d7ae09671208ff3e97bef8b659100f1d 100644 (file)
@@ -19,7 +19,7 @@ pub extern "C" fn build_commitment_secret(commitment_seed: *const [u8; 32], mut
 /// Note that this is infallible iff we trust that at least one of the two input keys are randomly
 /// generated (ie our own).
 #[no_mangle]
-pub extern "C" fn derive_private_key(per_commitment_point: crate::c_types::PublicKey, base_secret: *const [u8; 32]) -> crate::c_types::derived::CResult_SecretKeySecpErrorZ {
+pub extern "C" fn derive_private_key(mut per_commitment_point: crate::c_types::PublicKey, base_secret: *const [u8; 32]) -> crate::c_types::derived::CResult_SecretKeySecpErrorZ {
        let mut ret = lightning::ln::chan_utils::derive_private_key(&bitcoin::secp256k1::Secp256k1::new(), &per_commitment_point.into_rust(), &::bitcoin::secp256k1::key::SecretKey::from_slice(&unsafe { *base_secret}[..]).unwrap());
        let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::SecretKey::from_rust(o) }), Err(mut e) => crate::c_types::CResultTempl::err( { crate::c_types::Secp256k1Error::from_rust(e) }) };
        local_ret
@@ -32,7 +32,7 @@ pub extern "C" fn derive_private_key(per_commitment_point: crate::c_types::Publi
 /// Note that this is infallible iff we trust that at least one of the two input keys are randomly
 /// generated (ie our own).
 #[no_mangle]
-pub extern "C" fn derive_public_key(per_commitment_point: crate::c_types::PublicKey, base_point: crate::c_types::PublicKey) -> crate::c_types::derived::CResult_PublicKeySecpErrorZ {
+pub extern "C" fn derive_public_key(mut per_commitment_point: crate::c_types::PublicKey, mut base_point: crate::c_types::PublicKey) -> crate::c_types::derived::CResult_PublicKeySecpErrorZ {
        let mut ret = lightning::ln::chan_utils::derive_public_key(&bitcoin::secp256k1::Secp256k1::new(), &per_commitment_point.into_rust(), &base_point.into_rust());
        let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::PublicKey::from_rust(&o) }), Err(mut e) => crate::c_types::CResultTempl::err( { crate::c_types::Secp256k1Error::from_rust(e) }) };
        local_ret
@@ -66,7 +66,7 @@ pub extern "C" fn derive_private_revocation_key(per_commitment_secret: *const [u
 /// Note that this is infallible iff we trust that at least one of the two input keys are randomly
 /// generated (ie our own).
 #[no_mangle]
-pub extern "C" fn derive_public_revocation_key(per_commitment_point: crate::c_types::PublicKey, countersignatory_revocation_base_point: crate::c_types::PublicKey) -> crate::c_types::derived::CResult_PublicKeySecpErrorZ {
+pub extern "C" fn derive_public_revocation_key(mut per_commitment_point: crate::c_types::PublicKey, mut countersignatory_revocation_base_point: crate::c_types::PublicKey) -> crate::c_types::derived::CResult_PublicKeySecpErrorZ {
        let mut ret = lightning::ln::chan_utils::derive_public_revocation_key(&bitcoin::secp256k1::Secp256k1::new(), &per_commitment_point.into_rust(), &countersignatory_revocation_base_point.into_rust());
        let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::PublicKey::from_rust(&o) }), Err(mut e) => crate::c_types::CResultTempl::err( { crate::c_types::Secp256k1Error::from_rust(e) }) };
        local_ret
@@ -431,7 +431,7 @@ pub extern "C" fn ChannelPublicKeys_read(ser: crate::c_types::u8slice) -> Channe
 /// Create a new TxCreationKeys from channel base points and the per-commitment point
 #[must_use]
 #[no_mangle]
-pub extern "C" fn TxCreationKeys_derive_new(per_commitment_point: crate::c_types::PublicKey, broadcaster_delayed_payment_base: crate::c_types::PublicKey, broadcaster_htlc_base: crate::c_types::PublicKey, countersignatory_revocation_base: crate::c_types::PublicKey, countersignatory_htlc_base: crate::c_types::PublicKey) -> crate::c_types::derived::CResult_TxCreationKeysSecpErrorZ {
+pub extern "C" fn TxCreationKeys_derive_new(mut per_commitment_point: crate::c_types::PublicKey, mut broadcaster_delayed_payment_base: crate::c_types::PublicKey, mut broadcaster_htlc_base: crate::c_types::PublicKey, mut countersignatory_revocation_base: crate::c_types::PublicKey, mut countersignatory_htlc_base: crate::c_types::PublicKey) -> crate::c_types::derived::CResult_TxCreationKeysSecpErrorZ {
        let mut ret = lightning::ln::chan_utils::TxCreationKeys::derive_new(&bitcoin::secp256k1::Secp256k1::new(), &per_commitment_point.into_rust(), &broadcaster_delayed_payment_base.into_rust(), &broadcaster_htlc_base.into_rust(), &countersignatory_revocation_base.into_rust(), &countersignatory_htlc_base.into_rust());
        let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::chan_utils::TxCreationKeys { inner: Box::into_raw(Box::new(o)), is_owned: true } }), Err(mut e) => crate::c_types::CResultTempl::err( { crate::c_types::Secp256k1Error::from_rust(e) }) };
        local_ret
@@ -441,7 +441,7 @@ pub extern "C" fn TxCreationKeys_derive_new(per_commitment_point: crate::c_types
 /// key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain.
 /// Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions.
 #[no_mangle]
-pub extern "C" fn get_revokeable_redeemscript(revocation_key: crate::c_types::PublicKey, mut contest_delay: u16, broadcaster_delayed_payment_key: crate::c_types::PublicKey) -> crate::c_types::derived::CVec_u8Z {
+pub extern "C" fn get_revokeable_redeemscript(mut revocation_key: crate::c_types::PublicKey, mut contest_delay: u16, mut broadcaster_delayed_payment_key: crate::c_types::PublicKey) -> crate::c_types::derived::CVec_u8Z {
        let mut ret = lightning::ln::chan_utils::get_revokeable_redeemscript(&revocation_key.into_rust(), contest_delay, &broadcaster_delayed_payment_key.into_rust());
        ret.into_bytes().into()
 }
@@ -572,17 +572,17 @@ pub extern "C" fn get_htlc_redeemscript(htlc: &crate::ln::chan_utils::HTLCOutput
 /// Gets the redeemscript for a funding output from the two funding public keys.
 /// Note that the order of funding public keys does not matter.
 #[no_mangle]
-pub extern "C" fn make_funding_redeemscript(broadcaster: crate::c_types::PublicKey, countersignatory: crate::c_types::PublicKey) -> crate::c_types::derived::CVec_u8Z {
+pub extern "C" fn make_funding_redeemscript(mut broadcaster: crate::c_types::PublicKey, mut countersignatory: crate::c_types::PublicKey) -> crate::c_types::derived::CVec_u8Z {
        let mut ret = lightning::ln::chan_utils::make_funding_redeemscript(&broadcaster.into_rust(), &countersignatory.into_rust());
        ret.into_bytes().into()
 }
 
 /// panics if htlc.transaction_output_index.is_none()!
 #[no_mangle]
-pub extern "C" fn build_htlc_transaction(prev_hash: *const [u8; 32], mut feerate_per_kw: u32, mut contest_delay: u16, htlc: &crate::ln::chan_utils::HTLCOutputInCommitment, broadcaster_delayed_payment_key: crate::c_types::PublicKey, revocation_key: crate::c_types::PublicKey) -> crate::c_types::derived::CVec_u8Z {
+pub extern "C" fn build_htlc_transaction(prev_hash: *const [u8; 32], mut feerate_per_kw: u32, mut contest_delay: u16, htlc: &crate::ln::chan_utils::HTLCOutputInCommitment, mut broadcaster_delayed_payment_key: crate::c_types::PublicKey, mut revocation_key: crate::c_types::PublicKey) -> crate::c_types::Transaction {
        let mut ret = lightning::ln::chan_utils::build_htlc_transaction(&::bitcoin::hash_types::Txid::from_slice(&unsafe { &*prev_hash }[..]).unwrap(), feerate_per_kw, contest_delay, unsafe { &*htlc.inner }, &broadcaster_delayed_payment_key.into_rust(), &revocation_key.into_rust());
        let mut local_ret = ::bitcoin::consensus::encode::serialize(&ret);
-       local_ret.into()
+       crate::c_types::Transaction::from_vec(local_ret)
 }
 
 
@@ -640,15 +640,15 @@ pub(crate) extern "C" fn HolderCommitmentTransaction_clone_void(this_ptr: *const
 }
 /// The commitment transaction itself, in unsigned form.
 #[no_mangle]
-pub extern "C" fn HolderCommitmentTransaction_get_unsigned_tx(this_ptr: &HolderCommitmentTransaction) -> crate::c_types::derived::CVec_u8Z {
+pub extern "C" fn HolderCommitmentTransaction_get_unsigned_tx(this_ptr: &HolderCommitmentTransaction) -> crate::c_types::Transaction {
        let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.unsigned_tx;
        let mut local_inner_val = ::bitcoin::consensus::encode::serialize(inner_val);
-       local_inner_val.into()
+       crate::c_types::Transaction::from_vec(local_inner_val)
 }
 /// The commitment transaction itself, in unsigned form.
 #[no_mangle]
-pub extern "C" fn HolderCommitmentTransaction_set_unsigned_tx(this_ptr: &mut HolderCommitmentTransaction, mut val: crate::c_types::derived::CVec_u8Z) {
-       unsafe { &mut *this_ptr.inner }.unsigned_tx = ::bitcoin::consensus::encode::deserialize(&val.into_rust()[..]).unwrap();
+pub extern "C" fn HolderCommitmentTransaction_set_unsigned_tx(this_ptr: &mut HolderCommitmentTransaction, mut val: crate::c_types::Transaction) {
+       unsafe { &mut *this_ptr.inner }.unsigned_tx = val.into_bitcoin();
 }
 /// Our counterparty's signature for the transaction, above.
 #[no_mangle]
@@ -694,9 +694,9 @@ pub extern "C" fn HolderCommitmentTransaction_set_per_htlc(this_ptr: &mut Holder
 /// only checks that the shape and amounts are consistent, but does not check the scriptPubkey.
 #[must_use]
 #[no_mangle]
-pub extern "C" fn HolderCommitmentTransaction_new_missing_holder_sig(mut unsigned_tx: crate::c_types::derived::CVec_u8Z, mut counterparty_sig: crate::c_types::Signature, holder_funding_key: crate::c_types::PublicKey, counterparty_funding_key: crate::c_types::PublicKey, mut keys: crate::ln::chan_utils::TxCreationKeys, mut feerate_per_kw: u32, mut htlc_data: crate::c_types::derived::CVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ) -> crate::ln::chan_utils::HolderCommitmentTransaction {
+pub extern "C" fn HolderCommitmentTransaction_new_missing_holder_sig(mut unsigned_tx: crate::c_types::Transaction, mut counterparty_sig: crate::c_types::Signature, mut holder_funding_key: crate::c_types::PublicKey, mut counterparty_funding_key: crate::c_types::PublicKey, mut keys: crate::ln::chan_utils::TxCreationKeys, mut feerate_per_kw: u32, mut htlc_data: crate::c_types::derived::CVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ) -> crate::ln::chan_utils::HolderCommitmentTransaction {
        let mut local_htlc_data = Vec::new(); for mut item in htlc_data.into_rust().drain(..) { local_htlc_data.push( { let (mut orig_htlc_data_0_0, mut orig_htlc_data_0_1) = item.to_rust(); let mut local_orig_htlc_data_0_1 = if orig_htlc_data_0_1.is_null() { None } else { Some( { orig_htlc_data_0_1.into_rust() }) }; let mut local_htlc_data_0 = (*unsafe { Box::from_raw(orig_htlc_data_0_0.take_ptr()) }, local_orig_htlc_data_0_1); local_htlc_data_0 }); };
-       let mut ret = lightning::ln::chan_utils::HolderCommitmentTransaction::new_missing_holder_sig(::bitcoin::consensus::encode::deserialize(&unsigned_tx.into_rust()[..]).unwrap(), counterparty_sig.into_rust(), &holder_funding_key.into_rust(), &counterparty_funding_key.into_rust(), *unsafe { Box::from_raw(keys.take_ptr()) }, feerate_per_kw, local_htlc_data);
+       let mut ret = lightning::ln::chan_utils::HolderCommitmentTransaction::new_missing_holder_sig(unsigned_tx.into_bitcoin(), counterparty_sig.into_rust(), &holder_funding_key.into_rust(), &counterparty_funding_key.into_rust(), *unsafe { Box::from_raw(keys.take_ptr()) }, feerate_per_kw, local_htlc_data);
        crate::ln::chan_utils::HolderCommitmentTransaction { inner: Box::into_raw(Box::new(ret)), is_owned: true }
 }
 
@@ -728,7 +728,7 @@ pub extern "C" fn HolderCommitmentTransaction_txid(this_arg: &HolderCommitmentTr
 /// Channel value is amount locked in funding_outpoint.
 #[must_use]
 #[no_mangle]
-pub extern "C" fn HolderCommitmentTransaction_get_holder_sig(this_arg: &HolderCommitmentTransaction, funding_key: *const [u8; 32], funding_redeemscript: crate::c_types::u8slice, mut channel_value_satoshis: u64) -> crate::c_types::Signature {
+pub extern "C" fn HolderCommitmentTransaction_get_holder_sig(this_arg: &HolderCommitmentTransaction, funding_key: *const [u8; 32], mut funding_redeemscript: crate::c_types::u8slice, mut channel_value_satoshis: u64) -> crate::c_types::Signature {
        let mut ret = unsafe { &*this_arg.inner }.get_holder_sig(&::bitcoin::secp256k1::key::SecretKey::from_slice(&unsafe { *funding_key}[..]).unwrap(), &::bitcoin::blockdata::script::Script::from(Vec::from(funding_redeemscript.to_slice())), channel_value_satoshis, &bitcoin::secp256k1::Secp256k1::new());
        crate::c_types::Signature::from_rust(&ret)
 }
index c71305904c71f0a809a58b182cb5d02c388e8aef..9d2de5b7d773359fd385b320d68801a20c1d11b4 100644 (file)
@@ -7,6 +7,7 @@
 //! It does not manage routing logic (see routing::router::get_route for that) nor does it manage constructing
 //! on-chain transactions (it only monitors the chain to watch for any force-closes that might
 //! imply it needs to fail HTLCs/payments/channels it manages).
+//!
 
 use std::ffi::c_void;
 use bitcoin::hashes::Hash;
@@ -14,7 +15,7 @@ use crate::c_types::*;
 
 
 use lightning::ln::channelmanager::ChannelManager as nativeChannelManagerImport;
-type nativeChannelManager = nativeChannelManagerImport<crate::chain::keysinterface::ChannelKeys, crate::ln::channelmonitor::ManyChannelMonitor, crate::chain::chaininterface::BroadcasterInterface, crate::chain::keysinterface::KeysInterface, crate::chain::chaininterface::FeeEstimator, crate::util::logger::Logger>;
+type nativeChannelManager = nativeChannelManagerImport<crate::chain::keysinterface::ChannelKeys, crate::chain::Watch, crate::chain::chaininterface::BroadcasterInterface, crate::chain::keysinterface::KeysInterface, crate::chain::chaininterface::FeeEstimator, crate::util::logger::Logger>;
 
 /// Manager which keeps track of a number of channels and sends messages to the appropriate
 /// channel, also tracking HTLC preimages and forwarding onion packets appropriately.
@@ -29,7 +30,7 @@ type nativeChannelManager = nativeChannelManagerImport<crate::chain::keysinterfa
 ///
 /// Note that you can be a bit lazier about writing out ChannelManager than you can be with
 /// ChannelMonitors. With ChannelMonitors you MUST write each monitor update out to disk before
-/// returning from ManyChannelMonitor::add_/update_monitor, with ChannelManagers, writing updates
+/// returning from chain::Watch::watch_/update_channel, with ChannelManagers, writing updates
 /// happens out-of-band (and will prevent any other ChannelManager operations from occurring during
 /// the serialization process). If the deserialized version is out-of-date compared to the
 /// ChannelMonitors passed by reference to read(), those channels will be force-closed based on the
@@ -291,14 +292,10 @@ impl PaymentSendFailure {
 ///
 /// Users need to notify the new ChannelManager when a new block is connected or
 /// disconnected using its `block_connected` and `block_disconnected` methods.
-/// However, rather than calling these methods directly, the user should register
-/// the ChannelManager as a listener to the BlockNotifier and call the BlockNotifier's
-/// `block_(dis)connected` methods, which will notify all registered listeners in one
-/// go.
 #[must_use]
 #[no_mangle]
-pub extern "C" fn ChannelManager_new(mut network: crate::bitcoin::network::Network, mut fee_est: crate::chain::chaininterface::FeeEstimator, mut monitor: crate::ln::channelmonitor::ManyChannelMonitor, mut tx_broadcaster: crate::chain::chaininterface::BroadcasterInterface, mut logger: crate::util::logger::Logger, mut keys_manager: crate::chain::keysinterface::KeysInterface, mut config: crate::util::config::UserConfig, mut current_blockchain_height: usize) -> ChannelManager {
-       let mut ret = lightning::ln::channelmanager::ChannelManager::new(network.into_bitcoin(), fee_est, monitor, tx_broadcaster, logger, keys_manager, *unsafe { Box::from_raw(config.take_ptr()) }, current_blockchain_height);
+pub extern "C" fn ChannelManager_new(mut network: crate::bitcoin::network::Network, mut fee_est: crate::chain::chaininterface::FeeEstimator, mut chain_monitor: crate::chain::Watch, mut tx_broadcaster: crate::chain::chaininterface::BroadcasterInterface, mut logger: crate::util::logger::Logger, mut keys_manager: crate::chain::keysinterface::KeysInterface, mut config: crate::util::config::UserConfig, mut current_blockchain_height: usize) -> ChannelManager {
+       let mut ret = lightning::ln::channelmanager::ChannelManager::new(network.into_bitcoin(), fee_est, chain_monitor, tx_broadcaster, logger, keys_manager, *unsafe { Box::from_raw(config.take_ptr()) }, current_blockchain_height);
        ChannelManager { inner: Box::into_raw(Box::new(ret)), is_owned: true }
 }
 
@@ -414,7 +411,7 @@ pub extern "C" fn ChannelManager_force_close_all_channels(this_arg: &ChannelMana
 /// we assume the invoice had the basic_mpp feature set.
 #[must_use]
 #[no_mangle]
-pub extern "C" fn ChannelManager_send_payment(this_arg: &ChannelManager, route: &crate::routing::router::Route, mut payment_hash: crate::c_types::ThirtyTwoBytes, payment_secret: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_NonePaymentSendFailureZ {
+pub extern "C" fn ChannelManager_send_payment(this_arg: &ChannelManager, route: &crate::routing::router::Route, mut payment_hash: crate::c_types::ThirtyTwoBytes, mut payment_secret: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_NonePaymentSendFailureZ {
        let mut local_payment_secret = if payment_secret.data == [0; 32] { None } else { Some( { ::lightning::ln::channelmanager::PaymentSecret(payment_secret.data) }) };
        let mut ret = unsafe { &*this_arg.inner }.send_payment(unsafe { &*route.inner }, ::lightning::ln::channelmanager::PaymentHash(payment_hash.data), &local_payment_secret);
        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::ln::channelmanager::PaymentSendFailure { inner: Box::into_raw(Box::new(e)), is_owned: true } }) };
@@ -480,7 +477,7 @@ pub extern "C" fn ChannelManager_timer_chan_freshness_every_min(this_arg: &Chann
 /// HTLC backwards has been started.
 #[must_use]
 #[no_mangle]
-pub extern "C" fn ChannelManager_fail_htlc_backwards(this_arg: &ChannelManager, payment_hash: *const [u8; 32], payment_secret: crate::c_types::ThirtyTwoBytes) -> bool {
+pub extern "C" fn ChannelManager_fail_htlc_backwards(this_arg: &ChannelManager, payment_hash: *const [u8; 32], mut payment_secret: crate::c_types::ThirtyTwoBytes) -> bool {
        let mut local_payment_secret = if payment_secret.data == [0; 32] { None } else { Some( { ::lightning::ln::channelmanager::PaymentSecret(payment_secret.data) }) };
        let mut ret = unsafe { &*this_arg.inner }.fail_htlc_backwards(&::lightning::ln::channelmanager::PaymentHash(unsafe { *payment_hash }), &local_payment_secret);
        ret
@@ -503,7 +500,7 @@ pub extern "C" fn ChannelManager_fail_htlc_backwards(this_arg: &ChannelManager,
 /// May panic if called except in response to a PaymentReceived event.
 #[must_use]
 #[no_mangle]
-pub extern "C" fn ChannelManager_claim_funds(this_arg: &ChannelManager, mut payment_preimage: crate::c_types::ThirtyTwoBytes, payment_secret: crate::c_types::ThirtyTwoBytes, mut expected_amount: u64) -> bool {
+pub extern "C" fn ChannelManager_claim_funds(this_arg: &ChannelManager, mut payment_preimage: crate::c_types::ThirtyTwoBytes, mut payment_secret: crate::c_types::ThirtyTwoBytes, mut expected_amount: u64) -> bool {
        let mut local_payment_secret = if payment_secret.data == [0; 32] { None } else { Some( { ::lightning::ln::channelmanager::PaymentSecret(payment_secret.data) }) };
        let mut ret = unsafe { &*this_arg.inner }.claim_funds(::lightning::ln::channelmanager::PaymentPreimage(payment_preimage.data), &local_payment_secret, expected_amount);
        ret
@@ -530,7 +527,7 @@ pub extern "C" fn ChannelManager_get_our_node_id(this_arg: &ChannelManager) -> c
 /// exists largely only to prevent races between this and concurrent update_monitor calls.
 ///
 /// Thus, the anticipated use is, at a high level:
-///  1) You register a ManyChannelMonitor with this ChannelManager,
+///  1) You register a chain::Watch with this ChannelManager,
 ///  2) it stores each update to disk, and begins updating any remote (eg watchtower) copies of
 ///     said ChannelMonitors as it can, returning ChannelMonitorUpdateErr::TemporaryFailures
 ///     any time it cannot do so instantly,
@@ -574,22 +571,20 @@ extern "C" fn ChannelManager_EventsProvider_get_and_clear_pending_events(this_ar
        local_ret.into()
 }
 
+/// Updates channel state based on transactions seen in a connected block.
 #[no_mangle]
-pub extern "C" fn ChannelManager_as_ChainListener(this_arg: *const ChannelManager) -> crate::chain::chaininterface::ChainListener {
-       crate::chain::chaininterface::ChainListener {
-               this_arg: unsafe { (*this_arg).inner as *mut c_void },
-               free: None,
-               block_connected: ChannelManager_ChainListener_block_connected,
-               block_disconnected: ChannelManager_ChainListener_block_disconnected,
-       }
+pub extern "C" fn ChannelManager_block_connected(this_arg: &ChannelManager, header: *const [u8; 80], mut txdata: crate::c_types::derived::CVec_C2Tuple_usizeTransactionZZ, mut height: u32) {
+       let mut local_txdata = Vec::new(); for mut item in txdata.into_rust().drain(..) { local_txdata.push( { let (mut orig_txdata_0_0, mut orig_txdata_0_1) = item.to_rust(); let mut local_txdata_0 = (orig_txdata_0_0, orig_txdata_0_1.into_bitcoin()); local_txdata_0 }); };
+       unsafe { &*this_arg.inner }.block_connected(&::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), &local_txdata.iter().map(|(a, b)| (*a, b)).collect::<Vec<_>>()[..], height)
 }
-use lightning::chain::chaininterface::ChainListener as ChainListenerTraitImport;
-extern "C" fn ChannelManager_ChainListener_block_connected(this_arg: *const c_void, header: *const [u8; 80], mut height: u32, mut txn_matched: crate::c_types::derived::CVec_TransactionZ, mut indexes_of_txn_matched: crate::c_types::usizeslice) {
-       let mut local_txn_matched = Vec::new(); for mut item in txn_matched.into_rust().drain(..) { local_txn_matched.push( { ::bitcoin::consensus::encode::deserialize(&item.into_rust()[..]).unwrap() }); };
-       unsafe { &mut *(this_arg as *mut nativeChannelManager) }.block_connected(&::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), height, &local_txn_matched.iter().collect::<Vec<_>>()[..], indexes_of_txn_matched.to_slice())
-}
-extern "C" fn ChannelManager_ChainListener_block_disconnected(this_arg: *const c_void, header: *const [u8; 80], unused_0: u32) {
-       unsafe { &mut *(this_arg as *mut nativeChannelManager) }.block_disconnected(&::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), unused_0)
+
+/// Updates channel state based on a disconnected block.
+///
+/// If necessary, the channel may be force-closed without letting the counterparty participate
+/// in the shutdown.
+#[no_mangle]
+pub extern "C" fn ChannelManager_block_disconnected(this_arg: &ChannelManager, header: *const [u8; 80]) {
+       unsafe { &*this_arg.inner }.block_disconnected(&::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap())
 }
 
 #[no_mangle]
@@ -624,61 +619,61 @@ pub extern "C" fn ChannelManager_as_ChannelMessageHandler(this_arg: *const Chann
        }
 }
 use lightning::ln::msgs::ChannelMessageHandler as ChannelMessageHandlerTraitImport;
-extern "C" fn ChannelManager_ChannelMessageHandler_handle_open_channel(this_arg: *const c_void, counterparty_node_id: crate::c_types::PublicKey, mut their_features: crate::ln::features::InitFeatures, msg: &crate::ln::msgs::OpenChannel) {
+extern "C" fn ChannelManager_ChannelMessageHandler_handle_open_channel(this_arg: *const c_void, mut counterparty_node_id: crate::c_types::PublicKey, mut their_features: crate::ln::features::InitFeatures, msg: &crate::ln::msgs::OpenChannel) {
        unsafe { &mut *(this_arg as *mut nativeChannelManager) }.handle_open_channel(&counterparty_node_id.into_rust(), *unsafe { Box::from_raw(their_features.take_ptr()) }, unsafe { &*msg.inner })
 }
-extern "C" fn ChannelManager_ChannelMessageHandler_handle_accept_channel(this_arg: *const c_void, counterparty_node_id: crate::c_types::PublicKey, mut their_features: crate::ln::features::InitFeatures, msg: &crate::ln::msgs::AcceptChannel) {
+extern "C" fn ChannelManager_ChannelMessageHandler_handle_accept_channel(this_arg: *const c_void, mut counterparty_node_id: crate::c_types::PublicKey, mut their_features: crate::ln::features::InitFeatures, msg: &crate::ln::msgs::AcceptChannel) {
        unsafe { &mut *(this_arg as *mut nativeChannelManager) }.handle_accept_channel(&counterparty_node_id.into_rust(), *unsafe { Box::from_raw(their_features.take_ptr()) }, unsafe { &*msg.inner })
 }
-extern "C" fn ChannelManager_ChannelMessageHandler_handle_funding_created(this_arg: *const c_void, counterparty_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::FundingCreated) {
+extern "C" fn ChannelManager_ChannelMessageHandler_handle_funding_created(this_arg: *const c_void, mut counterparty_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::FundingCreated) {
        unsafe { &mut *(this_arg as *mut nativeChannelManager) }.handle_funding_created(&counterparty_node_id.into_rust(), unsafe { &*msg.inner })
 }
-extern "C" fn ChannelManager_ChannelMessageHandler_handle_funding_signed(this_arg: *const c_void, counterparty_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::FundingSigned) {
+extern "C" fn ChannelManager_ChannelMessageHandler_handle_funding_signed(this_arg: *const c_void, mut counterparty_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::FundingSigned) {
        unsafe { &mut *(this_arg as *mut nativeChannelManager) }.handle_funding_signed(&counterparty_node_id.into_rust(), unsafe { &*msg.inner })
 }
-extern "C" fn ChannelManager_ChannelMessageHandler_handle_funding_locked(this_arg: *const c_void, counterparty_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::FundingLocked) {
+extern "C" fn ChannelManager_ChannelMessageHandler_handle_funding_locked(this_arg: *const c_void, mut counterparty_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::FundingLocked) {
        unsafe { &mut *(this_arg as *mut nativeChannelManager) }.handle_funding_locked(&counterparty_node_id.into_rust(), unsafe { &*msg.inner })
 }
-extern "C" fn ChannelManager_ChannelMessageHandler_handle_shutdown(this_arg: *const c_void, counterparty_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::Shutdown) {
+extern "C" fn ChannelManager_ChannelMessageHandler_handle_shutdown(this_arg: *const c_void, mut counterparty_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::Shutdown) {
        unsafe { &mut *(this_arg as *mut nativeChannelManager) }.handle_shutdown(&counterparty_node_id.into_rust(), unsafe { &*msg.inner })
 }
-extern "C" fn ChannelManager_ChannelMessageHandler_handle_closing_signed(this_arg: *const c_void, counterparty_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::ClosingSigned) {
+extern "C" fn ChannelManager_ChannelMessageHandler_handle_closing_signed(this_arg: *const c_void, mut counterparty_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::ClosingSigned) {
        unsafe { &mut *(this_arg as *mut nativeChannelManager) }.handle_closing_signed(&counterparty_node_id.into_rust(), unsafe { &*msg.inner })
 }
-extern "C" fn ChannelManager_ChannelMessageHandler_handle_update_add_htlc(this_arg: *const c_void, counterparty_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::UpdateAddHTLC) {
+extern "C" fn ChannelManager_ChannelMessageHandler_handle_update_add_htlc(this_arg: *const c_void, mut counterparty_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::UpdateAddHTLC) {
        unsafe { &mut *(this_arg as *mut nativeChannelManager) }.handle_update_add_htlc(&counterparty_node_id.into_rust(), unsafe { &*msg.inner })
 }
-extern "C" fn ChannelManager_ChannelMessageHandler_handle_update_fulfill_htlc(this_arg: *const c_void, counterparty_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::UpdateFulfillHTLC) {
+extern "C" fn ChannelManager_ChannelMessageHandler_handle_update_fulfill_htlc(this_arg: *const c_void, mut counterparty_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::UpdateFulfillHTLC) {
        unsafe { &mut *(this_arg as *mut nativeChannelManager) }.handle_update_fulfill_htlc(&counterparty_node_id.into_rust(), unsafe { &*msg.inner })
 }
-extern "C" fn ChannelManager_ChannelMessageHandler_handle_update_fail_htlc(this_arg: *const c_void, counterparty_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::UpdateFailHTLC) {
+extern "C" fn ChannelManager_ChannelMessageHandler_handle_update_fail_htlc(this_arg: *const c_void, mut counterparty_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::UpdateFailHTLC) {
        unsafe { &mut *(this_arg as *mut nativeChannelManager) }.handle_update_fail_htlc(&counterparty_node_id.into_rust(), unsafe { &*msg.inner })
 }
-extern "C" fn ChannelManager_ChannelMessageHandler_handle_update_fail_malformed_htlc(this_arg: *const c_void, counterparty_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::UpdateFailMalformedHTLC) {
+extern "C" fn ChannelManager_ChannelMessageHandler_handle_update_fail_malformed_htlc(this_arg: *const c_void, mut counterparty_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::UpdateFailMalformedHTLC) {
        unsafe { &mut *(this_arg as *mut nativeChannelManager) }.handle_update_fail_malformed_htlc(&counterparty_node_id.into_rust(), unsafe { &*msg.inner })
 }
-extern "C" fn ChannelManager_ChannelMessageHandler_handle_commitment_signed(this_arg: *const c_void, counterparty_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::CommitmentSigned) {
+extern "C" fn ChannelManager_ChannelMessageHandler_handle_commitment_signed(this_arg: *const c_void, mut counterparty_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::CommitmentSigned) {
        unsafe { &mut *(this_arg as *mut nativeChannelManager) }.handle_commitment_signed(&counterparty_node_id.into_rust(), unsafe { &*msg.inner })
 }
-extern "C" fn ChannelManager_ChannelMessageHandler_handle_revoke_and_ack(this_arg: *const c_void, counterparty_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::RevokeAndACK) {
+extern "C" fn ChannelManager_ChannelMessageHandler_handle_revoke_and_ack(this_arg: *const c_void, mut counterparty_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::RevokeAndACK) {
        unsafe { &mut *(this_arg as *mut nativeChannelManager) }.handle_revoke_and_ack(&counterparty_node_id.into_rust(), unsafe { &*msg.inner })
 }
-extern "C" fn ChannelManager_ChannelMessageHandler_handle_update_fee(this_arg: *const c_void, counterparty_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::UpdateFee) {
+extern "C" fn ChannelManager_ChannelMessageHandler_handle_update_fee(this_arg: *const c_void, mut counterparty_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::UpdateFee) {
        unsafe { &mut *(this_arg as *mut nativeChannelManager) }.handle_update_fee(&counterparty_node_id.into_rust(), unsafe { &*msg.inner })
 }
-extern "C" fn ChannelManager_ChannelMessageHandler_handle_announcement_signatures(this_arg: *const c_void, counterparty_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::AnnouncementSignatures) {
+extern "C" fn ChannelManager_ChannelMessageHandler_handle_announcement_signatures(this_arg: *const c_void, mut counterparty_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::AnnouncementSignatures) {
        unsafe { &mut *(this_arg as *mut nativeChannelManager) }.handle_announcement_signatures(&counterparty_node_id.into_rust(), unsafe { &*msg.inner })
 }
-extern "C" fn ChannelManager_ChannelMessageHandler_handle_channel_reestablish(this_arg: *const c_void, counterparty_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::ChannelReestablish) {
+extern "C" fn ChannelManager_ChannelMessageHandler_handle_channel_reestablish(this_arg: *const c_void, mut counterparty_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::ChannelReestablish) {
        unsafe { &mut *(this_arg as *mut nativeChannelManager) }.handle_channel_reestablish(&counterparty_node_id.into_rust(), unsafe { &*msg.inner })
 }
-extern "C" fn ChannelManager_ChannelMessageHandler_peer_disconnected(this_arg: *const c_void, counterparty_node_id: crate::c_types::PublicKey, mut no_connection_possible: bool) {
+extern "C" fn ChannelManager_ChannelMessageHandler_peer_disconnected(this_arg: *const c_void, mut counterparty_node_id: crate::c_types::PublicKey, mut no_connection_possible: bool) {
        unsafe { &mut *(this_arg as *mut nativeChannelManager) }.peer_disconnected(&counterparty_node_id.into_rust(), no_connection_possible)
 }
-extern "C" fn ChannelManager_ChannelMessageHandler_peer_connected(this_arg: *const c_void, counterparty_node_id: crate::c_types::PublicKey, init_msg: &crate::ln::msgs::Init) {
+extern "C" fn ChannelManager_ChannelMessageHandler_peer_connected(this_arg: *const c_void, mut counterparty_node_id: crate::c_types::PublicKey, init_msg: &crate::ln::msgs::Init) {
        unsafe { &mut *(this_arg as *mut nativeChannelManager) }.peer_connected(&counterparty_node_id.into_rust(), unsafe { &*init_msg.inner })
 }
-extern "C" fn ChannelManager_ChannelMessageHandler_handle_error(this_arg: *const c_void, counterparty_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::ErrorMessage) {
+extern "C" fn ChannelManager_ChannelMessageHandler_handle_error(this_arg: *const c_void, mut counterparty_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::ErrorMessage) {
        unsafe { &mut *(this_arg as *mut nativeChannelManager) }.handle_error(&counterparty_node_id.into_rust(), unsafe { &*msg.inner })
 }
 use lightning::util::events::MessageSendEventsProvider as nativeMessageSendEventsProviderTrait;
@@ -691,7 +686,7 @@ extern "C" fn ChannelManager_ChannelMessageHandler_get_and_clear_pending_msg_eve
 
 
 use lightning::ln::channelmanager::ChannelManagerReadArgs as nativeChannelManagerReadArgsImport;
-type nativeChannelManagerReadArgs = nativeChannelManagerReadArgsImport<'static, crate::chain::keysinterface::ChannelKeys, crate::ln::channelmonitor::ManyChannelMonitor, crate::chain::chaininterface::BroadcasterInterface, crate::chain::keysinterface::KeysInterface, crate::chain::chaininterface::FeeEstimator, crate::util::logger::Logger>;
+type nativeChannelManagerReadArgs = nativeChannelManagerReadArgsImport<'static, crate::chain::keysinterface::ChannelKeys, crate::chain::Watch, crate::chain::chaininterface::BroadcasterInterface, crate::chain::keysinterface::KeysInterface, crate::chain::chaininterface::FeeEstimator, crate::util::logger::Logger>;
 
 /// Arguments for the creation of a ChannelManager that are not deserialized.
 ///
@@ -703,11 +698,10 @@ type nativeChannelManagerReadArgs = nativeChannelManagerReadArgsImport<'static,
 ///    This may result in closing some Channels if the ChannelMonitor is newer than the stored
 ///    ChannelManager state to ensure no loss of funds. Thus, transactions may be broadcasted.
 /// 3) Register all relevant ChannelMonitor outpoints with your chain watch mechanism using
-///    ChannelMonitor::get_monitored_outpoints and ChannelMonitor::get_funding_txo().
+///    ChannelMonitor::get_outputs_to_watch() and ChannelMonitor::get_funding_txo().
 /// 4) Reconnect blocks on your ChannelMonitors.
-/// 5) Move the ChannelMonitors into your local ManyChannelMonitor.
+/// 5) Move the ChannelMonitors into your local chain::Watch.
 /// 6) Disconnect/connect blocks on the ChannelManager.
-/// 7) Register the new ChannelManager with your ChainWatchInterface.
 #[must_use]
 #[repr(C)]
 pub struct ChannelManagerReadArgs {
@@ -769,24 +763,24 @@ pub extern "C" fn ChannelManagerReadArgs_get_fee_estimator(this_ptr: &ChannelMan
 pub extern "C" fn ChannelManagerReadArgs_set_fee_estimator(this_ptr: &mut ChannelManagerReadArgs, mut val: crate::chain::chaininterface::FeeEstimator) {
        unsafe { &mut *this_ptr.inner }.fee_estimator = val;
 }
-/// The ManyChannelMonitor for use in the ChannelManager in the future.
+/// The chain::Watch for use in the ChannelManager in the future.
 ///
-/// No calls to the ManyChannelMonitor will be made during deserialization. It is assumed that
+/// No calls to the chain::Watch will be made during deserialization. It is assumed that
 /// you have deserialized ChannelMonitors separately and will add them to your
-/// ManyChannelMonitor after deserializing this ChannelManager.
+/// chain::Watch after deserializing this ChannelManager.
 #[no_mangle]
-pub extern "C" fn ChannelManagerReadArgs_get_monitor(this_ptr: &ChannelManagerReadArgs) -> *const crate::ln::channelmonitor::ManyChannelMonitor {
-       let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.monitor;
+pub extern "C" fn ChannelManagerReadArgs_get_chain_monitor(this_ptr: &ChannelManagerReadArgs) -> *const crate::chain::Watch {
+       let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.chain_monitor;
        &(*inner_val)
 }
-/// The ManyChannelMonitor for use in the ChannelManager in the future.
+/// The chain::Watch for use in the ChannelManager in the future.
 ///
-/// No calls to the ManyChannelMonitor will be made during deserialization. It is assumed that
+/// No calls to the chain::Watch will be made during deserialization. It is assumed that
 /// you have deserialized ChannelMonitors separately and will add them to your
-/// ManyChannelMonitor after deserializing this ChannelManager.
+/// chain::Watch after deserializing this ChannelManager.
 #[no_mangle]
-pub extern "C" fn ChannelManagerReadArgs_set_monitor(this_ptr: &mut ChannelManagerReadArgs, mut val: crate::ln::channelmonitor::ManyChannelMonitor) {
-       unsafe { &mut *this_ptr.inner }.monitor = val;
+pub extern "C" fn ChannelManagerReadArgs_set_chain_monitor(this_ptr: &mut ChannelManagerReadArgs, mut val: crate::chain::Watch) {
+       unsafe { &mut *this_ptr.inner }.chain_monitor = val;
 }
 /// The BroadcasterInterface which will be used in the ChannelManager in the future and may be
 /// used to broadcast the latest local commitment transactions of channels which must be
@@ -834,9 +828,9 @@ pub extern "C" fn ChannelManagerReadArgs_set_default_config(this_ptr: &mut Chann
 /// populate a HashMap directly from C.
 #[must_use]
 #[no_mangle]
-pub extern "C" fn ChannelManagerReadArgs_new(mut keys_manager: crate::chain::keysinterface::KeysInterface, mut fee_estimator: crate::chain::chaininterface::FeeEstimator, mut monitor: crate::ln::channelmonitor::ManyChannelMonitor, mut tx_broadcaster: crate::chain::chaininterface::BroadcasterInterface, mut logger: crate::util::logger::Logger, mut default_config: crate::util::config::UserConfig, mut channel_monitors: crate::c_types::derived::CVec_ChannelMonitorZ) -> ChannelManagerReadArgs {
+pub extern "C" fn ChannelManagerReadArgs_new(mut keys_manager: crate::chain::keysinterface::KeysInterface, mut fee_estimator: crate::chain::chaininterface::FeeEstimator, mut chain_monitor: crate::chain::Watch, mut tx_broadcaster: crate::chain::chaininterface::BroadcasterInterface, mut logger: crate::util::logger::Logger, mut default_config: crate::util::config::UserConfig, mut channel_monitors: crate::c_types::derived::CVec_ChannelMonitorZ) -> ChannelManagerReadArgs {
        let mut local_channel_monitors = Vec::new(); for mut item in channel_monitors.into_rust().drain(..) { local_channel_monitors.push( { unsafe { &mut *item.inner } }); };
-       let mut ret = lightning::ln::channelmanager::ChannelManagerReadArgs::new(keys_manager, fee_estimator, monitor, tx_broadcaster, logger, *unsafe { Box::from_raw(default_config.take_ptr()) }, local_channel_monitors);
+       let mut ret = lightning::ln::channelmanager::ChannelManagerReadArgs::new(keys_manager, fee_estimator, chain_monitor, tx_broadcaster, logger, *unsafe { Box::from_raw(default_config.take_ptr()) }, local_channel_monitors);
        ChannelManagerReadArgs { inner: Box::into_raw(Box::new(ret)), is_owned: true }
 }
 
diff --git a/lightning-c-bindings/src/ln/channelmonitor.rs b/lightning-c-bindings/src/ln/channelmonitor.rs
deleted file mode 100644 (file)
index 671566a..0000000
+++ /dev/null
@@ -1,563 +0,0 @@
-//! The logic to monitor for on-chain transactions and create the relevant claim responses lives
-//! here.
-//!
-//! ChannelMonitor objects are generated by ChannelManager in response to relevant
-//! messages/actions, and MUST be persisted to disk (and, preferably, remotely) before progress can
-//! be made in responding to certain messages, see ManyChannelMonitor for more.
-//!
-//! Note that ChannelMonitors are an important part of the lightning trust model and a copy of the
-//! latest ChannelMonitor must always be actively monitoring for chain updates (and no out-of-date
-//! ChannelMonitors should do so). Thus, if you're building rust-lightning into an HSM or other
-//! security-domain-separated system design, you should consider having multiple paths for
-//! ChannelMonitors to get out of the HSM and onto monitoring devices.
-
-use std::ffi::c_void;
-use bitcoin::hashes::Hash;
-use crate::c_types::*;
-
-
-use lightning::ln::channelmonitor::ChannelMonitorUpdate as nativeChannelMonitorUpdateImport;
-type nativeChannelMonitorUpdate = nativeChannelMonitorUpdateImport;
-
-/// An update generated by the underlying Channel itself which contains some new information the
-/// ChannelMonitor should be made aware of.
-#[must_use]
-#[repr(C)]
-pub struct ChannelMonitorUpdate {
-       /// Nearly everyhwere, inner must be non-null, however in places where
-       /// the Rust equivalent takes an Option, it may be set to null to indicate None.
-       pub inner: *mut nativeChannelMonitorUpdate,
-       pub is_owned: bool,
-}
-
-impl Drop for ChannelMonitorUpdate {
-       fn drop(&mut self) {
-               if self.is_owned && !self.inner.is_null() {
-                       let _ = unsafe { Box::from_raw(self.inner) };
-               }
-       }
-}
-#[no_mangle]
-pub extern "C" fn ChannelMonitorUpdate_free(this_ptr: ChannelMonitorUpdate) { }
-#[allow(unused)]
-/// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn ChannelMonitorUpdate_free_void(this_ptr: *mut c_void) {
-       unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelMonitorUpdate); }
-}
-#[allow(unused)]
-/// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
-impl ChannelMonitorUpdate {
-       pub(crate) fn take_ptr(mut self) -> *mut nativeChannelMonitorUpdate {
-               assert!(self.is_owned);
-               let ret = self.inner;
-               self.inner = std::ptr::null_mut();
-               ret
-       }
-}
-impl Clone for ChannelMonitorUpdate {
-       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 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
-}
-/// 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.
-///
-/// 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.
-#[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;
-       (*inner_val)
-}
-/// 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.
-///
-/// 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.
-#[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 extern "C" fn ChannelMonitorUpdate_write(obj: *const ChannelMonitorUpdate) -> crate::c_types::derived::CVec_u8Z {
-       crate::c_types::serialize_obj(unsafe { &(*(*obj).inner) })
-}
-#[no_mangle]
-pub extern "C" fn ChannelMonitorUpdate_read(ser: crate::c_types::u8slice) -> ChannelMonitorUpdate {
-       if let Ok(res) = crate::c_types::deserialize_obj(ser) {
-               ChannelMonitorUpdate { inner: Box::into_raw(Box::new(res)), is_owned: true }
-       } else {
-               ChannelMonitorUpdate { inner: std::ptr::null_mut(), is_owned: true }
-       }
-}
-/// An error enum representing a failure to persist a channel monitor update.
-#[must_use]
-#[derive(Clone)]
-#[repr(C)]
-pub enum ChannelMonitorUpdateErr {
-       /// Used to indicate a temporary failure (eg connection to a watchtower or remote backup of
-       /// our state failed, but is expected to succeed at some point in the future).
-       ///
-       /// Such a failure will \"freeze\" a channel, preventing us from revoking old states or
-       /// submitting new commitment transactions to the counterparty. Once the update(s) which failed
-       /// have been successfully applied, ChannelManager::channel_monitor_updated can be used to
-       /// restore the channel to an operational state.
-       ///
-       /// Note that a given ChannelManager will *never* re-generate a given ChannelMonitorUpdate. If
-       /// you return a TemporaryFailure you must ensure that it is written to disk safely before
-       /// writing out the latest ChannelManager state.
-       ///
-       /// Even when a channel has been \"frozen\" updates to the ChannelMonitor can continue to occur
-       /// (eg if an inbound HTLC which we forwarded was claimed upstream resulting in us attempting
-       /// to claim it on this channel) and those updates must be applied wherever they can be. At
-       /// least one such updated ChannelMonitor must be persisted otherwise PermanentFailure should
-       /// be returned to get things on-chain ASAP using only the in-memory copy. Obviously updates to
-       /// the channel which would invalidate previous ChannelMonitors are not made when a channel has
-       /// been \"frozen\".
-       ///
-       /// Note that even if updates made after TemporaryFailure succeed you must still call
-       /// channel_monitor_updated to ensure you have the latest monitor and re-enable normal channel
-       /// operation.
-       ///
-       /// Note that the update being processed here will not be replayed for you when you call
-       /// ChannelManager::channel_monitor_updated, so you must store the update itself along
-       /// with the persisted ChannelMonitor on your own local disk prior to returning a
-       /// TemporaryFailure. You may, of course, employ a journaling approach, storing only the
-       /// ChannelMonitorUpdate on disk without updating the monitor itself, replaying the journal at
-       /// reload-time.
-       ///
-       /// For deployments where a copy of ChannelMonitors and other local state are backed up in a
-       /// remote location (with local copies persisted immediately), it is anticipated that all
-       /// updates will return TemporaryFailure until the remote copies could be updated.
-       TemporaryFailure,
-       /// Used to indicate no further channel monitor updates will be allowed (eg we've moved on to a
-       /// different watchtower and cannot update with all watchtowers that were previously informed
-       /// of this channel).
-       ///
-       /// At reception of this error, ChannelManager will force-close the channel and return at
-       /// least a final ChannelMonitorUpdate::ChannelForceClosed which must be delivered to at
-       /// least one ChannelMonitor copy. Revocation secret MUST NOT be released and offchain channel
-       /// update must be rejected.
-       ///
-       /// This failure may also signal a failure to update the local persisted copy of one of
-       /// the channel monitor instance.
-       ///
-       /// Note that even when you fail a holder commitment transaction update, you must store the
-       /// update to ensure you can claim from it in case of a duplicate copy of this ChannelMonitor
-       /// broadcasts it (e.g distributed channel-monitor deployment)
-       PermanentFailure,
-}
-use lightning::ln::channelmonitor::ChannelMonitorUpdateErr as nativeChannelMonitorUpdateErr;
-impl ChannelMonitorUpdateErr {
-       #[allow(unused)]
-       pub(crate) fn to_native(&self) -> nativeChannelMonitorUpdateErr {
-               match self {
-                       ChannelMonitorUpdateErr::TemporaryFailure => nativeChannelMonitorUpdateErr::TemporaryFailure,
-                       ChannelMonitorUpdateErr::PermanentFailure => nativeChannelMonitorUpdateErr::PermanentFailure,
-               }
-       }
-       #[allow(unused)]
-       pub(crate) fn into_native(self) -> nativeChannelMonitorUpdateErr {
-               match self {
-                       ChannelMonitorUpdateErr::TemporaryFailure => nativeChannelMonitorUpdateErr::TemporaryFailure,
-                       ChannelMonitorUpdateErr::PermanentFailure => nativeChannelMonitorUpdateErr::PermanentFailure,
-               }
-       }
-       #[allow(unused)]
-       pub(crate) fn from_native(native: &nativeChannelMonitorUpdateErr) -> Self {
-               match native {
-                       nativeChannelMonitorUpdateErr::TemporaryFailure => ChannelMonitorUpdateErr::TemporaryFailure,
-                       nativeChannelMonitorUpdateErr::PermanentFailure => ChannelMonitorUpdateErr::PermanentFailure,
-               }
-       }
-       #[allow(unused)]
-       pub(crate) fn native_into(native: nativeChannelMonitorUpdateErr) -> Self {
-               match native {
-                       nativeChannelMonitorUpdateErr::TemporaryFailure => ChannelMonitorUpdateErr::TemporaryFailure,
-                       nativeChannelMonitorUpdateErr::PermanentFailure => ChannelMonitorUpdateErr::PermanentFailure,
-               }
-       }
-}
-
-use lightning::ln::channelmonitor::MonitorUpdateError as nativeMonitorUpdateErrorImport;
-type nativeMonitorUpdateError = nativeMonitorUpdateErrorImport;
-
-/// General Err type for ChannelMonitor actions. Generally, this implies that the data provided is
-/// inconsistent with the ChannelMonitor being called. eg for ChannelMonitor::update_monitor this
-/// means you tried to update a monitor for a different channel or the ChannelMonitorUpdate was
-/// corrupted.
-/// Contains a human-readable error message.
-#[must_use]
-#[repr(C)]
-pub struct MonitorUpdateError {
-       /// Nearly everyhwere, inner must be non-null, however in places where
-       /// the Rust equivalent takes an Option, it may be set to null to indicate None.
-       pub inner: *mut nativeMonitorUpdateError,
-       pub is_owned: bool,
-}
-
-impl Drop for MonitorUpdateError {
-       fn drop(&mut self) {
-               if self.is_owned && !self.inner.is_null() {
-                       let _ = unsafe { Box::from_raw(self.inner) };
-               }
-       }
-}
-#[no_mangle]
-pub extern "C" fn MonitorUpdateError_free(this_ptr: MonitorUpdateError) { }
-#[allow(unused)]
-/// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn MonitorUpdateError_free_void(this_ptr: *mut c_void) {
-       unsafe { let _ = Box::from_raw(this_ptr as *mut nativeMonitorUpdateError); }
-}
-#[allow(unused)]
-/// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
-impl MonitorUpdateError {
-       pub(crate) fn take_ptr(mut self) -> *mut nativeMonitorUpdateError {
-               assert!(self.is_owned);
-               let ret = self.inner;
-               self.inner = std::ptr::null_mut();
-               ret
-       }
-}
-
-use lightning::ln::channelmonitor::MonitorEvent as nativeMonitorEventImport;
-type nativeMonitorEvent = nativeMonitorEventImport;
-
-/// An event to be processed by the ChannelManager.
-#[must_use]
-#[repr(C)]
-pub struct MonitorEvent {
-       /// Nearly everyhwere, inner must be non-null, however in places where
-       /// the Rust equivalent takes an Option, it may be set to null to indicate None.
-       pub inner: *mut nativeMonitorEvent,
-       pub is_owned: bool,
-}
-
-impl Drop for MonitorEvent {
-       fn drop(&mut self) {
-               if self.is_owned && !self.inner.is_null() {
-                       let _ = unsafe { Box::from_raw(self.inner) };
-               }
-       }
-}
-#[no_mangle]
-pub extern "C" fn MonitorEvent_free(this_ptr: MonitorEvent) { }
-#[allow(unused)]
-/// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn MonitorEvent_free_void(this_ptr: *mut c_void) {
-       unsafe { let _ = Box::from_raw(this_ptr as *mut nativeMonitorEvent); }
-}
-#[allow(unused)]
-/// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
-impl MonitorEvent {
-       pub(crate) fn take_ptr(mut self) -> *mut nativeMonitorEvent {
-               assert!(self.is_owned);
-               let ret = self.inner;
-               self.inner = std::ptr::null_mut();
-               ret
-       }
-}
-
-use lightning::ln::channelmonitor::HTLCUpdate as nativeHTLCUpdateImport;
-type nativeHTLCUpdate = nativeHTLCUpdateImport;
-
-/// Simple structure send back by ManyChannelMonitor in case of HTLC detected onchain from a
-/// forward channel and from which info are needed to update HTLC in a backward channel.
-#[must_use]
-#[repr(C)]
-pub struct HTLCUpdate {
-       /// Nearly everyhwere, inner must be non-null, however in places where
-       /// the Rust equivalent takes an Option, it may be set to null to indicate None.
-       pub inner: *mut nativeHTLCUpdate,
-       pub is_owned: bool,
-}
-
-impl Drop for HTLCUpdate {
-       fn drop(&mut self) {
-               if self.is_owned && !self.inner.is_null() {
-                       let _ = unsafe { Box::from_raw(self.inner) };
-               }
-       }
-}
-#[no_mangle]
-pub extern "C" fn HTLCUpdate_free(this_ptr: HTLCUpdate) { }
-#[allow(unused)]
-/// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn HTLCUpdate_free_void(this_ptr: *mut c_void) {
-       unsafe { let _ = Box::from_raw(this_ptr as *mut nativeHTLCUpdate); }
-}
-#[allow(unused)]
-/// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
-impl HTLCUpdate {
-       pub(crate) fn take_ptr(mut self) -> *mut nativeHTLCUpdate {
-               assert!(self.is_owned);
-               let ret = self.inner;
-               self.inner = std::ptr::null_mut();
-               ret
-       }
-}
-impl Clone for HTLCUpdate {
-       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 HTLCUpdate_clone_void(this_ptr: *const c_void) -> *mut c_void {
-       Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeHTLCUpdate)).clone() })) as *mut c_void
-}
-#[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) })
-}
-#[no_mangle]
-pub extern "C" fn HTLCUpdate_read(ser: crate::c_types::u8slice) -> HTLCUpdate {
-       if let Ok(res) = crate::c_types::deserialize_obj(ser) {
-               HTLCUpdate { inner: Box::into_raw(Box::new(res)), is_owned: true }
-       } else {
-               HTLCUpdate { inner: std::ptr::null_mut(), is_owned: true }
-       }
-}
-
-use lightning::ln::channelmonitor::ChannelMonitor as nativeChannelMonitorImport;
-type nativeChannelMonitor = nativeChannelMonitorImport<crate::chain::keysinterface::ChannelKeys>;
-
-/// A ChannelMonitor handles chain events (blocks connected and disconnected) and generates
-/// on-chain transactions to ensure no loss of funds occurs.
-///
-/// You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date
-/// information and are actively monitoring the chain.
-///
-/// Pending Events or updated HTLCs which have not yet been read out by
-/// get_and_clear_pending_monitor_events or get_and_clear_pending_events are serialized to disk and
-/// reloaded at deserialize-time. Thus, you must ensure that, when handling events, all events
-/// gotten are fully handled before re-serializing the new state.
-#[must_use]
-#[repr(C)]
-pub struct ChannelMonitor {
-       /// Nearly everyhwere, inner must be non-null, however in places where
-       /// the Rust equivalent takes an Option, it may be set to null to indicate None.
-       pub inner: *mut nativeChannelMonitor,
-       pub is_owned: bool,
-}
-
-impl Drop for ChannelMonitor {
-       fn drop(&mut self) {
-               if self.is_owned && !self.inner.is_null() {
-                       let _ = unsafe { Box::from_raw(self.inner) };
-               }
-       }
-}
-#[no_mangle]
-pub extern "C" fn ChannelMonitor_free(this_ptr: ChannelMonitor) { }
-#[allow(unused)]
-/// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn ChannelMonitor_free_void(this_ptr: *mut c_void) {
-       unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelMonitor); }
-}
-#[allow(unused)]
-/// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
-impl ChannelMonitor {
-       pub(crate) fn take_ptr(mut self) -> *mut nativeChannelMonitor {
-               assert!(self.is_owned);
-               let ret = self.inner;
-               self.inner = std::ptr::null_mut();
-               ret
-       }
-}
-/// Simple trait indicating ability to track a set of ChannelMonitors and multiplex events between
-/// them. Generally should be implemented by keeping a local SimpleManyChannelMonitor and passing
-/// events to it, while also taking any add/update_monitor events and passing them to some remote
-/// server(s).
-///
-/// In general, you must always have at least one local copy in memory, which must never fail to
-/// update (as it is responsible for broadcasting the latest state in case the channel is closed),
-/// and then persist it to various on-disk locations. If, for some reason, the in-memory copy fails
-/// to update (eg out-of-memory or some other condition), you must immediately shut down without
-/// taking any further action such as writing the current state to disk. This should likely be
-/// accomplished via panic!() or abort().
-///
-/// Note that any updates to a channel's monitor *must* be applied to each instance of the
-/// channel's monitor everywhere (including remote watchtowers) *before* this function returns. If
-/// an update occurs and a remote watchtower is left with old state, it may broadcast transactions
-/// which we have revoked, allowing our counterparty to claim all funds in the channel!
-///
-/// User needs to notify implementors of ManyChannelMonitor when a new block is connected or
-/// disconnected using their `block_connected` and `block_disconnected` methods. However, rather
-/// than calling these methods directly, the user should register implementors as listeners to the
-/// BlockNotifier and call the BlockNotifier's `block_(dis)connected` methods, which will notify
-/// all registered listeners in one go.
-#[repr(C)]
-pub struct ManyChannelMonitor {
-       pub this_arg: *mut c_void,
-       /// Adds a monitor for the given `funding_txo`.
-       ///
-       /// Implementer must also ensure that the funding_txo txid *and* outpoint are registered with
-       /// any relevant ChainWatchInterfaces such that the provided monitor receives block_connected
-       /// callbacks with the funding transaction, or any spends of it.
-       ///
-       /// Further, the implementer must also ensure that each output returned in
-       /// monitor.get_outputs_to_watch() is registered to ensure that the provided monitor learns about
-       /// any spends of any of the outputs.
-       ///
-       /// Any spends of outputs which should have been registered which aren't passed to
-       /// ChannelMonitors via block_connected may result in FUNDS LOSS.
-       #[must_use]
-       pub add_monitor: extern "C" fn (this_arg: *const c_void, funding_txo: crate::chain::transaction::OutPoint, monitor: crate::ln::channelmonitor::ChannelMonitor) -> crate::c_types::derived::CResult_NoneChannelMonitorUpdateErrZ,
-       /// Updates a monitor for the given `funding_txo`.
-       ///
-       /// Implementer must also ensure that the funding_txo txid *and* outpoint are registered with
-       /// any relevant ChainWatchInterfaces such that the provided monitor receives block_connected
-       /// callbacks with the funding transaction, or any spends of it.
-       ///
-       /// Further, the implementer must also ensure that each output returned in
-       /// monitor.get_watch_outputs() is registered to ensure that the provided monitor learns about
-       /// any spends of any of the outputs.
-       ///
-       /// Any spends of outputs which should have been registered which aren't passed to
-       /// ChannelMonitors via block_connected may result in FUNDS LOSS.
-       ///
-       /// In case of distributed watchtowers deployment, even if an Err is return, the new version
-       /// must be written to disk, as state may have been stored but rejected due to a block forcing
-       /// a commitment broadcast. This storage is used to claim outputs of rejected state confirmed
-       /// onchain by another watchtower, lagging behind on block processing.
-       #[must_use]
-       pub update_monitor: extern "C" fn (this_arg: *const c_void, funding_txo: crate::chain::transaction::OutPoint, monitor: crate::ln::channelmonitor::ChannelMonitorUpdate) -> crate::c_types::derived::CResult_NoneChannelMonitorUpdateErrZ,
-       /// Used by ChannelManager to get list of HTLC resolved onchain and which needed to be updated
-       /// with success or failure.
-       ///
-       /// You should probably just call through to
-       /// ChannelMonitor::get_and_clear_pending_monitor_events() for each ChannelMonitor and return
-       /// the full list.
-       #[must_use]
-       pub get_and_clear_pending_monitor_events: extern "C" fn (this_arg: *const c_void) -> crate::c_types::derived::CVec_MonitorEventZ,
-       pub free: Option<extern "C" fn(this_arg: *mut c_void)>,
-}
-unsafe impl Send for ManyChannelMonitor {}
-unsafe impl Sync for ManyChannelMonitor {}
-
-use lightning::ln::channelmonitor::ManyChannelMonitor as rustManyChannelMonitor;
-impl rustManyChannelMonitor for ManyChannelMonitor {
-       type Keys = crate::chain::keysinterface::ChannelKeys;
-       fn add_monitor(&self, funding_txo: lightning::chain::transaction::OutPoint, monitor: lightning::ln::channelmonitor::ChannelMonitor<Self::Keys>) -> Result<(), lightning::ln::channelmonitor::ChannelMonitorUpdateErr> {
-               let mut ret = (self.add_monitor)(self.this_arg, crate::chain::transaction::OutPoint { inner: Box::into_raw(Box::new(funding_txo)), is_owned: true }, crate::ln::channelmonitor::ChannelMonitor { inner: Box::into_raw(Box::new(monitor)), is_owned: true });
-               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_monitor(&self, funding_txo: lightning::chain::transaction::OutPoint, monitor: lightning::ln::channelmonitor::ChannelMonitorUpdate) -> Result<(), lightning::ln::channelmonitor::ChannelMonitorUpdateErr> {
-               let mut ret = (self.update_monitor)(self.this_arg, crate::chain::transaction::OutPoint { inner: Box::into_raw(Box::new(funding_txo)), is_owned: true }, crate::ln::channelmonitor::ChannelMonitorUpdate { inner: Box::into_raw(Box::new(monitor)), is_owned: true });
-               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 get_and_clear_pending_monitor_events(&self) -> Vec<lightning::ln::channelmonitor::MonitorEvent> {
-               let mut ret = (self.get_and_clear_pending_monitor_events)(self.this_arg);
-               let mut local_ret = Vec::new(); for mut item in ret.into_rust().drain(..) { local_ret.push( { *unsafe { Box::from_raw(item.take_ptr()) } }); };
-               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 ManyChannelMonitor {
-       type Target = Self;
-       fn deref(&self) -> &Self {
-               self
-       }
-}
-/// Calls the free function if one is set
-#[no_mangle]
-pub extern "C" fn ManyChannelMonitor_free(this_ptr: ManyChannelMonitor) { }
-impl Drop for ManyChannelMonitor {
-       fn drop(&mut self) {
-               if let Some(f) = self.free {
-                       f(self.this_arg);
-               }
-       }
-}
-/// Updates a ChannelMonitor on the basis of some new information provided by the Channel
-/// itself.
-///
-/// 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::ln::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);
-       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::ln::channelmonitor::MonitorUpdateError { inner: Box::into_raw(Box::new(e)), is_owned: true } }) };
-       local_ret
-}
-
-/// Gets the update_id from the latest ChannelMonitorUpdate which was applied to this
-/// ChannelMonitor.
-#[must_use]
-#[no_mangle]
-pub extern "C" fn ChannelMonitor_get_latest_update_id(this_arg: &ChannelMonitor) -> u64 {
-       let mut ret = unsafe { &*this_arg.inner }.get_latest_update_id();
-       ret
-}
-
-/// Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for.
-#[must_use]
-#[no_mangle]
-pub extern "C" fn ChannelMonitor_get_funding_txo(this_arg: &ChannelMonitor) -> crate::c_types::derived::C2Tuple_OutPointScriptZ {
-       let mut ret = unsafe { &*this_arg.inner }.get_funding_txo();
-       let (ref orig_ret_0, ref orig_ret_1) = ret; let mut local_ret = (crate::chain::transaction::OutPoint { inner: unsafe { ( (&(*orig_ret_0) as *const _) as *mut _) }, is_owned: false }, orig_ret_1.clone().into_bytes().into()).into();
-       local_ret
-}
-
-/// Get the list of HTLCs who's status has been updated on chain. This should be called by
-/// ChannelManager via ManyChannelMonitor::get_and_clear_pending_monitor_events().
-#[must_use]
-#[no_mangle]
-pub extern "C" fn ChannelMonitor_get_and_clear_pending_monitor_events(this_arg: &mut ChannelMonitor) -> crate::c_types::derived::CVec_MonitorEventZ {
-       let mut ret = unsafe { &mut (*(this_arg.inner as *mut nativeChannelMonitor)) }.get_and_clear_pending_monitor_events();
-       let mut local_ret = Vec::new(); for item in ret.drain(..) { local_ret.push( { crate::ln::channelmonitor::MonitorEvent { inner: Box::into_raw(Box::new(item)), is_owned: true } }); };
-       local_ret.into()
-}
-
-/// Gets the list of pending events which were generated by previous actions, clearing the list
-/// in the process.
-///
-/// This is called by ManyChannelMonitor::get_and_clear_pending_events() and is equivalent to
-/// EventsProvider::get_and_clear_pending_events() except that it requires &mut self as we do
-/// no internal locking in ChannelMonitors.
-#[must_use]
-#[no_mangle]
-pub extern "C" fn ChannelMonitor_get_and_clear_pending_events(this_arg: &mut ChannelMonitor) -> crate::c_types::derived::CVec_EventZ {
-       let mut ret = unsafe { &mut (*(this_arg.inner as *mut nativeChannelMonitor)) }.get_and_clear_pending_events();
-       let mut local_ret = Vec::new(); for item in ret.drain(..) { local_ret.push( { crate::util::events::Event::native_into(item) }); };
-       local_ret.into()
-}
-
-/// Used by ChannelManager deserialization to broadcast the latest holder state if its copy of
-/// the Channel was out-of-date. You may use it to get a broadcastable holder toxic tx in case of
-/// fallen-behind, i.e when receiving a channel_reestablish with a proof that our counterparty side knows
-/// a higher revocation secret than the holder commitment number we are aware of. Broadcasting these
-/// transactions are UNSAFE, as they allow counterparty side to punish you. Nevertheless you may want to
-/// broadcast them if counterparty don't close channel with his higher commitment transaction after a
-/// substantial amount of time (a month or even a year) to get back funds. Best may be to contact
-/// out-of-band the other node operator to coordinate with him if option is available to you.
-/// In any-case, choice is up to the user.
-#[must_use]
-#[no_mangle]
-pub extern "C" fn ChannelMonitor_get_latest_holder_commitment_txn(this_arg: &mut ChannelMonitor, logger: &crate::util::logger::Logger) -> crate::c_types::derived::CVec_TransactionZ {
-       let mut ret = unsafe { &mut (*(this_arg.inner as *mut nativeChannelMonitor)) }.get_latest_holder_commitment_txn(logger);
-       let mut local_ret = Vec::new(); for item in ret.drain(..) { local_ret.push( { let mut local_ret_0 = ::bitcoin::consensus::encode::serialize(&item); local_ret_0.into() }); };
-       local_ret.into()
-}
-
index 69f17a0b5f73d3933b0bfeebd77d1049b93ac1c4..b81204a4720322bbfbb39a3caef304ac555a8e68 100644 (file)
@@ -14,7 +14,6 @@ use bitcoin::hashes::Hash;
 use crate::c_types::*;
 
 pub mod channelmanager;
-pub mod channelmonitor;
 pub mod msgs;
 pub mod peer_handler;
 pub mod chan_utils;
index e3ca0944af41bacb79e24ce3cedf199ecb884fc9..f15e81b817b5cb25990728a91b791d629240eb59 100644 (file)
@@ -2331,6 +2331,17 @@ 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
 }
+/// The advertised features
+#[no_mangle]
+pub extern "C" fn UnsignedNodeAnnouncement_get_features(this_ptr: &UnsignedNodeAnnouncement) -> crate::ln::features::NodeFeatures {
+       let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.features;
+       crate::ln::features::NodeFeatures { inner: unsafe { ( (&((*inner_val)) as *const _) as *mut _) }, is_owned: false }
+}
+/// The advertised features
+#[no_mangle]
+pub extern "C" fn UnsignedNodeAnnouncement_set_features(this_ptr: &mut UnsignedNodeAnnouncement, mut val: crate::ln::features::NodeFeatures) {
+       unsafe { &mut *this_ptr.inner }.features = *unsafe { Box::from_raw(val.take_ptr()) };
+}
 /// A strictly monotonic announcement counter, with gaps allowed
 #[no_mangle]
 pub extern "C" fn UnsignedNodeAnnouncement_get_timestamp(this_ptr: &UnsignedNodeAnnouncement) -> u32 {
@@ -2517,6 +2528,17 @@ 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
 }
+/// The advertised channel features
+#[no_mangle]
+pub extern "C" fn UnsignedChannelAnnouncement_get_features(this_ptr: &UnsignedChannelAnnouncement) -> crate::ln::features::ChannelFeatures {
+       let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.features;
+       crate::ln::features::ChannelFeatures { inner: unsafe { ( (&((*inner_val)) as *const _) as *mut _) }, is_owned: false }
+}
+/// The advertised channel features
+#[no_mangle]
+pub extern "C" fn UnsignedChannelAnnouncement_set_features(this_ptr: &mut UnsignedChannelAnnouncement, mut val: crate::ln::features::ChannelFeatures) {
+       unsafe { &mut *this_ptr.inner }.features = *unsafe { Box::from_raw(val.take_ptr()) };
+}
 /// The genesis hash of the blockchain where the channel is to be opened
 #[no_mangle]
 pub extern "C" fn UnsignedChannelAnnouncement_get_chain_hash(this_ptr: &UnsignedChannelAnnouncement) -> *const [u8; 32] {
index 89f20fd4889487224864a0846ce22b2a70e0e6c0..ba872b30dfe6c07260f96ed67c5aaf8f9ddced55 100644 (file)
@@ -84,7 +84,7 @@ impl LockedNetworkGraph {
 }
 
 use lightning::routing::network_graph::NetGraphMsgHandler as nativeNetGraphMsgHandlerImport;
-type nativeNetGraphMsgHandler = nativeNetGraphMsgHandlerImport<crate::chain::chaininterface::ChainWatchInterface, crate::util::logger::Logger>;
+type nativeNetGraphMsgHandler = nativeNetGraphMsgHandlerImport<crate::chain::Access, crate::util::logger::Logger>;
 
 /// Receives and validates network updates from peers,
 /// stores authentic and relevant data as a network graph.
@@ -131,8 +131,9 @@ impl NetGraphMsgHandler {
 /// channel owners' keys.
 #[must_use]
 #[no_mangle]
-pub extern "C" fn NetGraphMsgHandler_new(mut chain_monitor: crate::chain::chaininterface::ChainWatchInterface, mut logger: crate::util::logger::Logger) -> NetGraphMsgHandler {
-       let mut ret = lightning::routing::network_graph::NetGraphMsgHandler::new(chain_monitor, logger);
+pub extern "C" fn NetGraphMsgHandler_new(chain_access: *mut crate::chain::Access, mut logger: crate::util::logger::Logger) -> NetGraphMsgHandler {
+       let mut local_chain_access = if chain_access == std::ptr::null_mut() { None } else { Some( { unsafe { *Box::from_raw(chain_access) } }) };
+       let mut ret = lightning::routing::network_graph::NetGraphMsgHandler::new(local_chain_access, logger);
        NetGraphMsgHandler { inner: Box::into_raw(Box::new(ret)), is_owned: true }
 }
 
@@ -140,8 +141,9 @@ pub extern "C" fn NetGraphMsgHandler_new(mut chain_monitor: crate::chain::chaini
 /// assuming an existing Network Graph.
 #[must_use]
 #[no_mangle]
-pub extern "C" fn NetGraphMsgHandler_from_net_graph(mut chain_monitor: crate::chain::chaininterface::ChainWatchInterface, mut logger: crate::util::logger::Logger, mut network_graph: crate::routing::network_graph::NetworkGraph) -> NetGraphMsgHandler {
-       let mut ret = lightning::routing::network_graph::NetGraphMsgHandler::from_net_graph(chain_monitor, logger, *unsafe { Box::from_raw(network_graph.take_ptr()) });
+pub extern "C" fn NetGraphMsgHandler_from_net_graph(chain_access: *mut crate::chain::Access, mut logger: crate::util::logger::Logger, mut network_graph: crate::routing::network_graph::NetworkGraph) -> NetGraphMsgHandler {
+       let mut local_chain_access = if chain_access == std::ptr::null_mut() { None } else { Some( { unsafe { *Box::from_raw(chain_access) } }) };
+       let mut ret = lightning::routing::network_graph::NetGraphMsgHandler::from_net_graph(local_chain_access, logger, *unsafe { Box::from_raw(network_graph.take_ptr()) });
        NetGraphMsgHandler { inner: Box::into_raw(Box::new(ret)), is_owned: true }
 }
 
@@ -214,7 +216,7 @@ extern "C" fn NetGraphMsgHandler_RoutingMessageHandler_get_next_node_announcemen
        local_ret.into()
 }
 #[must_use]
-extern "C" fn NetGraphMsgHandler_RoutingMessageHandler_should_request_full_sync(this_arg: *const c_void, _node_id: crate::c_types::PublicKey) -> bool {
+extern "C" fn NetGraphMsgHandler_RoutingMessageHandler_should_request_full_sync(this_arg: *const c_void, mut _node_id: crate::c_types::PublicKey) -> bool {
        let mut ret = unsafe { &mut *(this_arg as *mut nativeNetGraphMsgHandler) }.should_request_full_sync(&_node_id.into_rust());
        ret
 }
@@ -374,6 +376,17 @@ impl ChannelInfo {
                ret
        }
 }
+/// Protocol features of a channel communicated during its announcement
+#[no_mangle]
+pub extern "C" fn ChannelInfo_get_features(this_ptr: &ChannelInfo) -> crate::ln::features::ChannelFeatures {
+       let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.features;
+       crate::ln::features::ChannelFeatures { inner: unsafe { ( (&((*inner_val)) as *const _) as *mut _) }, is_owned: false }
+}
+/// Protocol features of a channel communicated during its announcement
+#[no_mangle]
+pub extern "C" fn ChannelInfo_set_features(this_ptr: &mut ChannelInfo, mut val: crate::ln::features::ChannelFeatures) {
+       unsafe { &mut *this_ptr.inner }.features = *unsafe { Box::from_raw(val.take_ptr()) };
+}
 /// Source node of the first direction of a channel
 #[no_mangle]
 pub extern "C" fn ChannelInfo_get_node_one(this_ptr: &ChannelInfo) -> crate::c_types::PublicKey {
@@ -586,6 +599,17 @@ impl NodeAnnouncementInfo {
                ret
        }
 }
+/// Protocol features the node announced support for
+#[no_mangle]
+pub extern "C" fn NodeAnnouncementInfo_get_features(this_ptr: &NodeAnnouncementInfo) -> crate::ln::features::NodeFeatures {
+       let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.features;
+       crate::ln::features::NodeFeatures { inner: unsafe { ( (&((*inner_val)) as *const _) as *mut _) }, is_owned: false }
+}
+/// Protocol features the node announced support for
+#[no_mangle]
+pub extern "C" fn NodeAnnouncementInfo_set_features(this_ptr: &mut NodeAnnouncementInfo, mut val: crate::ln::features::NodeFeatures) {
+       unsafe { &mut *this_ptr.inner }.features = *unsafe { Box::from_raw(val.take_ptr()) };
+}
 /// When the last known update to the node state was issued.
 /// Value is opaque, as set in the announcement.
 #[no_mangle]
@@ -650,6 +674,20 @@ pub extern "C" fn NodeAnnouncementInfo_set_announcement_message(this_ptr: &mut N
        let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_ptr()) } }) };
        unsafe { &mut *this_ptr.inner }.announcement_message = local_val;
 }
+#[must_use]
+#[no_mangle]
+pub extern "C" fn NodeAnnouncementInfo_new(mut features_arg: crate::ln::features::NodeFeatures, mut last_update_arg: u32, mut rgb_arg: crate::c_types::ThreeBytes, mut alias_arg: crate::c_types::ThirtyTwoBytes, mut addresses_arg: crate::c_types::derived::CVec_NetAddressZ, mut announcement_message_arg: crate::ln::msgs::NodeAnnouncement) -> NodeAnnouncementInfo {
+       let mut local_addresses_arg = Vec::new(); for mut item in addresses_arg.into_rust().drain(..) { local_addresses_arg.push( { item.into_native() }); };
+       let mut local_announcement_message_arg = if announcement_message_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(announcement_message_arg.take_ptr()) } }) };
+       NodeAnnouncementInfo { inner: Box::into_raw(Box::new(nativeNodeAnnouncementInfo {
+               features: *unsafe { Box::from_raw(features_arg.take_ptr()) },
+               last_update: last_update_arg,
+               rgb: rgb_arg.data,
+               alias: alias_arg.data,
+               addresses: local_addresses_arg,
+               announcement_message: local_announcement_message_arg,
+       })), is_owned: true }
+}
 #[no_mangle]
 pub extern "C" fn NodeAnnouncementInfo_write(obj: *const NodeAnnouncementInfo) -> crate::c_types::derived::CVec_u8Z {
        crate::c_types::serialize_obj(unsafe { &(*(*obj).inner) })
index 978c24b419808987a30fb807ea68818d40826317..f473702c878952d34874a7f63edad19c74474a92 100644 (file)
@@ -69,6 +69,19 @@ pub extern "C" fn RouteHop_get_pubkey(this_ptr: &RouteHop) -> crate::c_types::Pu
 pub extern "C" fn RouteHop_set_pubkey(this_ptr: &mut RouteHop, mut val: crate::c_types::PublicKey) {
        unsafe { &mut *this_ptr.inner }.pubkey = val.into_rust();
 }
+/// The node_announcement features of the node at this hop. For the last hop, these may be
+/// amended to match the features present in the invoice this node generated.
+#[no_mangle]
+pub extern "C" fn RouteHop_get_node_features(this_ptr: &RouteHop) -> crate::ln::features::NodeFeatures {
+       let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.node_features;
+       crate::ln::features::NodeFeatures { inner: unsafe { ( (&((*inner_val)) as *const _) as *mut _) }, is_owned: false }
+}
+/// The node_announcement features of the node at this hop. For the last hop, these may be
+/// amended to match the features present in the invoice this node generated.
+#[no_mangle]
+pub extern "C" fn RouteHop_set_node_features(this_ptr: &mut RouteHop, mut val: crate::ln::features::NodeFeatures) {
+       unsafe { &mut *this_ptr.inner }.node_features = *unsafe { Box::from_raw(val.take_ptr()) };
+}
 /// The channel that should be used from the previous hop to reach this node.
 #[no_mangle]
 pub extern "C" fn RouteHop_get_short_channel_id(this_ptr: &RouteHop) -> u64 {
@@ -80,6 +93,19 @@ pub extern "C" fn RouteHop_get_short_channel_id(this_ptr: &RouteHop) -> u64 {
 pub extern "C" fn RouteHop_set_short_channel_id(this_ptr: &mut RouteHop, mut val: u64) {
        unsafe { &mut *this_ptr.inner }.short_channel_id = val;
 }
+/// The channel_announcement features of the channel that should be used from the previous hop
+/// to reach this node.
+#[no_mangle]
+pub extern "C" fn RouteHop_get_channel_features(this_ptr: &RouteHop) -> crate::ln::features::ChannelFeatures {
+       let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_features;
+       crate::ln::features::ChannelFeatures { inner: unsafe { ( (&((*inner_val)) as *const _) as *mut _) }, is_owned: false }
+}
+/// The channel_announcement features of the channel that should be used from the previous hop
+/// to reach this node.
+#[no_mangle]
+pub extern "C" fn RouteHop_set_channel_features(this_ptr: &mut RouteHop, mut val: crate::ln::features::ChannelFeatures) {
+       unsafe { &mut *this_ptr.inner }.channel_features = *unsafe { Box::from_raw(val.take_ptr()) };
+}
 /// The fee taken on this hop. For the last hop, this should be the full value of the payment.
 #[no_mangle]
 pub extern "C" fn RouteHop_get_fee_msat(this_ptr: &RouteHop) -> u64 {
@@ -104,6 +130,18 @@ pub extern "C" fn RouteHop_get_cltv_expiry_delta(this_ptr: &RouteHop) -> u32 {
 pub extern "C" fn RouteHop_set_cltv_expiry_delta(this_ptr: &mut RouteHop, mut val: u32) {
        unsafe { &mut *this_ptr.inner }.cltv_expiry_delta = val;
 }
+#[must_use]
+#[no_mangle]
+pub extern "C" fn RouteHop_new(mut pubkey_arg: crate::c_types::PublicKey, mut node_features_arg: crate::ln::features::NodeFeatures, mut short_channel_id_arg: u64, mut channel_features_arg: crate::ln::features::ChannelFeatures, mut fee_msat_arg: u64, mut cltv_expiry_delta_arg: u32) -> RouteHop {
+       RouteHop { inner: Box::into_raw(Box::new(nativeRouteHop {
+               pubkey: pubkey_arg.into_rust(),
+               node_features: *unsafe { Box::from_raw(node_features_arg.take_ptr()) },
+               short_channel_id: short_channel_id_arg,
+               channel_features: *unsafe { Box::from_raw(channel_features_arg.take_ptr()) },
+               fee_msat: fee_msat_arg,
+               cltv_expiry_delta: cltv_expiry_delta_arg,
+       })), is_owned: true }
+}
 
 use lightning::routing::router::Route as nativeRouteImport;
 type nativeRoute = nativeRouteImport;
@@ -308,8 +346,8 @@ pub extern "C" fn RouteHint_new(mut src_node_id_arg: crate::c_types::PublicKey,
 /// equal), however the enabled/disabled bit on such channels as well as the htlc_minimum_msat
 /// *is* checked as they may change based on the receiving node.
 #[no_mangle]
-pub extern "C" fn get_route(our_node_id: crate::c_types::PublicKey, network: &crate::routing::network_graph::NetworkGraph, target: crate::c_types::PublicKey, mut first_hops: *mut crate::c_types::derived::CVec_ChannelDetailsZ, mut last_hops: crate::c_types::derived::CVec_RouteHintZ, mut final_value_msat: u64, mut final_cltv: u32, mut logger: crate::util::logger::Logger) -> crate::c_types::derived::CResult_RouteLightningErrorZ {
-       let mut local_first_hops_base = if first_hops.is_null() { None } else { Some( { let mut local_first_hops_0 = Vec::new(); for mut item in unsafe { &mut *first_hops }.as_slice().iter() { local_first_hops_0.push( { unsafe { &*item.inner } }); }; local_first_hops_0 }) }; let mut local_first_hops = local_first_hops_base.as_ref().map(|a| &a[..]);
+pub extern "C" fn get_route(mut our_node_id: crate::c_types::PublicKey, network: &crate::routing::network_graph::NetworkGraph, mut target: crate::c_types::PublicKey, first_hops: *mut crate::c_types::derived::CVec_ChannelDetailsZ, mut last_hops: crate::c_types::derived::CVec_RouteHintZ, mut final_value_msat: u64, mut final_cltv: u32, mut logger: crate::util::logger::Logger) -> crate::c_types::derived::CResult_RouteLightningErrorZ {
+       let mut local_first_hops_base = if first_hops == std::ptr::null_mut() { None } else { Some( { let mut local_first_hops_0 = Vec::new(); for mut item in unsafe { &mut *first_hops }.as_slice().iter() { local_first_hops_0.push( { unsafe { &*item.inner } }); }; local_first_hops_0 }) }; let mut local_first_hops = local_first_hops_base.as_ref().map(|a| &a[..]);
        let mut local_last_hops = Vec::new(); for mut item in last_hops.as_slice().iter() { local_last_hops.push( { unsafe { &*item.inner } }); };
        let mut ret = lightning::routing::router::get_route(&our_node_id.into_rust(), unsafe { &*network.inner }, &target.into_rust(), local_first_hops, &local_last_hops[..], final_value_msat, final_cltv, logger);
        let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::routing::router::Route { inner: Box::into_raw(Box::new(o)), is_owned: true } }), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::LightningError { inner: Box::into_raw(Box::new(e)), is_owned: true } }) };
index 0ed0cf296683cb64c521427d25ac3854e44ac63d..06cb4a7f879ab6318fc9aad25bf2244dfffefdbf 100644 (file)
@@ -33,7 +33,7 @@ pub enum APIError {
        ChannelUnavailable {
                err: crate::c_types::derived::CVec_u8Z,
        },
-       /// An attempt to call add/update_monitor returned an Err (ie you did this!), causing the
+       /// An attempt to call watch/update_channel returned an Err (ie you did this!), causing the
        /// attempted action to fail.
        MonitorUpdateFailed,
 }