Update bindings to latest upstream code
[rust-lightning] / lightning-c-bindings / include / lightning.h
index 23efa9db6a56722a7b25e8758e49178df9aeb9fd..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.
@@ -40,7 +38,7 @@ typedef enum LDKChannelMonitorUpdateErr {
     * 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 remote party. Once the update(s) which failed
+    * 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.
     *
@@ -75,11 +73,24 @@ typedef enum LDKChannelMonitorUpdateErr {
    /**
     * 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). This will force-close the channel in question (which will generate one
-    * final ChannelMonitorUpdate which must be delivered to at least one ChannelMonitor copy).
+    * 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.
     *
-    * Should also be used to indicate a failure to update the local persisted copy of the channel
-    * monitor.
+    * 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.
     */
    LDKChannelMonitorUpdateErr_PermanentFailure,
    /**
@@ -171,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;
@@ -187,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.
@@ -195,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;
@@ -307,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,
@@ -384,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;
-
 
 
 /**
@@ -571,14 +610,14 @@ typedef enum LDKSpendableOutputDescriptor_Tag {
     * it is an output from an old state which we broadcast (which should never happen).
     *
     * To derive the delayed_payment key which is used to sign for this input, you must pass the
-    * local delayed_payment_base_key (ie the private key which corresponds to the pubkey in
+    * holder delayed_payment_base_key (ie the private key which corresponds to the pubkey in
     * ChannelKeys::pubkeys().delayed_payment_basepoint) and the provided per_commitment_point to
     * chan_utils::derive_private_key. The public key can be generated without the secret key
     * using chan_utils::derive_public_key and only the delayed_payment_basepoint which appears in
     * ChannelKeys::pubkeys().
     *
-    * To derive the remote_revocation_pubkey provided here (which is used in the witness
-    * script generation), you must pass the remote revocation_basepoint (which appears in the
+    * To derive the revocation_pubkey provided here (which is used in the witness
+    * script generation), you must pass the counterparty revocation_basepoint (which appears in the
     * call to ChannelKeys::on_accept) and the provided per_commitment point
     * to chan_utils::derive_public_revocation_key.
     *
@@ -597,7 +636,7 @@ typedef enum LDKSpendableOutputDescriptor_Tag {
     * These are generally the result of our counterparty having broadcast the current state,
     * allowing us to claim the non-HTLC-encumbered outputs immediately.
     */
-   LDKSpendableOutputDescriptor_StaticOutputRemotePayment,
+   LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment,
    /**
     * Must be last for serialization purposes
     */
@@ -615,21 +654,21 @@ typedef struct LDKSpendableOutputDescriptor_LDKDynamicOutputP2WSH_Body {
    uint16_t to_self_delay;
    LDKTxOut output;
    LDKC2Tuple_u64u64Z key_derivation_params;
-   LDKPublicKey remote_revocation_pubkey;
+   LDKPublicKey revocation_pubkey;
 } LDKSpendableOutputDescriptor_LDKDynamicOutputP2WSH_Body;
 
-typedef struct LDKSpendableOutputDescriptor_LDKStaticOutputRemotePayment_Body {
+typedef struct LDKSpendableOutputDescriptor_LDKStaticOutputCounterpartyPayment_Body {
    LDKOutPoint outpoint;
    LDKTxOut output;
    LDKC2Tuple_u64u64Z key_derivation_params;
-} LDKSpendableOutputDescriptor_LDKStaticOutputRemotePayment_Body;
+} LDKSpendableOutputDescriptor_LDKStaticOutputCounterpartyPayment_Body;
 
 typedef struct LDKSpendableOutputDescriptor {
    LDKSpendableOutputDescriptor_Tag tag;
    union {
       LDKSpendableOutputDescriptor_LDKStaticOutput_Body static_output;
       LDKSpendableOutputDescriptor_LDKDynamicOutputP2WSH_Body dynamic_output_p2wsh;
-      LDKSpendableOutputDescriptor_LDKStaticOutputRemotePayment_Body static_output_remote_payment;
+      LDKSpendableOutputDescriptor_LDKStaticOutputCounterpartyPayment_Body static_output_counterparty_payment;
    };
 } LDKSpendableOutputDescriptor;
 
@@ -1338,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;
+} LDKCResultTempl_TxOut__AccessError;
 
-/**
- * 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;
+typedef LDKCResultTempl_TxOut__AccessError LDKCResult_TxOutAccessErrorZ;
 
 /**
- * An interface to send a transaction to the Bitcoin network.
+ * The `Access` trait defines behavior for accessing chain data and state, such as blocks and
+ * UTXOs.
  */
-typedef struct LDKBroadcasterInterface {
+typedef struct LDKAccess {
    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;
-
-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.
+    * 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.
     *
-    * 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;
-
-/**
- * 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).
- */
-typedef struct LDKFeeEstimator {
-   void *this_arg;
-   /**
-    * Gets estimated satoshis of fee required per 1000 Weight-Units.
-    *
-    * 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;
 
 
 
@@ -1582,18 +1447,18 @@ typedef LDKCVecTempl_HTLCOutputInCommitment LDKCVec_HTLCOutputInCommitmentZ;
 
 
 /**
- * We use this to track local commitment transactions and put off signing them until we are ready
+ * We use this to track holder commitment transactions and put off signing them until we are ready
  * to broadcast. This class can be used inside a signer implementation to generate a signature
  * given the relevant secret key.
  */
-typedef struct MUST_USE_STRUCT LDKLocalCommitmentTransaction {
+typedef struct MUST_USE_STRUCT LDKHolderCommitmentTransaction {
    /**
     * 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.
     */
-   LDKnativeLocalCommitmentTransaction *inner;
+   LDKnativeHolderCommitmentTransaction *inner;
    bool is_owned;
-} LDKLocalCommitmentTransaction;
+} LDKHolderCommitmentTransaction;
 
 
 
@@ -1654,7 +1519,7 @@ typedef struct LDKChannelKeys {
     */
    LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx);
    /**
-    * Gets the local channel public keys and basepoints
+    * Gets the holder's channel public keys and basepoints
     */
    LDKChannelPublicKeys pubkeys;
    /**
@@ -1670,34 +1535,34 @@ typedef struct LDKChannelKeys {
     */
    LDKC2Tuple_u64u64Z (*key_derivation_params)(const void *this_arg);
    /**
-    * Create a signature for a remote commitment transaction and associated HTLC transactions.
+    * Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
     *
     * Note that if signing fails or is rejected, the channel will be force-closed.
     */
-   LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_remote_commitment)(const void *this_arg, uint32_t feerate_per_kw, LDKTransaction commitment_tx, const LDKPreCalculatedTxCreationKeys *keys, LDKCVec_HTLCOutputInCommitmentZ htlcs);
+   LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, uint32_t feerate_per_kw, LDKTransaction commitment_tx, const LDKPreCalculatedTxCreationKeys *keys, LDKCVec_HTLCOutputInCommitmentZ htlcs);
    /**
-    * Create a signature for a local commitment transaction. This will only ever be called with
-    * the same local_commitment_tx (or a copy thereof), though there are currently no guarantees
+    * Create a signature for a holder's commitment transaction. This will only ever be called with
+    * the same holder_commitment_tx (or a copy thereof), though there are currently no guarantees
     * that it will not be called multiple times.
     * An external signer implementation should check that the commitment has not been revoked.
     */
-   LDKCResult_SignatureNoneZ (*sign_local_commitment)(const void *this_arg, const LDKLocalCommitmentTransaction *local_commitment_tx);
+   LDKCResult_SignatureNoneZ (*sign_holder_commitment)(const void *this_arg, const LDKHolderCommitmentTransaction *holder_commitment_tx);
    /**
-    * Create a signature for each HTLC transaction spending a local commitment transaction.
+    * Create a signature for each HTLC transaction spending a holder's commitment transaction.
     *
-    * Unlike sign_local_commitment, this may be called multiple times with *different*
-    * local_commitment_tx values. While this will never be called with a revoked
-    * local_commitment_tx, it is possible that it is called with the second-latest
-    * local_commitment_tx (only if we haven't yet revoked it) if some watchtower/secondary
+    * Unlike sign_holder_commitment, this may be called multiple times with *different*
+    * holder_commitment_tx values. While this will never be called with a revoked
+    * holder_commitment_tx, it is possible that it is called with the second-latest
+    * holder_commitment_tx (only if we haven't yet revoked it) if some watchtower/secondary
     * ChannelMonitor decided to broadcast before it had been updated to the latest.
     *
     * Either an Err should be returned, or a Vec with one entry for each HTLC which exists in
-    * local_commitment_tx. For those HTLCs which have transaction_output_index set to None
+    * holder_commitment_tx. For those HTLCs which have transaction_output_index set to None
     * (implying they were considered dust at the time the commitment transaction was negotiated),
     * a corresponding None should be included in the return value. All other positions in the
     * return value must contain a signature.
     */
-   LDKCResult_CVec_SignatureZNoneZ (*sign_local_commitment_htlc_transactions)(const void *this_arg, const LDKLocalCommitmentTransaction *local_commitment_tx);
+   LDKCResult_CVec_SignatureZNoneZ (*sign_holder_commitment_htlc_transactions)(const void *this_arg, const LDKHolderCommitmentTransaction *holder_commitment_tx);
    /**
     * Create a signature for the given input in a transaction spending an HTLC or commitment
     * transaction output when our counterparty broadcasts an old state.
@@ -1710,8 +1575,8 @@ typedef struct LDKChannelKeys {
     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
     *
     * per_commitment_key is revocation secret which was provided by our counterparty when they
-    * revoked the state which they eventually broadcast. It's not a _local_ secret key and does
-    * not allow the spending of any funds by itself (you need our local revocation_secret to do
+    * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
+    * not allow the spending of any funds by itself (you need our holder revocation_secret to do
     * so).
     *
     * htlc holds HTLC elements (hash, timelock) if the output being spent is a HTLC output, thus
@@ -1720,7 +1585,7 @@ typedef struct LDKChannelKeys {
     */
    LDKCResult_SignatureNoneZ (*sign_justice_transaction)(const void *this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32], const LDKHTLCOutputInCommitment *htlc);
    /**
-    * Create a signature for a claiming transaction for a HTLC output on a remote commitment
+    * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
     * transaction, either offered or received.
     *
     * Such a transaction may claim multiples offered outputs at same time if we know the
@@ -1738,7 +1603,7 @@ typedef struct LDKChannelKeys {
     * channel state keys, which are then included in the witness script and committed to in the
     * BIP 143 signature.
     */
-   LDKCResult_SignatureNoneZ (*sign_remote_htlc_transaction)(const void *this_arg, LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, LDKPublicKey per_commitment_point, const LDKHTLCOutputInCommitment *htlc);
+   LDKCResult_SignatureNoneZ (*sign_counterparty_htlc_transaction)(const void *this_arg, LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, LDKPublicKey per_commitment_point, const LDKHTLCOutputInCommitment *htlc);
    /**
     * Create a signature for a (proposed) closing transaction.
     *
@@ -1756,213 +1621,335 @@ typedef struct LDKChannelKeys {
     */
    LDKCResult_SignatureNoneZ (*sign_channel_announcement)(const void *this_arg, const LDKUnsignedChannelAnnouncement *msg);
    /**
-    * Set the remote channel basepoints and remote/local to_self_delay.
+    * Set the counterparty channel basepoints and counterparty_selected/holder_selected_contest_delay.
     * This is done immediately on incoming channels and as soon as the channel is accepted on outgoing channels.
     *
-    * We bind local_to_self_delay late here for API convenience.
+    * We bind holder_selected_contest_delay late here for API convenience.
     *
     * Will be called before any signatures are applied.
     */
-   void (*on_accept)(void *this_arg, const LDKChannelPublicKeys *channel_points, uint16_t remote_to_self_delay, uint16_t local_to_self_delay);
+   void (*on_accept)(void *this_arg, const LDKChannelPublicKeys *channel_points, uint16_t counterparty_selected_contest_delay, uint16_t holder_selected_contest_delay);
    void *(*clone)(const void *this_arg);
    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.
+ * 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.
  */
-typedef struct LDKKeysInterface {
-   void *this_arg;
+typedef struct MUST_USE_STRUCT LDKChannelMonitor {
    /**
-    * Get node secret key (aka node_id or network_key)
+    * 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.
     */
-   LDKSecretKey (*get_node_secret)(const void *this_arg);
+   LDKnativeChannelMonitor *inner;
+   bool is_owned;
+} LDKChannelMonitor;
+
+
+
+/**
+ * An update generated by the underlying Channel itself which contains some new information the
+ * ChannelMonitor should be made aware of.
+ */
+typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate {
    /**
-    * Get destination redeemScript to encumber static protocol exit points.
+    * 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.
     */
-   LDKCVec_u8Z (*get_destination_script)(const void *this_arg);
+   LDKnativeChannelMonitorUpdate *inner;
+   bool is_owned;
+} LDKChannelMonitorUpdate;
+
+
+
+/**
+ * An event to be processed by the ChannelManager.
+ */
+typedef struct MUST_USE_STRUCT LDKMonitorEvent {
    /**
-    * Get shutdown_pubkey to use as PublicKey at channel closure
+    * 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.
     */
-   LDKPublicKey (*get_shutdown_pubkey)(const void *this_arg);
+   LDKnativeMonitorEvent *inner;
+   bool is_owned;
+} LDKMonitorEvent;
+
+typedef struct LDKCVecTempl_MonitorEvent {
+   LDKMonitorEvent *data;
+   uintptr_t datalen;
+} LDKCVecTempl_MonitorEvent;
+
+typedef LDKCVecTempl_MonitorEvent LDKCVec_MonitorEventZ;
+
+/**
+ * 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
+ */
+typedef struct LDKWatch {
+   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!
+    * 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
     */
-   LDKChannelKeys (*get_channel_keys)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis);
+   LDKCResult_NoneChannelMonitorUpdateErrZ (*watch_channel)(const void *this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor);
    /**
-    * 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.
+    * 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
     */
-   LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg);
+   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);
-} LDKKeysInterface;
+} 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 simple implementation of ChannelKeys that just keeps the private keys in memory.
+ * 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 MUST_USE_STRUCT LDKInMemoryChannelKeys {
+typedef struct LDKFeeEstimator {
+   void *this_arg;
    /**
-    * 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.
+    * Gets estimated satoshis of fee required per 1000 Weight-Units.
+    *
+    * 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)
     */
-   LDKnativeInMemoryChannelKeys *inner;
-   bool is_owned;
-} LDKInMemoryChannelKeys;
+   uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, LDKConfirmationTarget confirmation_target);
+   void (*free)(void *this_arg);
+} LDKFeeEstimator;
 
 
 
 /**
- * Simple KeysInterface implementor that takes a 32-byte seed for use as a BIP 32 extended key
- * and derives keys from that.
+ * An implementation of [`chain::Watch`] for monitoring channels.
  *
- * 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!
+ * 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 LDKKeysManager {
+typedef struct MUST_USE_STRUCT LDKChainMonitor {
    /**
     * 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;
+   LDKnativeChainMonitor *inner;
    bool is_owned;
-} LDKKeysManager;
+} 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;
 
 
 
 /**
- * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates
- * on-chain transactions to ensure no loss of funds occurs.
+ * 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.
  *
- * 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.
+ * [`chain::Watch`]: ../trait.Watch.html
  */
-typedef struct MUST_USE_STRUCT LDKChannelMonitor {
+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.
     */
-   LDKnativeChannelMonitor *inner;
+   LDKnativeHTLCUpdate *inner;
    bool is_owned;
-} LDKChannelMonitor;
+} 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;
 
 /**
- * An update generated by the underlying Channel itself which contains some new information the
- * ChannelMonitor should be made aware of.
+ * A trait to describe an object which can get user secrets and key material.
  */
-typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate {
+typedef struct LDKKeysInterface {
+   void *this_arg;
    /**
-    * 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.
+    * Get node secret key (aka node_id or network_key)
     */
-   LDKnativeChannelMonitorUpdate *inner;
-   bool is_owned;
-} LDKChannelMonitorUpdate;
+   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;
 
 
 
 /**
- * An event to be processed by the ChannelManager.
+ * A simple implementation of ChannelKeys that just keeps the private keys in memory.
  */
-typedef struct MUST_USE_STRUCT LDKMonitorEvent {
+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.
     */
-   LDKnativeMonitorEvent *inner;
+   LDKnativeInMemoryChannelKeys *inner;
    bool is_owned;
-} LDKMonitorEvent;
+} LDKInMemoryChannelKeys;
 
-typedef struct LDKCVecTempl_MonitorEvent {
-   LDKMonitorEvent *data;
-   uintptr_t datalen;
-} 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).
- *
- * 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!
+ * Simple KeysInterface implementor that takes a 32-byte seed for use as a BIP 32 extended key
+ * and derives keys from that.
  *
- * 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.
+ * 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 LDKManyChannelMonitor {
-   void *this_arg;
-   /**
-    * 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.
-    */
-   LDKCResult_NoneChannelMonitorUpdateErrZ (*add_monitor)(const void *this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor);
-   /**
-    * 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.
-    */
-   LDKCResult_NoneChannelMonitorUpdateErrZ (*update_monitor)(const void *this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate monitor);
+typedef struct MUST_USE_STRUCT LDKKeysManager {
    /**
-    * 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.
     */
-   LDKCVec_MonitorEventZ (*get_and_clear_pending_monitor_events)(const void *this_arg);
-   void (*free)(void *this_arg);
-} LDKManyChannelMonitor;
+   LDKnativeKeysManager *inner;
+   bool is_owned;
+} LDKKeysManager;
 
 
 
@@ -1980,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
@@ -2348,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 {
    /**
@@ -2372,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.
  */
@@ -2460,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
  */
@@ -2474,6 +2473,104 @@ typedef struct MUST_USE_STRUCT LDKUnsignedChannelUpdate {
 
 
 
+/**
+ * A query_channel_range message is used to query a peer for channel
+ * UTXOs in a range of blocks. The recipient of a query makes a best
+ * effort to reply to the query using one or more reply_channel_range
+ * messages.
+ */
+typedef struct MUST_USE_STRUCT LDKQueryChannelRange {
+   /**
+    * 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.
+    */
+   LDKnativeQueryChannelRange *inner;
+   bool is_owned;
+} LDKQueryChannelRange;
+
+
+
+/**
+ * A reply_channel_range message is a reply to a query_channel_range
+ * message. Multiple reply_channel_range messages can be sent in reply
+ * to a single query_channel_range message. The query recipient makes a
+ * best effort to respond based on their local network view which may
+ * not be a perfect view of the network. The short_channel_ids in the
+ * reply are encoded. We only support encoding_type=0 uncompressed
+ * serialization and do not support encoding_type=1 zlib serialization.
+ */
+typedef struct MUST_USE_STRUCT LDKReplyChannelRange {
+   /**
+    * 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.
+    */
+   LDKnativeReplyChannelRange *inner;
+   bool is_owned;
+} LDKReplyChannelRange;
+
+typedef struct LDKCVecTempl_u64 {
+   uint64_t *data;
+   uintptr_t datalen;
+} LDKCVecTempl_u64;
+
+typedef LDKCVecTempl_u64 LDKCVec_u64Z;
+
+
+
+/**
+ * A query_short_channel_ids message is used to query a peer for
+ * routing gossip messages related to one or more short_channel_ids.
+ * The query recipient will reply with the latest, if available,
+ * channel_announcement, channel_update and node_announcement messages
+ * it maintains for the requested short_channel_ids followed by a
+ * reply_short_channel_ids_end message. The short_channel_ids sent in
+ * this query are encoded. We only support encoding_type=0 uncompressed
+ * serialization and do not support encoding_type=1 zlib serialization.
+ */
+typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds {
+   /**
+    * 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.
+    */
+   LDKnativeQueryShortChannelIds *inner;
+   bool is_owned;
+} LDKQueryShortChannelIds;
+
+
+
+/**
+ * A reply_short_channel_ids_end message is sent as a reply to a
+ * query_short_channel_ids message. The query recipient makes a best
+ * effort to respond based on their local network view which may not be
+ * a perfect view of the network.
+ */
+typedef struct MUST_USE_STRUCT LDKReplyShortChannelIdsEnd {
+   /**
+    * 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.
+    */
+   LDKnativeReplyShortChannelIdsEnd *inner;
+   bool is_owned;
+} LDKReplyShortChannelIdsEnd;
+
+
+
+/**
+ * A gossip_timestamp_filter message is used by a node to request
+ * gossip relay for messages in the requested time range when the
+ * gossip_queries feature has been negotiated.
+ */
+typedef struct MUST_USE_STRUCT LDKGossipTimestampFilter {
+   /**
+    * 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.
+    */
+   LDKnativeGossipTimestampFilter *inner;
+   bool is_owned;
+} LDKGossipTimestampFilter;
+
+
+
 /**
  * An Err type for failure to process messages.
  */
@@ -2726,6 +2823,10 @@ typedef LDKCResultTempl_PublicKey__Secp256k1Error LDKCResult_PublicKeySecpErrorZ
  * The set of public keys which are used in the creation of one commitment transaction.
  * These are derived from the channel base keys and per-commitment data.
  *
+ * A broadcaster key is provided from potential broadcaster of the computed transaction.
+ * A countersignatory key is coming from a protocol participant unable to broadcast the
+ * transaction.
+ *
  * These keys are assumed to be good, either because the code derived them from
  * channel basepoints via the new function, or they were obtained via
  * PreCalculatedTxCreationKeys.trust_key_derivation because we trusted the source of the
@@ -2761,34 +2862,6 @@ typedef LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature LDKCVec_C2Tu
 
 
 
-/**
- * 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;
-
-
-
 /**
  * A hop in a route
  */
@@ -2966,34 +3039,21 @@ typedef struct MUST_USE_STRUCT LDKNodeInfo {
    bool is_owned;
 } LDKNodeInfo;
 
-typedef struct LDKCVecTempl_u64 {
-   uint64_t *data;
-   uintptr_t datalen;
-} LDKCVecTempl_u64;
-
-typedef LDKCVecTempl_u64 LDKCVec_u64Z;
-
 typedef LDKCVecTempl_RouteHop LDKCVec_RouteHopZ;
 
 extern const void (*C2Tuple_HTLCOutputInCommitmentSignatureZ_free)(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ);
 
 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);
 
@@ -3057,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);
@@ -3071,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);
@@ -3103,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);
@@ -3115,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);
 
@@ -3139,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);
@@ -3574,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
+ */
+void ChainMonitor_block_connected(const LDKChainMonitor *this_arg, const uint8_t (*header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t 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
  */
-MUST_USE_RES LDKChainWatchedUtil ChainWatchedUtil_new(void);
+void ChainMonitor_block_disconnected(const LDKChainMonitor *this_arg, const uint8_t (*header)[80], uint32_t disconnected_height);
 
 /**
- * Registers a tx for monitoring, returning true if it was a new tx 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_tx(LDKChainWatchedUtil *this_arg, const uint8_t (*txid)[32], 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);
 
 /**
- * Registers an outpoint for monitoring, returning true if it was a new outpoint and false if
- * we'd already been watching for it
+ * 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_register_outpoint(LDKChainWatchedUtil *this_arg, LDKC2Tuple_Txidu32Z outpoint, LDKu8slice _script_pub_key);
+uint64_t ChannelMonitorUpdate_get_update_id(const 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);
+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);
 
 /**
- * Checks if a given transaction matches the current filter.
+ * 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 bool ChainWatchedUtil_does_match_tx(const LDKChainWatchedUtil *this_arg, LDKTransaction tx);
-
-void BlockNotifier_free(LDKBlockNotifier this_ptr);
+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);
 
@@ -3728,42 +3882,42 @@ const uint8_t (*InMemoryChannelKeys_get_funding_key(const LDKInMemoryChannelKeys
 void InMemoryChannelKeys_set_funding_key(LDKInMemoryChannelKeys *this_ptr, LDKSecretKey val);
 
 /**
- * Local secret key for blinded revocation pubkey
+ * Holder secret key for blinded revocation pubkey
  */
 const uint8_t (*InMemoryChannelKeys_get_revocation_base_key(const LDKInMemoryChannelKeys *this_ptr))[32];
 
 /**
- * Local secret key for blinded revocation pubkey
+ * Holder secret key for blinded revocation pubkey
  */
 void InMemoryChannelKeys_set_revocation_base_key(LDKInMemoryChannelKeys *this_ptr, LDKSecretKey val);
 
 /**
- * Local secret key used for our balance in remote-broadcasted commitment transactions
+ * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
  */
 const uint8_t (*InMemoryChannelKeys_get_payment_key(const LDKInMemoryChannelKeys *this_ptr))[32];
 
 /**
- * Local secret key used for our balance in remote-broadcasted commitment transactions
+ * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
  */
 void InMemoryChannelKeys_set_payment_key(LDKInMemoryChannelKeys *this_ptr, LDKSecretKey val);
 
 /**
- * Local secret key used in HTLC tx
+ * Holder secret key used in HTLC tx
  */
 const uint8_t (*InMemoryChannelKeys_get_delayed_payment_base_key(const LDKInMemoryChannelKeys *this_ptr))[32];
 
 /**
- * Local secret key used in HTLC tx
+ * Holder secret key used in HTLC tx
  */
 void InMemoryChannelKeys_set_delayed_payment_base_key(LDKInMemoryChannelKeys *this_ptr, LDKSecretKey val);
 
 /**
- * Local htlc secret key used in commitment tx htlc outputs
+ * Holder htlc secret key used in commitment tx htlc outputs
  */
 const uint8_t (*InMemoryChannelKeys_get_htlc_base_key(const LDKInMemoryChannelKeys *this_ptr))[32];
 
 /**
- * Local htlc secret key used in commitment tx htlc outputs
+ * Holder htlc secret key used in commitment tx htlc outputs
  */
 void InMemoryChannelKeys_set_htlc_base_key(LDKInMemoryChannelKeys *this_ptr, LDKSecretKey val);
 
@@ -3783,27 +3937,27 @@ void InMemoryChannelKeys_set_commitment_seed(LDKInMemoryChannelKeys *this_ptr, L
 MUST_USE_RES LDKInMemoryChannelKeys InMemoryChannelKeys_new(LDKSecretKey funding_key, LDKSecretKey revocation_base_key, LDKSecretKey payment_key, LDKSecretKey delayed_payment_base_key, LDKSecretKey htlc_base_key, LDKThirtyTwoBytes commitment_seed, uint64_t channel_value_satoshis, LDKC2Tuple_u64u64Z key_derivation_params);
 
 /**
- * Remote pubkeys.
+ * Counterparty pubkeys.
  * Will panic if on_accept wasn't called.
  */
-MUST_USE_RES LDKChannelPublicKeys InMemoryChannelKeys_remote_pubkeys(const LDKInMemoryChannelKeys *this_arg);
+MUST_USE_RES LDKChannelPublicKeys InMemoryChannelKeys_counterparty_pubkeys(const LDKInMemoryChannelKeys *this_arg);
 
 /**
- * The to_self_delay value specified by our counterparty and applied on locally-broadcastable
+ * The contest_delay value specified by our counterparty and applied on holder-broadcastable
  * transactions, ie the amount of time that we have to wait to recover our funds if we
  * broadcast a transaction. You'll likely want to pass this to the
- * ln::chan_utils::build*_transaction functions when signing local transactions.
+ * ln::chan_utils::build*_transaction functions when signing holder's transactions.
  * Will panic if on_accept wasn't called.
  */
-MUST_USE_RES uint16_t InMemoryChannelKeys_remote_to_self_delay(const LDKInMemoryChannelKeys *this_arg);
+MUST_USE_RES uint16_t InMemoryChannelKeys_counterparty_selected_contest_delay(const LDKInMemoryChannelKeys *this_arg);
 
 /**
- * The to_self_delay value specified by us and applied on transactions broadcastable
+ * The contest_delay value specified by us and applied on transactions broadcastable
  * by our counterparty, ie the amount of time that they have to wait to recover their funds
  * if they broadcast a transaction.
  * Will panic if on_accept wasn't called.
  */
-MUST_USE_RES uint16_t InMemoryChannelKeys_local_to_self_delay(const LDKInMemoryChannelKeys *this_arg);
+MUST_USE_RES uint16_t InMemoryChannelKeys_holder_selected_contest_delay(const LDKInMemoryChannelKeys *this_arg);
 
 LDKChannelKeys InMemoryChannelKeys_as_ChannelKeys(const LDKInMemoryChannelKeys *this_arg);
 
@@ -3974,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.
@@ -4170,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,
@@ -4184,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);
 
@@ -4217,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
@@ -4277,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 local state if its copy of
- * the Channel was out-of-date. You may use it to get a broadcastable local toxic tx in case of
- * fallen-behind, i.e when receiving a channel_reestablish with a proof that our remote side knows
- * a higher revocation secret than the local commitment number we are aware of. Broadcasting these
- * transactions are UNSAFE, as they allow remote side to punish you. Nevertheless you may want to
- * broadcast them if remote 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_local_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);
 
@@ -5257,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
  */
@@ -5332,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
  */
@@ -5552,6 +5640,170 @@ void ChannelUpdate_set_contents(LDKChannelUpdate *this_ptr, LDKUnsignedChannelUp
 
 MUST_USE_RES LDKChannelUpdate ChannelUpdate_new(LDKSignature signature_arg, LDKUnsignedChannelUpdate contents_arg);
 
+void QueryChannelRange_free(LDKQueryChannelRange this_ptr);
+
+/**
+ * The genesis hash of the blockchain being queried
+ */
+const uint8_t (*QueryChannelRange_get_chain_hash(const LDKQueryChannelRange *this_ptr))[32];
+
+/**
+ * The genesis hash of the blockchain being queried
+ */
+void QueryChannelRange_set_chain_hash(LDKQueryChannelRange *this_ptr, LDKThirtyTwoBytes val);
+
+/**
+ * The height of the first block for the channel UTXOs being queried
+ */
+uint32_t QueryChannelRange_get_first_blocknum(const LDKQueryChannelRange *this_ptr);
+
+/**
+ * The height of the first block for the channel UTXOs being queried
+ */
+void QueryChannelRange_set_first_blocknum(LDKQueryChannelRange *this_ptr, uint32_t val);
+
+/**
+ * The number of blocks to include in the query results
+ */
+uint32_t QueryChannelRange_get_number_of_blocks(const LDKQueryChannelRange *this_ptr);
+
+/**
+ * The number of blocks to include in the query results
+ */
+void QueryChannelRange_set_number_of_blocks(LDKQueryChannelRange *this_ptr, uint32_t val);
+
+MUST_USE_RES LDKQueryChannelRange QueryChannelRange_new(LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg);
+
+void ReplyChannelRange_free(LDKReplyChannelRange this_ptr);
+
+/**
+ * The genesis hash of the blockchain being queried
+ */
+const uint8_t (*ReplyChannelRange_get_chain_hash(const LDKReplyChannelRange *this_ptr))[32];
+
+/**
+ * The genesis hash of the blockchain being queried
+ */
+void ReplyChannelRange_set_chain_hash(LDKReplyChannelRange *this_ptr, LDKThirtyTwoBytes val);
+
+/**
+ * The height of the first block in the range of the reply
+ */
+uint32_t ReplyChannelRange_get_first_blocknum(const LDKReplyChannelRange *this_ptr);
+
+/**
+ * The height of the first block in the range of the reply
+ */
+void ReplyChannelRange_set_first_blocknum(LDKReplyChannelRange *this_ptr, uint32_t val);
+
+/**
+ * The number of blocks included in the range of the reply
+ */
+uint32_t ReplyChannelRange_get_number_of_blocks(const LDKReplyChannelRange *this_ptr);
+
+/**
+ * The number of blocks included in the range of the reply
+ */
+void ReplyChannelRange_set_number_of_blocks(LDKReplyChannelRange *this_ptr, uint32_t val);
+
+/**
+ * Indicates if the query recipient maintains up-to-date channel
+ * information for the chain_hash
+ */
+bool ReplyChannelRange_get_full_information(const LDKReplyChannelRange *this_ptr);
+
+/**
+ * Indicates if the query recipient maintains up-to-date channel
+ * information for the chain_hash
+ */
+void ReplyChannelRange_set_full_information(LDKReplyChannelRange *this_ptr, bool val);
+
+/**
+ * The short_channel_ids in the channel range
+ */
+void ReplyChannelRange_set_short_channel_ids(LDKReplyChannelRange *this_ptr, LDKCVec_u64Z val);
+
+MUST_USE_RES LDKReplyChannelRange ReplyChannelRange_new(LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg, bool full_information_arg, LDKCVec_u64Z short_channel_ids_arg);
+
+void QueryShortChannelIds_free(LDKQueryShortChannelIds this_ptr);
+
+/**
+ * The genesis hash of the blockchain being queried
+ */
+const uint8_t (*QueryShortChannelIds_get_chain_hash(const LDKQueryShortChannelIds *this_ptr))[32];
+
+/**
+ * The genesis hash of the blockchain being queried
+ */
+void QueryShortChannelIds_set_chain_hash(LDKQueryShortChannelIds *this_ptr, LDKThirtyTwoBytes val);
+
+/**
+ * The short_channel_ids that are being queried
+ */
+void QueryShortChannelIds_set_short_channel_ids(LDKQueryShortChannelIds *this_ptr, LDKCVec_u64Z val);
+
+MUST_USE_RES LDKQueryShortChannelIds QueryShortChannelIds_new(LDKThirtyTwoBytes chain_hash_arg, LDKCVec_u64Z short_channel_ids_arg);
+
+void ReplyShortChannelIdsEnd_free(LDKReplyShortChannelIdsEnd this_ptr);
+
+/**
+ * The genesis hash of the blockchain that was queried
+ */
+const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const LDKReplyShortChannelIdsEnd *this_ptr))[32];
+
+/**
+ * The genesis hash of the blockchain that was queried
+ */
+void ReplyShortChannelIdsEnd_set_chain_hash(LDKReplyShortChannelIdsEnd *this_ptr, LDKThirtyTwoBytes val);
+
+/**
+ * Indicates if the query recipient maintains up-to-date channel
+ * information for the chain_hash
+ */
+bool ReplyShortChannelIdsEnd_get_full_information(const LDKReplyShortChannelIdsEnd *this_ptr);
+
+/**
+ * Indicates if the query recipient maintains up-to-date channel
+ * information for the chain_hash
+ */
+void ReplyShortChannelIdsEnd_set_full_information(LDKReplyShortChannelIdsEnd *this_ptr, bool val);
+
+MUST_USE_RES LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg);
+
+void GossipTimestampFilter_free(LDKGossipTimestampFilter this_ptr);
+
+/**
+ * The genesis hash of the blockchain for channel and node information
+ */
+const uint8_t (*GossipTimestampFilter_get_chain_hash(const LDKGossipTimestampFilter *this_ptr))[32];
+
+/**
+ * The genesis hash of the blockchain for channel and node information
+ */
+void GossipTimestampFilter_set_chain_hash(LDKGossipTimestampFilter *this_ptr, LDKThirtyTwoBytes val);
+
+/**
+ * The starting unix timestamp
+ */
+uint32_t GossipTimestampFilter_get_first_timestamp(const LDKGossipTimestampFilter *this_ptr);
+
+/**
+ * The starting unix timestamp
+ */
+void GossipTimestampFilter_set_first_timestamp(LDKGossipTimestampFilter *this_ptr, uint32_t val);
+
+/**
+ * The range of information in seconds
+ */
+uint32_t GossipTimestampFilter_get_timestamp_range(const LDKGossipTimestampFilter *this_ptr);
+
+/**
+ * The range of information in seconds
+ */
+void GossipTimestampFilter_set_timestamp_range(LDKGossipTimestampFilter *this_ptr, uint32_t val);
+
+MUST_USE_RES LDKGossipTimestampFilter GossipTimestampFilter_new(LDKThirtyTwoBytes chain_hash_arg, uint32_t first_timestamp_arg, uint32_t timestamp_range_arg);
+
 void ErrorAction_free(LDKErrorAction this_ptr);
 
 void LightningError_free(LDKLightningError this_ptr);
@@ -5738,6 +5990,26 @@ LDKCVec_u8Z NodeAnnouncement_write(const LDKNodeAnnouncement *obj);
 
 LDKNodeAnnouncement NodeAnnouncement_read(LDKu8slice ser);
 
+LDKQueryShortChannelIds QueryShortChannelIds_read(LDKu8slice ser);
+
+LDKCVec_u8Z QueryShortChannelIds_write(const LDKQueryShortChannelIds *obj);
+
+LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_read(LDKu8slice ser);
+
+LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const LDKReplyShortChannelIdsEnd *obj);
+
+LDKQueryChannelRange QueryChannelRange_read(LDKu8slice ser);
+
+LDKCVec_u8Z QueryChannelRange_write(const LDKQueryChannelRange *obj);
+
+LDKReplyChannelRange ReplyChannelRange_read(LDKu8slice ser);
+
+LDKCVec_u8Z ReplyChannelRange_write(const LDKReplyChannelRange *obj);
+
+LDKGossipTimestampFilter GossipTimestampFilter_read(LDKu8slice ser);
+
+LDKCVec_u8Z GossipTimestampFilter_write(const LDKGossipTimestampFilter *obj);
+
 void MessageHandler_free(LDKMessageHandler this_ptr);
 
 /**
@@ -5913,76 +6185,88 @@ LDKCResult_PublicKeySecpErrorZ derive_public_key(LDKPublicKey per_commitment_poi
 /**
  * Derives a per-commitment-transaction revocation key from its constituent parts.
  *
+ * Only the cheating participant owns a valid witness to propagate a revoked
+ * commitment transaction, thus per_commitment_secret always come from cheater
+ * and revocation_base_secret always come from punisher, which is the broadcaster
+ * of the transaction spending with this key knowledge.
+ *
  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
  * generated (ie our own).
  */
-LDKCResult_SecretKeySecpErrorZ derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*revocation_base_secret)[32]);
+LDKCResult_SecretKeySecpErrorZ derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]);
 
 /**
  * Derives a per-commitment-transaction revocation public key from its constituent parts. This is
  * the public equivalend of derive_private_revocation_key - using only public keys to derive a
  * public key instead of private keys.
  *
+ * Only the cheating participant owns a valid witness to propagate a revoked
+ * commitment transaction, thus per_commitment_point always come from cheater
+ * and revocation_base_point always come from punisher, which is the broadcaster
+ * of the transaction spending with this key knowledge.
+ *
  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
  * generated (ie our own).
  */
-LDKCResult_PublicKeySecpErrorZ derive_public_revocation_key(LDKPublicKey per_commitment_point, LDKPublicKey revocation_base_point);
+LDKCResult_PublicKeySecpErrorZ derive_public_revocation_key(LDKPublicKey per_commitment_point, LDKPublicKey countersignatory_revocation_base_point);
 
 void TxCreationKeys_free(LDKTxCreationKeys this_ptr);
 
 /**
- * The per-commitment public key which was used to derive the other keys.
+ * The broadcaster's per-commitment public key which was used to derive the other keys.
  */
 LDKPublicKey TxCreationKeys_get_per_commitment_point(const LDKTxCreationKeys *this_ptr);
 
 /**
- * The per-commitment public key which was used to derive the other keys.
+ * The broadcaster's per-commitment public key which was used to derive the other keys.
  */
 void TxCreationKeys_set_per_commitment_point(LDKTxCreationKeys *this_ptr, LDKPublicKey val);
 
 /**
- * The revocation key which is used to allow the owner of the commitment transaction to
- * provide their counterparty the ability to punish them if they broadcast an old state.
+ * The revocation key which is used to allow the broadcaster of the commitment
+ * transaction to provide their counterparty the ability to punish them if they broadcast
+ * an old state.
  */
 LDKPublicKey TxCreationKeys_get_revocation_key(const LDKTxCreationKeys *this_ptr);
 
 /**
- * The revocation key which is used to allow the owner of the commitment transaction to
- * provide their counterparty the ability to punish them if they broadcast an old state.
+ * The revocation key which is used to allow the broadcaster of the commitment
+ * transaction to provide their counterparty the ability to punish them if they broadcast
+ * an old state.
  */
 void TxCreationKeys_set_revocation_key(LDKTxCreationKeys *this_ptr, LDKPublicKey val);
 
 /**
- * A's HTLC Key
+ * Broadcaster's HTLC Key
  */
-LDKPublicKey TxCreationKeys_get_a_htlc_key(const LDKTxCreationKeys *this_ptr);
+LDKPublicKey TxCreationKeys_get_broadcaster_htlc_key(const LDKTxCreationKeys *this_ptr);
 
 /**
- * A's HTLC Key
+ * Broadcaster's HTLC Key
  */
-void TxCreationKeys_set_a_htlc_key(LDKTxCreationKeys *this_ptr, LDKPublicKey val);
+void TxCreationKeys_set_broadcaster_htlc_key(LDKTxCreationKeys *this_ptr, LDKPublicKey val);
 
 /**
- * B's HTLC Key
+ * Countersignatory's HTLC Key
  */
-LDKPublicKey TxCreationKeys_get_b_htlc_key(const LDKTxCreationKeys *this_ptr);
+LDKPublicKey TxCreationKeys_get_countersignatory_htlc_key(const LDKTxCreationKeys *this_ptr);
 
 /**
- * B's HTLC Key
+ * Countersignatory's HTLC Key
  */
-void TxCreationKeys_set_b_htlc_key(LDKTxCreationKeys *this_ptr, LDKPublicKey val);
+void TxCreationKeys_set_countersignatory_htlc_key(LDKTxCreationKeys *this_ptr, LDKPublicKey val);
 
 /**
- * A's Payment Key (which isn't allowed to be spent from for some delay)
+ * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
  */
-LDKPublicKey TxCreationKeys_get_a_delayed_payment_key(const LDKTxCreationKeys *this_ptr);
+LDKPublicKey TxCreationKeys_get_broadcaster_delayed_payment_key(const LDKTxCreationKeys *this_ptr);
 
 /**
- * A's Payment Key (which isn't allowed to be spent from for some delay)
+ * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
  */
-void TxCreationKeys_set_a_delayed_payment_key(LDKTxCreationKeys *this_ptr, LDKPublicKey val);
+void TxCreationKeys_set_broadcaster_delayed_payment_key(LDKTxCreationKeys *this_ptr, LDKPublicKey val);
 
-MUST_USE_RES LDKTxCreationKeys TxCreationKeys_new(LDKPublicKey per_commitment_point_arg, LDKPublicKey revocation_key_arg, LDKPublicKey a_htlc_key_arg, LDKPublicKey b_htlc_key_arg, LDKPublicKey a_delayed_payment_key_arg);
+MUST_USE_RES LDKTxCreationKeys TxCreationKeys_new(LDKPublicKey per_commitment_point_arg, LDKPublicKey revocation_key_arg, LDKPublicKey broadcaster_htlc_key_arg, LDKPublicKey countersignatory_htlc_key_arg, LDKPublicKey broadcaster_delayed_payment_key_arg);
 
 LDKCVec_u8Z TxCreationKeys_write(const LDKTxCreationKeys *obj);
 
@@ -6037,16 +6321,16 @@ LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const LDKChannelPublicKe
 void ChannelPublicKeys_set_revocation_basepoint(LDKChannelPublicKeys *this_ptr, LDKPublicKey val);
 
 /**
- * The public key which receives our immediately spendable primary channel balance in
- * remote-broadcasted commitment transactions. This key is static across every commitment
- * transaction.
+ * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
+ * spendable primary channel balance on the broadcaster's commitment transaction. This key is
+ * static across every commitment transaction.
  */
 LDKPublicKey ChannelPublicKeys_get_payment_point(const LDKChannelPublicKeys *this_ptr);
 
 /**
- * The public key which receives our immediately spendable primary channel balance in
- * remote-broadcasted commitment transactions. This key is static across every commitment
- * transaction.
+ * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
+ * spendable primary channel balance on the broadcaster's commitment transaction. This key is
+ * static across every commitment transaction.
  */
 void ChannelPublicKeys_set_payment_point(LDKChannelPublicKeys *this_ptr, LDKPublicKey val);
 
@@ -6085,14 +6369,14 @@ LDKChannelPublicKeys ChannelPublicKeys_read(LDKu8slice ser);
 /**
  * Create a new TxCreationKeys from channel base points and the per-commitment point
  */
-MUST_USE_RES LDKCResult_TxCreationKeysSecpErrorZ TxCreationKeys_derive_new(LDKPublicKey per_commitment_point, LDKPublicKey a_delayed_payment_base, LDKPublicKey a_htlc_base, LDKPublicKey b_revocation_base, LDKPublicKey b_htlc_base);
+MUST_USE_RES LDKCResult_TxCreationKeysSecpErrorZ TxCreationKeys_derive_new(LDKPublicKey per_commitment_point, LDKPublicKey broadcaster_delayed_payment_base, LDKPublicKey broadcaster_htlc_base, LDKPublicKey countersignatory_revocation_base, LDKPublicKey countersignatory_htlc_base);
 
 /**
  * A script either spendable by the revocation
- * key or the delayed_payment_key and satisfying the relative-locktime OP_CSV constrain.
- * Encumbering a `to_local` output on a commitment transaction or 2nd-stage HTLC transactions.
+ * 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.
  */
-LDKCVec_u8Z get_revokeable_redeemscript(LDKPublicKey revocation_key, uint16_t to_self_delay, LDKPublicKey delayed_payment_key);
+LDKCVec_u8Z get_revokeable_redeemscript(LDKPublicKey revocation_key, uint16_t contest_delay, LDKPublicKey broadcaster_delayed_payment_key);
 
 void HTLCOutputInCommitment_free(LDKHTLCOutputInCommitment this_ptr);
 
@@ -6100,7 +6384,7 @@ void HTLCOutputInCommitment_free(LDKHTLCOutputInCommitment this_ptr);
  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
  * need to compare this value to whether the commitment transaction in question is that of
- * the remote party or our own.
+ * the counterparty or our own.
  */
 bool HTLCOutputInCommitment_get_offered(const LDKHTLCOutputInCommitment *this_ptr);
 
@@ -6108,7 +6392,7 @@ bool HTLCOutputInCommitment_get_offered(const LDKHTLCOutputInCommitment *this_pt
  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
  * need to compare this value to whether the commitment transaction in question is that of
- * the remote party or our own.
+ * the counterparty or our own.
  */
 void HTLCOutputInCommitment_set_offered(LDKHTLCOutputInCommitment *this_ptr, bool val);
 
@@ -6149,8 +6433,8 @@ LDKCVec_u8Z HTLCOutputInCommitment_write(const LDKHTLCOutputInCommitment *obj);
 LDKHTLCOutputInCommitment HTLCOutputInCommitment_read(LDKu8slice ser);
 
 /**
- * note here that 'a_revocation_key' is generated using b_revocation_basepoint and a's
- * commitment secret. 'htlc' does *not* need to have its previous_output_index filled.
+ * Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc
+ * does not need to have its previous_output_index filled.
  */
 LDKCVec_u8Z get_htlc_redeemscript(const LDKHTLCOutputInCommitment *htlc, const LDKTxCreationKeys *keys);
 
@@ -6158,91 +6442,91 @@ LDKCVec_u8Z get_htlc_redeemscript(const LDKHTLCOutputInCommitment *htlc, const L
  * Gets the redeemscript for a funding output from the two funding public keys.
  * Note that the order of funding public keys does not matter.
  */
-LDKCVec_u8Z make_funding_redeemscript(LDKPublicKey a, LDKPublicKey b);
+LDKCVec_u8Z make_funding_redeemscript(LDKPublicKey broadcaster, LDKPublicKey countersignatory);
 
 /**
  * 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 to_self_delay, const LDKHTLCOutputInCommitment *htlc, LDKPublicKey a_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 LocalCommitmentTransaction_free(LDKLocalCommitmentTransaction this_ptr);
+void HolderCommitmentTransaction_free(LDKHolderCommitmentTransaction this_ptr);
 
 /**
  * The commitment transaction itself, in unsigned form.
  */
-LDKCVec_u8Z LocalCommitmentTransaction_get_unsigned_tx(const LDKLocalCommitmentTransaction *this_ptr);
+LDKTransaction HolderCommitmentTransaction_get_unsigned_tx(const LDKHolderCommitmentTransaction *this_ptr);
 
 /**
  * The commitment transaction itself, in unsigned form.
  */
-void LocalCommitmentTransaction_set_unsigned_tx(LDKLocalCommitmentTransaction *this_ptr, LDKCVec_u8Z val);
+void HolderCommitmentTransaction_set_unsigned_tx(LDKHolderCommitmentTransaction *this_ptr, LDKTransaction val);
 
 /**
  * Our counterparty's signature for the transaction, above.
  */
-LDKSignature LocalCommitmentTransaction_get_their_sig(const LDKLocalCommitmentTransaction *this_ptr);
+LDKSignature HolderCommitmentTransaction_get_counterparty_sig(const LDKHolderCommitmentTransaction *this_ptr);
 
 /**
  * Our counterparty's signature for the transaction, above.
  */
-void LocalCommitmentTransaction_set_their_sig(LDKLocalCommitmentTransaction *this_ptr, LDKSignature val);
+void HolderCommitmentTransaction_set_counterparty_sig(LDKHolderCommitmentTransaction *this_ptr, LDKSignature val);
 
 /**
  * The feerate paid per 1000-weight-unit in this commitment transaction. This value is
  * controlled by the channel initiator.
  */
-uint32_t LocalCommitmentTransaction_get_feerate_per_kw(const LDKLocalCommitmentTransaction *this_ptr);
+uint32_t HolderCommitmentTransaction_get_feerate_per_kw(const LDKHolderCommitmentTransaction *this_ptr);
 
 /**
  * The feerate paid per 1000-weight-unit in this commitment transaction. This value is
  * controlled by the channel initiator.
  */
-void LocalCommitmentTransaction_set_feerate_per_kw(LDKLocalCommitmentTransaction *this_ptr, uint32_t val);
+void HolderCommitmentTransaction_set_feerate_per_kw(LDKHolderCommitmentTransaction *this_ptr, uint32_t val);
 
 /**
- * The HTLCs and remote htlc signatures which were included in this commitment transaction.
+ * The HTLCs and counterparty htlc signatures which were included in this commitment transaction.
  *
  * Note that this includes all HTLCs, including ones which were considered dust and not
  * actually included in the transaction as it appears on-chain, but who's value is burned as
- * fees and not included in the to_local or to_remote outputs.
+ * fees and not included in the to_holder or to_counterparty outputs.
  *
- * The remote HTLC signatures in the second element will always be set for non-dust HTLCs, ie
+ * The counterparty HTLC signatures in the second element will always be set for non-dust HTLCs, ie
  * those for which transaction_output_index.is_some().
  */
-void LocalCommitmentTransaction_set_per_htlc(LDKLocalCommitmentTransaction *this_ptr, LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ val);
+void HolderCommitmentTransaction_set_per_htlc(LDKHolderCommitmentTransaction *this_ptr, LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ val);
 
 /**
- * Generate a new LocalCommitmentTransaction based on a raw commitment transaction,
- * remote signature and both parties keys.
+ * Generate a new HolderCommitmentTransaction based on a raw commitment transaction,
+ * counterparty signature and both parties keys.
  *
  * 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 LDKLocalCommitmentTransaction LocalCommitmentTransaction_new_missing_local_sig(LDKCVec_u8Z unsigned_tx, LDKSignature their_sig, LDKPublicKey our_funding_key, LDKPublicKey their_funding_key, LDKTxCreationKeys local_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.
  * An external validating signer should not trust these keys.
  */
-MUST_USE_RES LDKTxCreationKeys LocalCommitmentTransaction_trust_key_derivation(const LDKLocalCommitmentTransaction *this_arg);
+MUST_USE_RES LDKTxCreationKeys HolderCommitmentTransaction_trust_key_derivation(const LDKHolderCommitmentTransaction *this_arg);
 
 /**
- * Get the txid of the local commitment transaction contained in this
- * LocalCommitmentTransaction
+ * Get the txid of the holder commitment transaction contained in this
+ * HolderCommitmentTransaction
  */
-MUST_USE_RES LDKThirtyTwoBytes LocalCommitmentTransaction_txid(const LDKLocalCommitmentTransaction *this_arg);
+MUST_USE_RES LDKThirtyTwoBytes HolderCommitmentTransaction_txid(const LDKHolderCommitmentTransaction *this_arg);
 
 /**
- * Gets our signature for the contained commitment transaction given our funding private key.
+ * Gets holder signature for the contained commitment transaction given holder funding private key.
  *
  * Funding key is your key included in the 2-2 funding_outpoint lock. Should be provided
  * by your ChannelKeys.
  * Funding redeemscript is script locking funding_outpoint. This is the mutlsig script
  * between your own funding key and your counterparty's. Currently, this is provided in
- * ChannelKeys::sign_local_commitment() calls directly.
+ * ChannelKeys::sign_holder_commitment() calls directly.
  * Channel value is amount locked in funding_outpoint.
  */
-MUST_USE_RES LDKSignature LocalCommitmentTransaction_get_local_sig(const LDKLocalCommitmentTransaction *this_arg, const uint8_t (*funding_key)[32], LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis);
+MUST_USE_RES LDKSignature HolderCommitmentTransaction_get_holder_sig(const LDKHolderCommitmentTransaction *this_arg, const uint8_t (*funding_key)[32], LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis);
 
 /**
  * Get a signature for each HTLC which was included in the commitment transaction (ie for
@@ -6252,11 +6536,11 @@ MUST_USE_RES LDKSignature LocalCommitmentTransaction_get_local_sig(const LDKLoca
  * considered dust and not included, a None entry exists, for all others a signature is
  * included.
  */
-MUST_USE_RES LDKCResult_CVec_SignatureZNoneZ LocalCommitmentTransaction_get_htlc_sigs(const LDKLocalCommitmentTransaction *this_arg, const uint8_t (*htlc_base_key)[32], uint16_t local_csv);
+MUST_USE_RES LDKCResult_CVec_SignatureZNoneZ HolderCommitmentTransaction_get_htlc_sigs(const LDKHolderCommitmentTransaction *this_arg, const uint8_t (*htlc_base_key)[32], uint16_t counterparty_selected_contest_delay);
 
-LDKCVec_u8Z LocalCommitmentTransaction_write(const LDKLocalCommitmentTransaction *obj);
+LDKCVec_u8Z HolderCommitmentTransaction_write(const LDKHolderCommitmentTransaction *obj);
 
-LDKLocalCommitmentTransaction LocalCommitmentTransaction_read(LDKu8slice ser);
+LDKHolderCommitmentTransaction HolderCommitmentTransaction_read(LDKu8slice ser);
 
 void InitFeatures_free(LDKInitFeatures this_ptr);
 
@@ -6276,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.
  */
@@ -6286,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.
  */
@@ -6308,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);
 
 /**
@@ -6413,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
@@ -6502,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
  */
@@ -6594,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.
@@ -6651,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);