Update auto-generated bindings
authorMatt Corallo <git@bluematt.me>
Thu, 27 Oct 2022 03:52:14 +0000 (03:52 +0000)
committerMatt Corallo <git@bluematt.me>
Fri, 28 Oct 2022 01:31:25 +0000 (01:31 +0000)
33 files changed:
lightning-c-bindings/include/ldk_rust_types.h
lightning-c-bindings/include/lightning.h
lightning-c-bindings/include/lightningpp.hpp
lightning-c-bindings/src/c_types/derived.rs
lightning-c-bindings/src/lightning/chain/chainmonitor.rs
lightning-c-bindings/src/lightning/chain/channelmonitor.rs
lightning-c-bindings/src/lightning/chain/keysinterface.rs
lightning-c-bindings/src/lightning/chain/mod.rs
lightning-c-bindings/src/lightning/chain/transaction.rs
lightning-c-bindings/src/lightning/ln/chan_utils.rs
lightning-c-bindings/src/lightning/ln/channelmanager.rs
lightning-c-bindings/src/lightning/ln/features.rs
lightning-c-bindings/src/lightning/ln/msgs.rs
lightning-c-bindings/src/lightning/ln/peer_handler.rs
lightning-c-bindings/src/lightning/ln/script.rs
lightning-c-bindings/src/lightning/ln/wire.rs
lightning-c-bindings/src/lightning/onion_message/blinded_route.rs
lightning-c-bindings/src/lightning/onion_message/messenger.rs
lightning-c-bindings/src/lightning/onion_message/packet.rs
lightning-c-bindings/src/lightning/routing/gossip.rs
lightning-c-bindings/src/lightning/routing/router.rs
lightning-c-bindings/src/lightning/routing/scoring.rs
lightning-c-bindings/src/lightning/util/config.rs
lightning-c-bindings/src/lightning/util/errors.rs
lightning-c-bindings/src/lightning/util/events.rs
lightning-c-bindings/src/lightning/util/ser.rs
lightning-c-bindings/src/lightning_background_processor.rs
lightning-c-bindings/src/lightning_invoice/mod.rs
lightning-c-bindings/src/lightning_invoice/payment.rs
lightning-c-bindings/src/lightning_invoice/utils.rs
lightning-c-bindings/src/lightning_rapid_gossip_sync/error.rs
lightning-c-bindings/src/lightning_rapid_gossip_sync/mod.rs
lightning-c-bindings/src/lightning_rapid_gossip_sync/processing.rs [deleted file]

index ff9759b4b0a7e24d9039ed7c8dbb5e88ab4dc97e..3faff3def01b34c8f06a64194238dda53cd2f846 100644 (file)
@@ -197,8 +197,6 @@ struct nativeOnionMessengerOpaque;
 typedef struct nativeOnionMessengerOpaque LDKnativeOnionMessenger;
 struct nativeRapidGossipSyncOpaque;
 typedef struct nativeRapidGossipSyncOpaque LDKnativeRapidGossipSync;
-struct nativeDecodeErrorOpaque;
-typedef struct nativeDecodeErrorOpaque LDKnativeDecodeError;
 struct nativeInitOpaque;
 typedef struct nativeInitOpaque LDKnativeInit;
 struct nativeErrorMessageOpaque;
index 2022fded751929ce35f6260ed2928cb45bdabf45..8b6468cb4dd62e524269446a2e72364cecefa9e1 100644 (file)
@@ -47,78 +47,93 @@ typedef enum LDKCOption_NoneZ {
 } LDKCOption_NoneZ;
 
 /**
- * An error enum representing a failure to persist a channel monitor update.
+ * An enum representing the status of a channel monitor update persistence.
  */
-typedef enum LDKChannelMonitorUpdateErr {
+typedef enum LDKChannelMonitorUpdateStatus {
+   /**
+    * The update has been durably persisted and all copies of the relevant [`ChannelMonitor`]
+    * have been updated.
+    *
+    * This includes performing any `fsync()` calls required to ensure the update is guaranteed to
+    * be available on restart even if the application crashes.
+    */
+   LDKChannelMonitorUpdateStatus_Completed,
    /**
     * Used to indicate a temporary failure (eg connection to a watchtower or remote backup of
     * our state failed, but is expected to succeed at some point in the future).
     *
     * Such a failure will \"freeze\" a channel, preventing us from revoking old states or
-    * submitting new commitment transactions to the counterparty. Once the update(s) that failed
-    * have been successfully applied, a [`MonitorEvent::UpdateCompleted`] event should be returned
-    * via [`Watch::release_pending_monitor_events`] which will then restore the channel to an
-    * operational state.
-    *
-    * Note that a given ChannelManager will *never* re-generate a given ChannelMonitorUpdate. If
-    * you return a TemporaryFailure you must ensure that it is written to disk safely before
-    * writing out the latest ChannelManager state.
+    * submitting new commitment transactions to the counterparty. Once the update(s) which failed
+    * have been successfully applied, a [`MonitorEvent::Completed`] can be used to restore the
+    * channel to an operational state.
     *
-    * Even when a channel has been \"frozen\" updates to the ChannelMonitor can continue to occur
-    * (eg if an inbound HTLC which we forwarded was claimed upstream resulting in us attempting
-    * to claim it on this channel) and those updates must be applied wherever they can be. At
-    * least one such updated ChannelMonitor must be persisted otherwise PermanentFailure should
-    * be returned to get things on-chain ASAP using only the in-memory copy. Obviously updates to
-    * the channel which would invalidate previous ChannelMonitors are not made when a channel has
-    * been \"frozen\".
+    * Note that a given [`ChannelManager`] will *never* re-generate a [`ChannelMonitorUpdate`].
+    * If you return this error you must ensure that it is written to disk safely before writing
+    * the latest [`ChannelManager`] state, or you should return [`PermanentFailure`] instead.
     *
-    * Note that even if updates made after TemporaryFailure succeed you must still provide a
-    * [`MonitorEvent::UpdateCompleted`] to ensure you have the latest monitor and re-enable
-    * normal channel operation. Note that this is normally generated through a call to
-    * [`ChainMonitor::channel_monitor_updated`].
+    * Even when a channel has been \"frozen\", updates to the [`ChannelMonitor`] can continue to
+    * occur (e.g. if an inbound HTLC which we forwarded was claimed upstream, resulting in us
+    * attempting to claim it on this channel) and those updates must still be persisted.
     *
-    * Note that the update being processed here will not be replayed for you when you return a
-    * [`MonitorEvent::UpdateCompleted`] event via [`Watch::release_pending_monitor_events`], so
-    * you must store the update itself on your own local disk prior to returning a
-    * TemporaryFailure. You may, of course, employ a journaling approach, storing only the
-    * ChannelMonitorUpdate on disk without updating the monitor itself, replaying the journal at
-    * reload-time.
+    * No updates to the channel will be made which could invalidate other [`ChannelMonitor`]s
+    * until a [`MonitorEvent::Completed`] is provided, even if you return no error on a later
+    * monitor update for the same channel.
     *
     * For deployments where a copy of ChannelMonitors and other local state are backed up in a
     * remote location (with local copies persisted immediately), it is anticipated that all
-    * updates will return TemporaryFailure until the remote copies could be updated.
+    * updates will return [`InProgress`] until the remote copies could be updated.
     *
-    * [`ChainMonitor::channel_monitor_updated`]: chainmonitor::ChainMonitor::channel_monitor_updated
+    * [`PermanentFailure`]: ChannelMonitorUpdateStatus::PermanentFailure
+    * [`InProgress`]: ChannelMonitorUpdateStatus::InProgress
+    * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
     */
-   LDKChannelMonitorUpdateErr_TemporaryFailure,
+   LDKChannelMonitorUpdateStatus_InProgress,
    /**
-    * 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).
+    * Used to indicate no further channel monitor updates will be allowed (likely a disk failure
+    * or a remote copy of this [`ChannelMonitor`] is no longer reachable and thus not updatable).
+    *
+    * When this is returned, [`ChannelManager`] will force-close the channel but *not* broadcast
+    * our current commitment transaction. This avoids a dangerous case where a local disk failure
+    * (e.g. the Linux-default remounting of the disk as read-only) causes [`PermanentFailure`]s
+    * for all monitor updates. If we were to broadcast our latest commitment transaction and then
+    * restart, we could end up reading a previous [`ChannelMonitor`] and [`ChannelManager`],
+    * revoking our now-broadcasted state before seeing it confirm and losing all our funds.
     *
-    * 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.
+    * Note that this is somewhat of a tradeoff - if the disk is really gone and we may have lost
+    * the data permanently, we really should broadcast immediately. If the data can be recovered
+    * with manual intervention, we'd rather close the channel, rejecting future updates to it,
+    * and broadcast the latest state only if we have HTLCs to claim which are timing out (which
+    * we do as long as blocks are connected).
     *
-    * This failure may also signal a failure to update the local persisted copy of one of
-    * the channel monitor instance.
+    * In order to broadcast the latest local commitment transaction, you'll need to call
+    * [`ChannelMonitor::get_latest_holder_commitment_txn`] and broadcast the resulting
+    * transactions once you've safely ensured no further channel updates can be generated by your
+    * [`ChannelManager`].
     *
-    * 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)
+    * Note that at least one final [`ChannelMonitorUpdate`] may still be provided, which must
+    * still be processed by a running [`ChannelMonitor`]. This final update will mark the
+    * [`ChannelMonitor`] as finalized, ensuring no further updates (e.g. revocation of the latest
+    * commitment transaction) are allowed.
+    *
+    * Note that even if you return a [`PermanentFailure`] due to unavailability of secondary
+    * [`ChannelMonitor`] copies, you should still make an attempt to store the update where
+    * possible to ensure you can claim HTLC outputs on the latest commitment transaction
+    * broadcasted later.
     *
     * In case of distributed watchtowers deployment, the new version must be written to disk, as
     * state may have been stored but rejected due to a block forcing a commitment broadcast. This
     * storage is used to claim outputs of rejected state confirmed onchain by another watchtower,
     * lagging behind on block processing.
+    *
+    * [`PermanentFailure`]: ChannelMonitorUpdateStatus::PermanentFailure
+    * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
     */
-   LDKChannelMonitorUpdateErr_PermanentFailure,
+   LDKChannelMonitorUpdateStatus_PermanentFailure,
    /**
     * Must be last for serialization purposes
     */
-   LDKChannelMonitorUpdateErr_Sentinel,
-} LDKChannelMonitorUpdateErr;
+   LDKChannelMonitorUpdateStatus_Sentinel,
+} LDKChannelMonitorUpdateStatus;
 
 /**
  * An enum that represents the speed at which we want a transaction to confirm used for feerate
@@ -680,24 +695,54 @@ typedef struct LDKCResult_BlindedRouteNoneZ {
    bool result_ok;
 } LDKCResult_BlindedRouteNoneZ;
 
-
-
 /**
  * An error in decoding a message or struct.
  */
-typedef struct MUST_USE_STRUCT LDKDecodeError {
+typedef enum LDKDecodeError_Tag {
    /**
-    * A pointer to the opaque Rust object.
-    * Nearly everywhere, inner must be non-null, however in places where
-    * the Rust equivalent takes an Option, it may be set to null to indicate None.
+    * A version byte specified something we don't know how to handle.
+    * Includes unknown realm byte in an OnionHopData packet
     */
-   LDKnativeDecodeError *inner;
+   LDKDecodeError_UnknownVersion,
    /**
-    * Indicates that this is the only struct which contains the same pointer.
-    * Rust functions which take ownership of an object provided via an argument require
-    * this to be true and invalidate the object pointed to by inner.
+    * Unknown feature mandating we fail to parse message (eg TLV with an even, unknown type)
     */
-   bool is_owned;
+   LDKDecodeError_UnknownRequiredFeature,
+   /**
+    * Value was invalid, eg a byte which was supposed to be a bool was something other than a 0
+    * or 1, a public key/private key/signature was invalid, text wasn't UTF-8, TLV was
+    * syntactically incorrect, etc
+    */
+   LDKDecodeError_InvalidValue,
+   /**
+    * Buffer too short
+    */
+   LDKDecodeError_ShortRead,
+   /**
+    * A length descriptor in the packet didn't describe the later data correctly
+    */
+   LDKDecodeError_BadLengthDescriptor,
+   /**
+    * Error from std::io
+    */
+   LDKDecodeError_Io,
+   /**
+    * The message included zlib-compressed values, which we don't support.
+    */
+   LDKDecodeError_UnsupportedCompression,
+   /**
+    * Must be last for serialization purposes
+    */
+   LDKDecodeError_Sentinel,
+} LDKDecodeError_Tag;
+
+typedef struct MUST_USE_STRUCT LDKDecodeError {
+   LDKDecodeError_Tag tag;
+   union {
+      struct {
+         enum LDKIOError io;
+      };
+   };
 } LDKDecodeError;
 
 /**
@@ -2588,13 +2633,21 @@ typedef enum LDKClosureReason_Tag {
     * The peer disconnected prior to funding completing. In this case the spec mandates that we
     * forget the channel entirely - we can attempt again if the peer reconnects.
     *
+    * This includes cases where we restarted prior to funding completion, including prior to the
+    * initial [`ChannelMonitor`] persistence completing.
+    *
     * In LDK versions prior to 0.0.107 this could also occur if we were unable to connect to the
     * peer because of mutual incompatibility between us and our channel counterparty.
+    *
+    * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
     */
    LDKClosureReason_DisconnectedPeer,
    /**
-    * Closure generated from `ChannelManager::read` if the ChannelMonitor is newer than
-    * the ChannelManager deserialized.
+    * Closure generated from `ChannelManager::read` if the [`ChannelMonitor`] is newer than
+    * the [`ChannelManager`] deserialized.
+    *
+    * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
+    * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
     */
    LDKClosureReason_OutdatedChannelManager,
    /**
@@ -2855,7 +2908,7 @@ typedef enum LDKNetworkUpdate_Tag {
    LDKNetworkUpdate_ChannelFailure,
    /**
     * An error indicating that a node failed to route a payment, which should be applied via
-    * [`NetworkGraph::node_failed`].
+    * [`NetworkGraph::node_failed_permanent`] if permanent.
     */
    LDKNetworkUpdate_NodeFailure,
    /**
@@ -4709,38 +4762,6 @@ typedef struct LDKCVec_TxidZ {
    uintptr_t datalen;
 } LDKCVec_TxidZ;
 
-/**
- * The contents of CResult_NoneChannelMonitorUpdateErrZ
- */
-typedef union LDKCResult_NoneChannelMonitorUpdateErrZPtr {
-   /**
-    * Note that this value is always NULL, as there are no contents in the OK variant
-    */
-   void *result;
-   /**
-    * A pointer to the contents in the error state.
-    * Reading from this pointer when `result_ok` is set is undefined.
-    */
-   enum LDKChannelMonitorUpdateErr *err;
-} LDKCResult_NoneChannelMonitorUpdateErrZPtr;
-
-/**
- * A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
- * containing a () on success and a crate::lightning::chain::ChannelMonitorUpdateErr on failure.
- * `result_ok` indicates the overall state, and the contents are provided via `contents`.
- */
-typedef struct LDKCResult_NoneChannelMonitorUpdateErrZ {
-   /**
-    * The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
-    * `err` or `result` depending on the state of `result_ok`.
-    */
-   union LDKCResult_NoneChannelMonitorUpdateErrZPtr contents;
-   /**
-    * Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
-    */
-   bool result_ok;
-} LDKCResult_NoneChannelMonitorUpdateErrZ;
-
 
 
 /**
@@ -4777,16 +4798,16 @@ typedef enum LDKMonitorEvent_Tag {
    LDKMonitorEvent_CommitmentTxConfirmed,
    /**
     * Indicates a [`ChannelMonitor`] update has completed. See
-    * [`ChannelMonitorUpdateErr::TemporaryFailure`] for more information on how this is used.
+    * [`ChannelMonitorUpdateStatus::InProgress`] for more information on how this is used.
     *
-    * [`ChannelMonitorUpdateErr::TemporaryFailure`]: super::ChannelMonitorUpdateErr::TemporaryFailure
+    * [`ChannelMonitorUpdateStatus::InProgress`]: super::ChannelMonitorUpdateStatus::InProgress
     */
-   LDKMonitorEvent_UpdateCompleted,
+   LDKMonitorEvent_Completed,
    /**
     * Indicates a [`ChannelMonitor`] update has failed. See
-    * [`ChannelMonitorUpdateErr::PermanentFailure`] for more information on how this is used.
+    * [`ChannelMonitorUpdateStatus::PermanentFailure`] for more information on how this is used.
     *
-    * [`ChannelMonitorUpdateErr::PermanentFailure`]: super::ChannelMonitorUpdateErr::PermanentFailure
+    * [`ChannelMonitorUpdateStatus::PermanentFailure`]: super::ChannelMonitorUpdateStatus::PermanentFailure
     */
    LDKMonitorEvent_UpdateFailed,
    /**
@@ -4795,7 +4816,7 @@ typedef enum LDKMonitorEvent_Tag {
    LDKMonitorEvent_Sentinel,
 } LDKMonitorEvent_Tag;
 
-typedef struct LDKMonitorEvent_LDKUpdateCompleted_Body {
+typedef struct LDKMonitorEvent_LDKCompleted_Body {
    /**
     * The funding outpoint of the [`ChannelMonitor`] that was updated
     */
@@ -4808,7 +4829,7 @@ typedef struct LDKMonitorEvent_LDKUpdateCompleted_Body {
     * same [`ChannelMonitor`] have been applied and persisted.
     */
    uint64_t monitor_update_id;
-} LDKMonitorEvent_LDKUpdateCompleted_Body;
+} LDKMonitorEvent_LDKCompleted_Body;
 
 typedef struct MUST_USE_STRUCT LDKMonitorEvent {
    LDKMonitorEvent_Tag tag;
@@ -4819,7 +4840,7 @@ typedef struct MUST_USE_STRUCT LDKMonitorEvent {
       struct {
          struct LDKOutPoint commitment_tx_confirmed;
       };
-      LDKMonitorEvent_LDKUpdateCompleted_Body update_completed;
+      LDKMonitorEvent_LDKCompleted_Body completed;
       struct {
          struct LDKOutPoint update_failed;
       };
@@ -5052,19 +5073,28 @@ typedef struct MUST_USE_STRUCT LDKNetworkGraph {
 /**
  * [`Score`] implementation using channel success probability distributions.
  *
- * Based on *Optimally Reliable & Cheap Payment Flows on the Lightning Network* by Rene Pickhardt
- * and Stefan Richter [[1]]. Given the uncertainty of channel liquidity balances, probability
- * distributions are defined based on knowledge learned from successful and unsuccessful attempts.
- * Then the negative `log10` of the success probability is used to determine the cost of routing a
- * specific HTLC amount through a channel.
+ * Channels are tracked with upper and lower liquidity bounds - when an HTLC fails at a channel,
+ * we learn that the upper-bound on the available liquidity is lower than the amount of the HTLC.
+ * When a payment is forwarded through a channel (but fails later in the route), we learn the
+ * lower-bound on the channel's available liquidity must be at least the value of the HTLC.
+ *
+ * These bounds are then used to determine a success probability using the formula from
+ * *Optimally Reliable & Cheap Payment Flows on the Lightning Network* by Rene Pickhardt
+ * and Stefan Richter [[1]] (i.e. `(upper_bound - payment_amount) / (upper_bound - lower_bound)`).
  *
- * Knowledge about channel liquidity balances takes the form of upper and lower bounds on the
- * possible liquidity. Certainty of the bounds is decreased over time using a decay function. See
- * [`ProbabilisticScoringParameters`] for details.
+ * This probability is combined with the [`liquidity_penalty_multiplier_msat`] and
+ * [`liquidity_penalty_amount_multiplier_msat`] parameters to calculate a concrete penalty in
+ * milli-satoshis. The penalties, when added across all hops, have the property of being linear in
+ * terms of the entire path's success probability. This allows the router to directly compare
+ * penalties for different paths. See the documentation of those parameters for the exact formulas.
  *
- * Since the scorer aims to learn the current channel liquidity balances, it works best for nodes
- * with high payment volume or that actively probe the [`NetworkGraph`]. Nodes with low payment
- * volume are more likely to experience failed payment paths, which would need to be retried.
+ * The liquidity bounds are decayed by halving them every [`liquidity_offset_half_life`].
+ *
+ * Further, we track the history of our upper and lower liquidity bounds for each channel,
+ * allowing us to assign a second penalty (using [`historical_liquidity_penalty_multiplier_msat`]
+ * and [`historical_liquidity_penalty_amount_multiplier_msat`]) based on the same probability
+ * formula, but using the history of a channel rather than our latest estimates for the liquidity
+ * bounds.
  *
  * # Note
  *
@@ -5072,6 +5102,11 @@ typedef struct MUST_USE_STRUCT LDKNetworkGraph {
  * behavior.
  *
  * [1]: https://arxiv.org/abs/2107.05322
+ * [`liquidity_penalty_multiplier_msat`]: ProbabilisticScoringParameters::liquidity_penalty_multiplier_msat
+ * [`liquidity_penalty_amount_multiplier_msat`]: ProbabilisticScoringParameters::liquidity_penalty_amount_multiplier_msat
+ * [`liquidity_offset_half_life`]: ProbabilisticScoringParameters::liquidity_offset_half_life
+ * [`historical_liquidity_penalty_multiplier_msat`]: ProbabilisticScoringParameters::historical_liquidity_penalty_multiplier_msat
+ * [`historical_liquidity_penalty_amount_multiplier_msat`]: ProbabilisticScoringParameters::historical_liquidity_penalty_amount_multiplier_msat
  */
 typedef struct MUST_USE_STRUCT LDKProbabilisticScorer {
    /**
@@ -6417,6 +6452,38 @@ typedef struct LDKCResult_SecretKeyNoneZ {
    bool result_ok;
 } LDKCResult_SecretKeyNoneZ;
 
+/**
+ * The contents of CResult_PublicKeyNoneZ
+ */
+typedef union LDKCResult_PublicKeyNoneZPtr {
+   /**
+    * A pointer to the contents in the success state.
+    * Reading from this pointer when `result_ok` is not set is undefined.
+    */
+   struct LDKPublicKey *result;
+   /**
+    * Note that this value is always NULL, as there are no contents in the Err variant
+    */
+   void *err;
+} LDKCResult_PublicKeyNoneZPtr;
+
+/**
+ * A CResult_PublicKeyNoneZ represents the result of a fallible operation,
+ * containing a crate::c_types::PublicKey on success and a () on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_PublicKeyNoneZ {
+   /**
+    * The contents of this CResult_PublicKeyNoneZ, accessible via either
+    * `err` or `result` depending on the state of `result_ok`.
+    */
+   union LDKCResult_PublicKeyNoneZPtr contents;
+   /**
+    * Whether this CResult_PublicKeyNoneZ represents a success state.
+    */
+   bool result_ok;
+} LDKCResult_PublicKeyNoneZ;
+
 /**
  * An enum which can either contain a crate::c_types::BigEndianScalar or not
  */
@@ -6695,6 +6762,11 @@ typedef struct LDKBaseSign {
     * chosen to forgo their output as dust.
     */
    struct LDKCResult_SignatureNoneZ (*sign_closing_transaction)(const void *this_arg, const struct LDKClosingTransaction *NONNULL_PTR closing_tx);
+   /**
+    * Computes the signature for a commitment transaction's anchor output used as an
+    * input within `anchor_tx`, which spends the commitment transaction, at index `input`.
+    */
+   struct LDKCResult_SignatureNoneZ (*sign_holder_anchor_input)(const void *this_arg, struct LDKTransaction anchor_tx, uintptr_t input);
    /**
     * Signs a channel announcement message with our funding key and our node secret key (aka
     * node_id or network_key), proving it comes from one of the channel participants.
@@ -7166,10 +7238,16 @@ typedef enum LDKAPIError_Tag {
     */
    LDKAPIError_ChannelUnavailable,
    /**
-    * An attempt to call watch/update_channel returned an Err (ie you did this!), causing the
-    * attempted action to fail.
+    * An attempt to call [`chain::Watch::watch_channel`]/[`chain::Watch::update_channel`]
+    * returned a [`ChannelMonitorUpdateStatus::InProgress`] indicating the persistence of a
+    * monitor update is awaiting async resolution. Once it resolves the attempted action should
+    * complete automatically.
+    *
+    * [`chain::Watch::watch_channel`]: crate::chain::Watch::watch_channel
+    * [`chain::Watch::update_channel`]: crate::chain::Watch::update_channel
+    * [`ChannelMonitorUpdateStatus::InProgress`]: crate::chain::ChannelMonitorUpdateStatus::InProgress
     */
-   LDKAPIError_MonitorUpdateFailed,
+   LDKAPIError_MonitorUpdateInProgress,
    /**
     * [`KeysInterface::get_shutdown_scriptpubkey`] returned a shutdown scriptpubkey incompatible
     * with the channel counterparty as negotiated in [`InitFeatures`].
@@ -7368,13 +7446,13 @@ typedef enum LDKPaymentSendFailure_Tag {
     * in over-/re-payment.
     *
     * The results here are ordered the same as the paths in the route object which was passed to
-    * send_payment, and any Errs which are not APIError::MonitorUpdateFailed can be safely
-    * retried (though there is currently no API with which to do so).
+    * send_payment, and any `Err`s which are not [`APIError::MonitorUpdateInProgress`] can be
+    * safely retried via [`ChannelManager::retry_payment`].
     *
-    * Any entries which contain Err(APIError::MonitorUpdateFailed) or Ok(()) MUST NOT be retried
-    * as they will result in over-/re-payment. These HTLCs all either successfully sent (in the
-    * case of Ok(())) or will send once channel_monitor_updated is called on the next-hop channel
-    * with the latest update_id.
+    * Any entries which contain `Err(APIError::MonitorUpdateInprogress)` or `Ok(())` MUST NOT be
+    * retried as they will result in over-/re-payment. These HTLCs all either successfully sent
+    * (in the case of `Ok(())`) or will send once a [`MonitorEvent::Completed`] is provided for
+    * the next-hop channel with the latest update_id.
     */
    LDKPaymentSendFailure_PartialFailure,
    /**
@@ -7976,10 +8054,10 @@ typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate {
  * 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
+ * funds in the channel. See [`ChannelMonitorUpdateStatus`] for more details about how to handle
  * multiple instances.
  *
- * [`PermanentFailure`]: ChannelMonitorUpdateErr::PermanentFailure
+ * [`PermanentFailure`]: ChannelMonitorUpdateStatus::PermanentFailure
  */
 typedef struct LDKWatch {
    /**
@@ -7994,23 +8072,23 @@ typedef struct LDKWatch {
     * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means
     * calling [`block_connected`] and [`block_disconnected`] on the monitor.
     *
-    * Note: this interface MUST error with `ChannelMonitorUpdateErr::PermanentFailure` if
+    * Note: this interface MUST error with [`ChannelMonitorUpdateStatus::PermanentFailure`] if
     * the given `funding_txo` has previously been registered via `watch_channel`.
     *
     * [`get_outputs_to_watch`]: channelmonitor::ChannelMonitor::get_outputs_to_watch
     * [`block_connected`]: channelmonitor::ChannelMonitor::block_connected
     * [`block_disconnected`]: channelmonitor::ChannelMonitor::block_disconnected
     */
-   struct LDKCResult_NoneChannelMonitorUpdateErrZ (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor);
+   enum LDKChannelMonitorUpdateStatus (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor);
    /**
     * 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.
+    * [`ChannelMonitorUpdateStatus`] for invariants around returning an error.
     *
     * [`update_monitor`]: channelmonitor::ChannelMonitor::update_monitor
     */
-   struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update);
+   enum LDKChannelMonitorUpdateStatus (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update);
    /**
     * Returns any monitor events since the last call. Subsequent calls must only return new
     * events.
@@ -8020,7 +8098,7 @@ typedef struct LDKWatch {
     * to disk.
     *
     * For details on asynchronous [`ChannelMonitor`] updating and returning
-    * [`MonitorEvent::UpdateCompleted`] here, see [`ChannelMonitorUpdateErr::TemporaryFailure`].
+    * [`MonitorEvent::Completed`] here, see [`ChannelMonitorUpdateStatus::InProgress`].
     */
    struct LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ (*release_pending_monitor_events)(const void *this_arg);
    /**
@@ -8081,13 +8159,29 @@ typedef struct LDKKeysInterface {
     *
     * This method must return the same value each time it is called with a given `Recipient`
     * parameter.
+    *
+    * Errors if the `Recipient` variant is not supported by the implementation.
     */
    struct LDKCResult_SecretKeyNoneZ (*get_node_secret)(const void *this_arg, enum LDKRecipient recipient);
+   /**
+    * Get node id based on the provided [`Recipient`]. This public key corresponds to the secret in
+    * [`get_node_secret`].
+    *
+    * This method must return the same value each time it is called with a given `Recipient`
+    * parameter.
+    *
+    * Errors if the `Recipient` variant is not supported by the implementation.
+    *
+    * [`get_node_secret`]: KeysInterface::get_node_secret
+    */
+   struct LDKCResult_PublicKeyNoneZ (*get_node_id)(const void *this_arg, enum LDKRecipient recipient);
    /**
     * Gets the ECDH shared secret of our [`node secret`] and `other_key`, multiplying by `tweak` if
     * one is provided. Note that this tweak can be applied to `other_key` instead of our node
     * secret, though this is less efficient.
     *
+    * Errors if the `Recipient` variant is not supported by the implementation.
+    *
     * [`node secret`]: Self::get_node_secret
     */
    struct LDKCResult_SharedSecretNoneZ (*ecdh)(const void *this_arg, enum LDKRecipient recipient, struct LDKPublicKey other_key, struct LDKCOption_ScalarZ tweak);
@@ -8137,6 +8231,8 @@ typedef struct LDKKeysInterface {
     * The hrp is ascii bytes, while the invoice data is base32.
     *
     * The secret key used to sign the invoice is dependent on the [`Recipient`].
+    *
+    * Errors if the `Recipient` variant is not supported by the implementation.
     */
    struct LDKCResult_RecoverableSignatureNoneZ (*sign_invoice)(const void *this_arg, struct LDKu8slice hrp_bytes, struct LDKCVec_u5Z invoice_data, enum LDKRecipient receipient);
    /**
@@ -9745,6 +9841,90 @@ typedef struct LDKCVec_C2Tuple_PublicKeyTypeZZ {
    uintptr_t datalen;
 } LDKCVec_C2Tuple_PublicKeyTypeZZ;
 
+/**
+ * The contents of a custom onion message.
+ */
+typedef struct LDKCustomOnionMessageContents {
+   /**
+    * An opaque pointer which is passed to your function implementations as an argument.
+    * This has no meaning in the LDK, and can be NULL or any other value.
+    */
+   void *this_arg;
+   /**
+    * Returns the TLV type identifying the message contents. MUST be >= 64.
+    */
+   uint64_t (*tlv_type)(const void *this_arg);
+   /**
+    * Serialize the object into a byte array
+    */
+   struct LDKCVec_u8Z (*write)(const void *this_arg);
+   /**
+    * Frees any resources associated with this object given its this_arg pointer.
+    * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+    */
+   void (*free)(void *this_arg);
+} LDKCustomOnionMessageContents;
+
+/**
+ * An enum which can either contain a crate::lightning::onion_message::packet::CustomOnionMessageContents or not
+ */
+typedef enum LDKCOption_CustomOnionMessageContentsZ_Tag {
+   /**
+    * When we're in this state, this COption_CustomOnionMessageContentsZ contains a crate::lightning::onion_message::packet::CustomOnionMessageContents
+    */
+   LDKCOption_CustomOnionMessageContentsZ_Some,
+   /**
+    * When we're in this state, this COption_CustomOnionMessageContentsZ contains nothing
+    */
+   LDKCOption_CustomOnionMessageContentsZ_None,
+   /**
+    * Must be last for serialization purposes
+    */
+   LDKCOption_CustomOnionMessageContentsZ_Sentinel,
+} LDKCOption_CustomOnionMessageContentsZ_Tag;
+
+typedef struct LDKCOption_CustomOnionMessageContentsZ {
+   LDKCOption_CustomOnionMessageContentsZ_Tag tag;
+   union {
+      struct {
+         struct LDKCustomOnionMessageContents some;
+      };
+   };
+} LDKCOption_CustomOnionMessageContentsZ;
+
+/**
+ * The contents of CResult_COption_CustomOnionMessageContentsZDecodeErrorZ
+ */
+typedef union LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
+   /**
+    * A pointer to the contents in the success state.
+    * Reading from this pointer when `result_ok` is not set is undefined.
+    */
+   struct LDKCOption_CustomOnionMessageContentsZ *result;
+   /**
+    * A pointer to the contents in the error state.
+    * Reading from this pointer when `result_ok` is set is undefined.
+    */
+   struct LDKDecodeError *err;
+} LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr;
+
+/**
+ * A CResult_COption_CustomOnionMessageContentsZDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::c_types::derived::COption_CustomOnionMessageContentsZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
+   /**
+    * The contents of this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ, accessible via either
+    * `err` or `result` depending on the state of `result_ok`.
+    */
+   union LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr contents;
+   /**
+    * Whether this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ represents a success state.
+    */
+   bool result_ok;
+} LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ;
+
 /**
  * An enum which can either contain a crate::lightning::ln::msgs::NetAddress or not
  */
@@ -9895,7 +10075,7 @@ typedef struct LDKCResult_boolPeerHandleErrorZ {
 /**
  * Errors that may occur when [sending an onion message].
  *
- * [sending an onion message]: OnionMessenger::send_onion_message
+ * [sending an onion message]: OnionMessenger::send_custom_onion_message
  */
 typedef enum LDKSendError_Tag {
    /**
@@ -9916,6 +10096,10 @@ typedef enum LDKSendError_Tag {
     * Our next-hop peer was offline or does not support onion message forwarding.
     */
    LDKSendError_InvalidFirstHop,
+   /**
+    * Onion message contents must have a TLV type >= 64.
+    */
+   LDKSendError_InvalidMessage,
    /**
     * Our next-hop peer's buffer was full or our total outbound buffer was full.
     */
@@ -11679,9 +11863,9 @@ typedef struct MUST_USE_STRUCT LDKWatchedOutput {
  * 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`].
+ * invocation that has called the `Filter` must return [`InProgress`].
  *
- * [`TemporaryFailure`]: ChannelMonitorUpdateErr::TemporaryFailure
+ * [`InProgress`]: ChannelMonitorUpdateStatus::InProgress
  * [BIP 157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki
  * [BIP 158]: https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki
  */
@@ -12284,20 +12468,21 @@ typedef struct MUST_USE_STRUCT LDKMonitorUpdateId {
  *
  * Each method can return three possible values:
  *  * If persistence (including any relevant `fsync()` calls) happens immediately, the
- *    implementation should return `Ok(())`, indicating normal channel operation should continue.
+ *    implementation should return [`ChannelMonitorUpdateStatus::Completed`], indicating normal
+ *    channel operation should continue.
  *  * If persistence happens asynchronously, implementations should first ensure the
  *    [`ChannelMonitor`] or [`ChannelMonitorUpdate`] are written durably to disk, and then return
- *    `Err(ChannelMonitorUpdateErr::TemporaryFailure)` while the update continues in the
- *    background. Once the update completes, [`ChainMonitor::channel_monitor_updated`] should be
- *    called with the corresponding [`MonitorUpdateId`].
+ *    [`ChannelMonitorUpdateStatus::InProgress`] while the update continues in the background.
+ *    Once the update completes, [`ChainMonitor::channel_monitor_updated`] should be called with
+ *    the corresponding [`MonitorUpdateId`].
  *
  *    Note that unlike the direct [`chain::Watch`] interface,
  *    [`ChainMonitor::channel_monitor_updated`] must be called once for *each* update which occurs.
  *
  *  * If persistence fails for some reason, implementations should return
- *    `Err(ChannelMonitorUpdateErr::PermanentFailure)`, in which case the channel will likely be
+ *    [`ChannelMonitorUpdateStatus::PermanentFailure`], in which case the channel will likely be
  *    closed without broadcasting the latest state. See
- *    [`ChannelMonitorUpdateErr::PermanentFailure`] for more details.
+ *    [`ChannelMonitorUpdateStatus::PermanentFailure`] for more details.
  */
 typedef struct LDKPersist {
    /**
@@ -12314,15 +12499,15 @@ typedef struct LDKPersist {
     * and the stored channel data). Note that you **must** persist every new monitor to disk.
     *
     * The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`],
-    * if you return [`ChannelMonitorUpdateErr::TemporaryFailure`].
+    * if you return [`ChannelMonitorUpdateStatus::InProgress`].
     *
     * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`
-    * and [`ChannelMonitorUpdateErr`] for requirements when returning errors.
+    * and [`ChannelMonitorUpdateStatus`] for requirements when returning errors.
     *
     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
     * [`Writeable::write`]: crate::util::ser::Writeable::write
     */
-   struct LDKCResult_NoneChannelMonitorUpdateErrZ (*persist_new_channel)(const void *this_arg, struct LDKOutPoint channel_id, const struct LDKChannelMonitor *NONNULL_PTR data, struct LDKMonitorUpdateId update_id);
+   enum LDKChannelMonitorUpdateStatus (*persist_new_channel)(const void *this_arg, struct LDKOutPoint channel_id, const struct LDKChannelMonitor *NONNULL_PTR data, struct LDKMonitorUpdateId update_id);
    /**
     * Update one channel's data. The provided [`ChannelMonitor`] has already applied the given
     * update.
@@ -12350,17 +12535,17 @@ typedef struct LDKPersist {
     * whereas updates are small and `O(1)`.
     *
     * The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`],
-    * if you return [`ChannelMonitorUpdateErr::TemporaryFailure`].
+    * if you return [`ChannelMonitorUpdateStatus::InProgress`].
     *
     * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`,
     * [`Writeable::write`] on [`ChannelMonitorUpdate`] for writing out an update, and
-    * [`ChannelMonitorUpdateErr`] for requirements when returning errors.
+    * [`ChannelMonitorUpdateStatus`] for requirements when returning errors.
     *
     * [`Writeable::write`]: crate::util::ser::Writeable::write
     *
     * Note that update (or a relevant inner pointer) may be NULL or all-0s to represent None
     */
-   struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_persisted_channel)(const void *this_arg, struct LDKOutPoint channel_id, const struct LDKChannelMonitorUpdate *NONNULL_PTR update, const struct LDKChannelMonitor *NONNULL_PTR data, struct LDKMonitorUpdateId update_id);
+   enum LDKChannelMonitorUpdateStatus (*update_persisted_channel)(const void *this_arg, struct LDKOutPoint channel_id, const struct LDKChannelMonitorUpdate *NONNULL_PTR update, const struct LDKChannelMonitor *NONNULL_PTR data, struct LDKMonitorUpdateId update_id);
    /**
     * Frees any resources associated with this object given its this_arg pointer.
     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
@@ -12563,12 +12748,19 @@ typedef struct LDKChannelMessageHandler {
     * is believed to be possible in the future (eg they're sending us messages we don't
     * understand or indicate they require unknown feature bits), no_connection_possible is set
     * and any outstanding channels should be failed.
+    *
+    * Note that in some rare cases this may be called without a corresponding
+    * [`Self::peer_connected`].
     */
    void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id, bool no_connection_possible);
    /**
     * Handle a peer reconnecting, possibly generating channel_reestablish message(s).
+    *
+    * May return an `Err(())` if the features the peer supports are not sufficient to communicate
+    * with us. Implementors should be somewhat conservative about doing so, however, as other
+    * message handlers may still wish to communicate with this peer.
     */
-   void (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg);
+   struct LDKCResult_NoneNoneZ (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg);
    /**
     * Handle an incoming channel_reestablish message from the given peer.
     */
@@ -12763,8 +12955,12 @@ typedef struct LDKRoutingMessageHandler {
     * Called when a connection is established with a peer. This can be used to
     * perform routing table synchronization using a strategy defined by the
     * implementor.
+    *
+    * May return an `Err(())` if the features the peer supports are not sufficient to communicate
+    * with us. Implementors should be somewhat conservative about doing so, however, as other
+    * message handlers may still wish to communicate with this peer.
     */
-   void (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init);
+   struct LDKCResult_NoneNoneZ (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init);
    /**
     * Handles the reply of a query we initiated to learn about channels
     * for a given range of blocks. We can expect to receive one or more
@@ -12829,11 +13025,18 @@ typedef struct LDKOnionMessageHandler {
    /**
     * Called when a connection is established with a peer. Can be used to track which peers
     * advertise onion message support and are online.
+    *
+    * May return an `Err(())` if the features the peer supports are not sufficient to communicate
+    * with us. Implementors should be somewhat conservative about doing so, however, as other
+    * message handlers may still wish to communicate with this peer.
     */
-   void (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init);
+   struct LDKCResult_NoneNoneZ (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init);
    /**
     * Indicates a connection to the peer failed/an existing connection was lost. Allows handlers to
     * drop and refuse to forward onion messages to this peer.
+    *
+    * Note that in some rare cases this may be called without a corresponding
+    * [`Self::peer_connected`].
     */
    void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id, bool no_connection_possible);
    /**
@@ -12938,6 +13141,40 @@ typedef struct MUST_USE_STRUCT LDKIgnoringMessageHandler {
    bool is_owned;
 } LDKIgnoringMessageHandler;
 
+/**
+ * Handler for custom onion messages. If you are using [`SimpleArcOnionMessenger`],
+ * [`SimpleRefOnionMessenger`], or prefer to ignore inbound custom onion messages,
+ * [`IgnoringMessageHandler`] must be provided to [`OnionMessenger::new`]. Otherwise, a custom
+ * implementation of this trait must be provided, with [`CustomMessage`] specifying the supported
+ * message types.
+ *
+ * See [`OnionMessenger`] for example usage.
+ *
+ * [`IgnoringMessageHandler`]: crate::ln::peer_handler::IgnoringMessageHandler
+ * [`CustomMessage`]: Self::CustomMessage
+ */
+typedef struct LDKCustomOnionMessageHandler {
+   /**
+    * An opaque pointer which is passed to your function implementations as an argument.
+    * This has no meaning in the LDK, and can be NULL or any other value.
+    */
+   void *this_arg;
+   /**
+    * Called with the custom message that was received.
+    */
+   void (*handle_custom_message)(const void *this_arg, struct LDKCustomOnionMessageContents msg);
+   /**
+    * Read a custom message of type `message_type` from `buffer`, returning `Ok(None)` if the
+    * message type is unknown.
+    */
+   struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ (*read_custom_message)(const void *this_arg, uint64_t message_type, struct LDKu8slice buffer);
+   /**
+    * Frees any resources associated with this object given its this_arg pointer.
+    * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+    */
+   void (*free)(void *this_arg);
+} LDKCustomOnionMessageHandler;
+
 
 
 /**
@@ -13327,7 +13564,7 @@ typedef struct MUST_USE_STRUCT LDKProbabilisticScoringParameters {
 /**
  * A sender, receiver and forwarder of onion messages. In upcoming releases, this object will be
  * used to retrieve invoices and fulfill invoice requests from [offers]. Currently, only sending
- * and receiving empty onion messages is supported.
+ * and receiving custom onion messages is supported.
  *
  * # Example
  *
@@ -13336,9 +13573,14 @@ typedef struct MUST_USE_STRUCT LDKProbabilisticScoringParameters {
  * # use bitcoin::hashes::_export::_core::time::Duration;
  * # use bitcoin::secp256k1::{PublicKey, Secp256k1, SecretKey};
  * # use lightning::chain::keysinterface::{InMemorySigner, KeysManager, KeysInterface};
+ * # use lightning::ln::msgs::DecodeError;
+ * # use lightning::ln::peer_handler::IgnoringMessageHandler;
  * # use lightning::onion_message::messenger::{Destination, OnionMessenger};
+ * # use lightning::onion_message::packet::CustomOnionMessageContents;
  * # use lightning::onion_message::blinded_route::BlindedRoute;
  * # use lightning::util::logger::{Logger, Record};
+ * # use lightning::util::ser::{Writeable, Writer};
+ * # use lightning::io;
  * # use std::sync::Arc;
  * # struct FakeLogger {};
  * # impl Logger for FakeLogger {
@@ -13351,28 +13593,42 @@ typedef struct MUST_USE_STRUCT LDKProbabilisticScoringParameters {
  * # let node_secret = SecretKey::from_slice(&hex::decode(\"0101010101010101010101010101010101010101010101010101010101010101\").unwrap()[..]).unwrap();
  * # let secp_ctx = Secp256k1::new();
  * # let hop_node_id1 = PublicKey::from_secret_key(&secp_ctx, &node_secret);
- * # let (hop_node_id2, hop_node_id3, hop_node_id4) = (hop_node_id1, hop_node_id1,
- * hop_node_id1);
+ * # let (hop_node_id2, hop_node_id3, hop_node_id4) = (hop_node_id1, hop_node_id1, hop_node_id1);
  * # let destination_node_id = hop_node_id1;
- * #
+ * # let your_custom_message_handler = IgnoringMessageHandler {};
  * // Create the onion messenger. This must use the same `keys_manager` as is passed to your
  * // ChannelManager.
- * let onion_messenger = OnionMessenger::new(&keys_manager, logger);
- *
- * // Send an empty onion message to a node id.
+ * let onion_messenger = OnionMessenger::new(&keys_manager, logger, your_custom_message_handler);
+ *
+ * # struct YourCustomMessage {}
+ * impl Writeable for YourCustomMessage {
+ * \tfn write<W: Writer>(&self, w: &mut W) -> Result<(), io::Error> {
+ * \t\t# Ok(())
+ * \t\t// Write your custom onion message to `w`
+ * \t}
+ * }
+ * impl CustomOnionMessageContents for YourCustomMessage {
+ * \tfn tlv_type(&self) -> u64 {
+ * \t\t# let your_custom_message_type = 42;
+ * \t\tyour_custom_message_type
+ * \t}
+ * }
+ * // Send a custom onion message to a node id.
  * let intermediate_hops = [hop_node_id1, hop_node_id2];
  * let reply_path = None;
- * onion_messenger.send_onion_message(&intermediate_hops, Destination::Node(destination_node_id), reply_path);
+ * # let your_custom_message = YourCustomMessage {};
+ * onion_messenger.send_custom_onion_message(&intermediate_hops, Destination::Node(destination_node_id), your_custom_message, reply_path);
  *
  * // Create a blinded route to yourself, for someone to send an onion message to.
  * # let your_node_id = hop_node_id1;
  * let hops = [hop_node_id3, hop_node_id4, your_node_id];
  * let blinded_route = BlindedRoute::new(&hops, &keys_manager, &secp_ctx).unwrap();
  *
- * // Send an empty onion message to a blinded route.
+ * // Send a custom onion message to a blinded route.
  * # let intermediate_hops = [hop_node_id1, hop_node_id2];
  * let reply_path = None;
- * onion_messenger.send_onion_message(&intermediate_hops, Destination::BlindedRoute(blinded_route), reply_path);
+ * # let your_custom_message = YourCustomMessage {};
+ * onion_messenger.send_custom_onion_message(&intermediate_hops, Destination::BlindedRoute(blinded_route), your_custom_message, reply_path);
  * ```
  *
  * [offers]: <https://github.com/lightning/bolts/pull/798>
@@ -13466,8 +13722,8 @@ typedef struct MUST_USE_STRUCT LDKFilesystemPersister {
  *   [`ChannelManager`] persistence should be done in the background.
  * * Calling [`ChannelManager::timer_tick_occurred`] and [`PeerManager::timer_tick_occurred`]
  *   at the appropriate intervals.
- * * Calling [`NetworkGraph::remove_stale_channels`] (if a [`GossipSync`] with a [`NetworkGraph`]
- *   is provided to [`BackgroundProcessor::start`]).
+ * * Calling [`NetworkGraph::remove_stale_channels_and_tracking`] (if a [`GossipSync`] with a
+ *   [`NetworkGraph`] is provided to [`BackgroundProcessor::start`]).
  *
  * It will also call [`PeerManager::process_events`] periodically though this shouldn't be relied
  * upon as doing so may result in high latency.
@@ -15031,32 +15287,6 @@ void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactio
  */
 void CVec_TxidZ_free(struct LDKCVec_TxidZ _res);
 
-/**
- * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
- */
-struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_ok(void);
-
-/**
- * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
- */
-struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_err(enum LDKChannelMonitorUpdateErr e);
-
-/**
- * Checks if the given object is currently in the success state
- */
-bool CResult_NoneChannelMonitorUpdateErrZ_is_ok(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR o);
-
-/**
- * Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
- */
-void CResult_NoneChannelMonitorUpdateErrZ_free(struct LDKCResult_NoneChannelMonitorUpdateErrZ _res);
-
-/**
- * Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
- * but with all dynamically-allocated buffers duplicated in new buffers.
- */
-struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_clone(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR orig);
-
 /**
  * Frees the buffer pointed to by `data` if `datalen` is non-0.
  */
@@ -15878,6 +16108,32 @@ void CResult_SecretKeyNoneZ_free(struct LDKCResult_SecretKeyNoneZ _res);
  */
 struct LDKCResult_SecretKeyNoneZ CResult_SecretKeyNoneZ_clone(const struct LDKCResult_SecretKeyNoneZ *NONNULL_PTR orig);
 
+/**
+ * Creates a new CResult_PublicKeyNoneZ in the success state.
+ */
+struct LDKCResult_PublicKeyNoneZ CResult_PublicKeyNoneZ_ok(struct LDKPublicKey o);
+
+/**
+ * Creates a new CResult_PublicKeyNoneZ in the error state.
+ */
+struct LDKCResult_PublicKeyNoneZ CResult_PublicKeyNoneZ_err(void);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_PublicKeyNoneZ_is_ok(const struct LDKCResult_PublicKeyNoneZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_PublicKeyNoneZ.
+ */
+void CResult_PublicKeyNoneZ_free(struct LDKCResult_PublicKeyNoneZ _res);
+
+/**
+ * Creates a new CResult_PublicKeyNoneZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_PublicKeyNoneZ CResult_PublicKeyNoneZ_clone(const struct LDKCResult_PublicKeyNoneZ *NONNULL_PTR orig);
+
 /**
  * Constructs a new COption_ScalarZ containing a crate::c_types::BigEndianScalar
  */
@@ -17234,6 +17490,41 @@ void C2Tuple_PublicKeyTypeZ_free(struct LDKC2Tuple_PublicKeyTypeZ _res);
  */
 void CVec_C2Tuple_PublicKeyTypeZZ_free(struct LDKCVec_C2Tuple_PublicKeyTypeZZ _res);
 
+/**
+ * Constructs a new COption_CustomOnionMessageContentsZ containing a crate::lightning::onion_message::packet::CustomOnionMessageContents
+ */
+struct LDKCOption_CustomOnionMessageContentsZ COption_CustomOnionMessageContentsZ_some(struct LDKCustomOnionMessageContents o);
+
+/**
+ * Constructs a new COption_CustomOnionMessageContentsZ containing nothing
+ */
+struct LDKCOption_CustomOnionMessageContentsZ COption_CustomOnionMessageContentsZ_none(void);
+
+/**
+ * Frees any resources associated with the crate::lightning::onion_message::packet::CustomOnionMessageContents, if we are in the Some state
+ */
+void COption_CustomOnionMessageContentsZ_free(struct LDKCOption_CustomOnionMessageContentsZ _res);
+
+/**
+ * Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the success state.
+ */
+struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(struct LDKCOption_CustomOnionMessageContentsZ o);
+
+/**
+ * Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the error state.
+ */
+struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(const struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_COption_CustomOnionMessageContentsZDecodeErrorZ.
+ */
+void CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ _res);
+
 /**
  * Constructs a new COption_NetAddressZ containing a crate::lightning::ln::msgs::NetAddress
  */
@@ -18454,6 +18745,12 @@ struct LDKClosureReason ClosureReason_disconnected_peer(void);
  */
 struct LDKClosureReason ClosureReason_outdated_channel_manager(void);
 
+/**
+ * Checks if two ClosureReasons contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ */
+bool ClosureReason_eq(const struct LDKClosureReason *NONNULL_PTR a, const struct LDKClosureReason *NONNULL_PTR b);
+
 /**
  * Serialize the ClosureReason object into a byte array which can be read by ClosureReason_read
  */
@@ -18489,6 +18786,12 @@ struct LDKHTLCDestination HTLCDestination_unknown_next_hop(uint64_t requested_fo
  */
 struct LDKHTLCDestination HTLCDestination_failed_payment(struct LDKThirtyTwoBytes payment_hash);
 
+/**
+ * Checks if two HTLCDestinations contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ */
+bool HTLCDestination_eq(const struct LDKHTLCDestination *NONNULL_PTR a, const struct LDKHTLCDestination *NONNULL_PTR b);
+
 /**
  * Serialize the HTLCDestination object into a byte array which can be read by HTLCDestination_read
  */
@@ -18760,15 +19063,21 @@ struct LDKAPIError APIError_route_error(struct LDKStr err);
 struct LDKAPIError APIError_channel_unavailable(struct LDKStr err);
 
 /**
- * Utility method to constructs a new MonitorUpdateFailed-variant APIError
+ * Utility method to constructs a new MonitorUpdateInProgress-variant APIError
  */
-struct LDKAPIError APIError_monitor_update_failed(void);
+struct LDKAPIError APIError_monitor_update_in_progress(void);
 
 /**
  * Utility method to constructs a new IncompatibleShutdownScript-variant APIError
  */
 struct LDKAPIError APIError_incompatible_shutdown_script(struct LDKShutdownScript script);
 
+/**
+ * Checks if two APIErrors contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ */
+bool APIError_eq(const struct LDKAPIError *NONNULL_PTR a, const struct LDKAPIError *NONNULL_PTR b);
+
 /**
  * Frees any resources used by the BigSize, if is_owned is set and inner is non-NULL.
  */
@@ -18794,9 +19103,16 @@ void Hostname_free(struct LDKHostname this_obj);
 struct LDKHostname Hostname_clone(const struct LDKHostname *NONNULL_PTR orig);
 
 /**
- * Returns the length of the hostname.
+ * Checks if two Hostnames contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
  */
-MUST_USE_RES uint8_t Hostname_len(const struct LDKHostname *NONNULL_PTR this_arg);
+bool Hostname_eq(const struct LDKHostname *NONNULL_PTR a, const struct LDKHostname *NONNULL_PTR b);
+
+/**
+ * Returns the length of the hostname.
+ */
+MUST_USE_RES uint8_t Hostname_len(const struct LDKHostname *NONNULL_PTR this_arg);
 
 /**
  * Creates a digital signature of a message given a SecretKey, like the node's secret.
@@ -19627,6 +19943,12 @@ void ChannelConfig_set_cltv_expiry_delta(struct LDKChannelConfig *NONNULL_PTR th
  * to such payments may be sustantial if there are many dust HTLCs present when the
  * channel is force-closed.
  *
+ * The dust threshold for each HTLC is based on the `dust_limit_satoshis` for each party in a
+ * channel negotiated throughout the channel open process, along with the fees required to have
+ * a broadcastable HTLC spending transaction. When a channel supports anchor outputs
+ * (specifically the zero fee HTLC transaction variant), this threshold no longer takes into
+ * account the HTLC transaction fee as it is zero.
+ *
  * This limit is applied for sent, forwarded, and received HTLCs and limits the total
  * exposure across all three types per-channel. Setting this too low may prevent the
  * sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very
@@ -19646,6 +19968,12 @@ uint64_t ChannelConfig_get_max_dust_htlc_exposure_msat(const struct LDKChannelCo
  * to such payments may be sustantial if there are many dust HTLCs present when the
  * channel is force-closed.
  *
+ * The dust threshold for each HTLC is based on the `dust_limit_satoshis` for each party in a
+ * channel negotiated throughout the channel open process, along with the fees required to have
+ * a broadcastable HTLC spending transaction. When a channel supports anchor outputs
+ * (specifically the zero fee HTLC transaction variant), this threshold no longer takes into
+ * account the HTLC transaction fee as it is zero.
+ *
  * This limit is applied for sent, forwarded, and received HTLCs and limits the total
  * exposure across all three types per-channel. Setting this too low may prevent the
  * sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very
@@ -19717,6 +20045,13 @@ MUST_USE_RES struct LDKChannelConfig ChannelConfig_new(uint32_t forwarding_fee_p
  */
 struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig);
 
+/**
+ * Checks if two ChannelConfigs contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+bool ChannelConfig_eq(const struct LDKChannelConfig *NONNULL_PTR a, const struct LDKChannelConfig *NONNULL_PTR b);
+
 /**
  * Creates a "default" ChannelConfig. See struct and individual field documentaiton for details on which values are used.
  */
@@ -19878,6 +20213,13 @@ void BestBlock_free(struct LDKBestBlock this_obj);
  */
 struct LDKBestBlock BestBlock_clone(const struct LDKBestBlock *NONNULL_PTR orig);
 
+/**
+ * Checks if two BestBlocks contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+bool BestBlock_eq(const struct LDKBestBlock *NONNULL_PTR a, const struct LDKBestBlock *NONNULL_PTR b);
+
 /**
  * Constructs a `BestBlock` that represents the genesis block at height 0 of the given
  * network.
@@ -19930,19 +20272,30 @@ void Listen_free(struct LDKListen this_ptr);
 void Confirm_free(struct LDKConfirm this_ptr);
 
 /**
- * Creates a copy of the ChannelMonitorUpdateErr
+ * Creates a copy of the ChannelMonitorUpdateStatus
+ */
+enum LDKChannelMonitorUpdateStatus ChannelMonitorUpdateStatus_clone(const enum LDKChannelMonitorUpdateStatus *NONNULL_PTR orig);
+
+/**
+ * Utility method to constructs a new Completed-variant ChannelMonitorUpdateStatus
+ */
+enum LDKChannelMonitorUpdateStatus ChannelMonitorUpdateStatus_completed(void);
+
+/**
+ * Utility method to constructs a new InProgress-variant ChannelMonitorUpdateStatus
  */
-enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_clone(const enum LDKChannelMonitorUpdateErr *NONNULL_PTR orig);
+enum LDKChannelMonitorUpdateStatus ChannelMonitorUpdateStatus_in_progress(void);
 
 /**
- * Utility method to constructs a new TemporaryFailure-variant ChannelMonitorUpdateErr
+ * Utility method to constructs a new PermanentFailure-variant ChannelMonitorUpdateStatus
  */
-enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_temporary_failure(void);
+enum LDKChannelMonitorUpdateStatus ChannelMonitorUpdateStatus_permanent_failure(void);
 
 /**
- * Utility method to constructs a new PermanentFailure-variant ChannelMonitorUpdateErr
+ * Checks if two ChannelMonitorUpdateStatuss contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
  */
-enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_permanent_failure(void);
+bool ChannelMonitorUpdateStatus_eq(const enum LDKChannelMonitorUpdateStatus *NONNULL_PTR a, const enum LDKChannelMonitorUpdateStatus *NONNULL_PTR b);
 
 /**
  * Calls the free function if one is set
@@ -20003,6 +20356,13 @@ MUST_USE_RES struct LDKWatchedOutput WatchedOutput_new(struct LDKThirtyTwoBytes
  */
 struct LDKWatchedOutput WatchedOutput_clone(const struct LDKWatchedOutput *NONNULL_PTR orig);
 
+/**
+ * Checks if two WatchedOutputs contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+bool WatchedOutput_eq(const struct LDKWatchedOutput *NONNULL_PTR a, const struct LDKWatchedOutput *NONNULL_PTR b);
+
 /**
  * Checks if two WatchedOutputs contain equal inner contents.
  */
@@ -20124,12 +20484,12 @@ MUST_USE_RES struct LDKCVec_OutPointZ ChainMonitor_list_monitors(const struct LD
 
 /**
  * Indicates the persistence of a [`ChannelMonitor`] has completed after
- * [`ChannelMonitorUpdateErr::TemporaryFailure`] was returned from an update operation.
+ * [`ChannelMonitorUpdateStatus::InProgress`] was returned from an update operation.
  *
  * Thus, the anticipated use is, at a high level:
  *  1) This [`ChainMonitor`] calls [`Persist::update_persisted_channel`] which stores the
  *     update to disk and begins updating any remote (e.g. watchtower/backup) copies,
- *     returning [`ChannelMonitorUpdateErr::TemporaryFailure`],
+ *     returning [`ChannelMonitorUpdateStatus::InProgress`],
  *  2) once all remote copies are updated, you call this function with the
  *     `completed_update_id` that completed, and once all pending updates have completed the
  *     channel will be re-enabled.
@@ -20174,12 +20534,14 @@ void ChannelMonitorUpdate_free(struct LDKChannelMonitorUpdate this_obj);
  * increasing and increase by one for each new update, with one exception specified below.
  *
  * This sequence number is also used to track up to which points updates which returned
- * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
+ * [`ChannelMonitorUpdateStatus::InProgress`] have been applied to all copies of a given
  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
  *
  * The only instance where update_id values are not strictly increasing is the case where we
  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
  * its docs for more details.
+ *
+ * [`ChannelMonitorUpdateStatus::InProgress`]: super::ChannelMonitorUpdateStatus::InProgress
  */
 uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr);
 
@@ -20189,12 +20551,14 @@ uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate
  * increasing and increase by one for each new update, with one exception specified below.
  *
  * This sequence number is also used to track up to which points updates which returned
- * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
+ * [`ChannelMonitorUpdateStatus::InProgress`] have been applied to all copies of a given
  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
  *
  * The only instance where update_id values are not strictly increasing is the case where we
  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
  * its docs for more details.
+ *
+ * [`ChannelMonitorUpdateStatus::InProgress`]: super::ChannelMonitorUpdateStatus::InProgress
  */
 void ChannelMonitorUpdate_set_update_id(struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr, uint64_t val);
 
@@ -20234,15 +20598,21 @@ struct LDKMonitorEvent MonitorEvent_htlcevent(struct LDKHTLCUpdate a);
 struct LDKMonitorEvent MonitorEvent_commitment_tx_confirmed(struct LDKOutPoint a);
 
 /**
- * Utility method to constructs a new UpdateCompleted-variant MonitorEvent
+ * Utility method to constructs a new Completed-variant MonitorEvent
  */
-struct LDKMonitorEvent MonitorEvent_update_completed(struct LDKOutPoint funding_txo, uint64_t monitor_update_id);
+struct LDKMonitorEvent MonitorEvent_completed(struct LDKOutPoint funding_txo, uint64_t monitor_update_id);
 
 /**
  * Utility method to constructs a new UpdateFailed-variant MonitorEvent
  */
 struct LDKMonitorEvent MonitorEvent_update_failed(struct LDKOutPoint a);
 
+/**
+ * Checks if two MonitorEvents contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ */
+bool MonitorEvent_eq(const struct LDKMonitorEvent *NONNULL_PTR a, const struct LDKMonitorEvent *NONNULL_PTR b);
+
 /**
  * Serialize the MonitorEvent object into a byte array which can be read by MonitorEvent_read
  */
@@ -20263,6 +20633,13 @@ void HTLCUpdate_free(struct LDKHTLCUpdate this_obj);
  */
 struct LDKHTLCUpdate HTLCUpdate_clone(const struct LDKHTLCUpdate *NONNULL_PTR orig);
 
+/**
+ * Checks if two HTLCUpdates contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+bool HTLCUpdate_eq(const struct LDKHTLCUpdate *NONNULL_PTR a, const struct LDKHTLCUpdate *NONNULL_PTR b);
+
 /**
  * Serialize the HTLCUpdate object into a byte array which can be read by HTLCUpdate_read
  */
@@ -20389,14 +20766,20 @@ MUST_USE_RES struct LDKPublicKey ChannelMonitor_get_counterparty_node_id(const s
 
 /**
  * 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.
+ * the Channel was out-of-date.
+ *
+ * You may also use this to broadcast the latest local commitment transaction, either because
+ * a monitor update failed with [`ChannelMonitorUpdateStatus::PermanentFailure`] or because we've
+ * fallen behind (i.e. we've received proof that our counterparty side knows a revocation
+ * secret we gave them that they shouldn't know).
+ *
+ * Broadcasting these transactions in the second case is UNSAFE, as they allow counterparty
+ * side to punish you. Nevertheless you may want to broadcast them if counterparty doesn't
+ * close channel with their commitment transaction after a substantial amount of time. Best
+ * may be to contact the other node operator out-of-band to coordinate other options available
+ * to you. In any-case, the choice is up to you.
+ *
+ * [`ChannelMonitorUpdateStatus::PermanentFailure`]: super::ChannelMonitorUpdateStatus::PermanentFailure
  */
 MUST_USE_RES struct LDKCVec_TransactionZ ChannelMonitor_get_latest_holder_commitment_txn(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKLogger *NONNULL_PTR logger);
 
@@ -20645,6 +21028,13 @@ MUST_USE_RES struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescri
  */
 struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_clone(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR orig);
 
+/**
+ * Checks if two DelayedPaymentOutputDescriptors contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+bool DelayedPaymentOutputDescriptor_eq(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR a, const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR b);
+
 /**
  * Serialize the DelayedPaymentOutputDescriptor object into a byte array which can be read by DelayedPaymentOutputDescriptor_read
  */
@@ -20716,6 +21106,13 @@ MUST_USE_RES struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescript
  */
 struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_clone(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR orig);
 
+/**
+ * Checks if two StaticPaymentOutputDescriptors contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+bool StaticPaymentOutputDescriptor_eq(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR a, const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR b);
+
 /**
  * Serialize the StaticPaymentOutputDescriptor object into a byte array which can be read by StaticPaymentOutputDescriptor_read
  */
@@ -20751,6 +21148,12 @@ struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_delayed_payment_ou
  */
 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_payment_output(struct LDKStaticPaymentOutputDescriptor a);
 
+/**
+ * Checks if two SpendableOutputDescriptors contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ */
+bool SpendableOutputDescriptor_eq(const struct LDKSpendableOutputDescriptor *NONNULL_PTR a, const struct LDKSpendableOutputDescriptor *NONNULL_PTR b);
+
 /**
  * Serialize the SpendableOutputDescriptor object into a byte array which can be read by SpendableOutputDescriptor_read
  */
@@ -21977,12 +22380,12 @@ void ChannelManager_force_close_all_channels_without_broadcasting_txn(const stru
  * PaymentSendFailure for more info.
  *
  * In general, a path may raise:
- *  * APIError::RouteError when an invalid route or forwarding parameter (cltv_delta, fee,
+ *  * [`APIError::RouteError`] when an invalid route or forwarding parameter (cltv_delta, fee,
  *    node public key) is specified.
- *  * APIError::ChannelUnavailable if the next-hop channel is not available for updates
+ *  * [`APIError::ChannelUnavailable`] if the next-hop channel is not available for updates
  *    (including due to previous monitor update failure or new permanent monitor update
  *    failure).
- *  * APIError::MonitorUpdateFailed if a new monitor update failure prevented sending the
+ *  * [`APIError::MonitorUpdateInProgress`] if a new monitor update failure prevented sending the
  *    relevant updates.
  *
  * Note that depending on the type of the PaymentSendFailure the HTLC may have been
@@ -22417,6 +22820,24 @@ MUST_USE_RES struct LDKBestBlock ChannelManager_current_best_block(const struct
  */
 struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg);
 
+/**
+ * Fetches the set of [`NodeFeatures`] flags which are provided by or required by
+ * [`ChannelManager`].
+ */
+struct LDKNodeFeatures provided_node_features(void);
+
+/**
+ * Fetches the set of [`ChannelFeatures`] flags which are provided by or required by
+ * [`ChannelManager`].
+ */
+struct LDKChannelFeatures provided_channel_features(void);
+
+/**
+ * Fetches the set of [`InitFeatures`] flags which are provided by or required by
+ * [`ChannelManager`].
+ */
+struct LDKInitFeatures provided_init_features(void);
+
 /**
  * Serialize the CounterpartyForwardingInfo object into a byte array which can be read by CounterpartyForwardingInfo_read
  */
@@ -22602,15 +23023,56 @@ struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ create(const struct LDK
 struct LDKCResult_PaymentSecretNoneZ create_from_hash(const struct LDKExpandedKey *NONNULL_PTR keys, struct LDKCOption_u64Z min_value_msat, struct LDKThirtyTwoBytes payment_hash, uint32_t invoice_expiry_delta_secs, uint64_t current_time);
 
 /**
- * Frees any resources used by the DecodeError, if is_owned is set and inner is non-NULL.
+ * Frees any resources used by the DecodeError
  */
-void DecodeError_free(struct LDKDecodeError this_obj);
+void DecodeError_free(struct LDKDecodeError this_ptr);
 
 /**
  * Creates a copy of the DecodeError
  */
 struct LDKDecodeError DecodeError_clone(const struct LDKDecodeError *NONNULL_PTR orig);
 
+/**
+ * Utility method to constructs a new UnknownVersion-variant DecodeError
+ */
+struct LDKDecodeError DecodeError_unknown_version(void);
+
+/**
+ * Utility method to constructs a new UnknownRequiredFeature-variant DecodeError
+ */
+struct LDKDecodeError DecodeError_unknown_required_feature(void);
+
+/**
+ * Utility method to constructs a new InvalidValue-variant DecodeError
+ */
+struct LDKDecodeError DecodeError_invalid_value(void);
+
+/**
+ * Utility method to constructs a new ShortRead-variant DecodeError
+ */
+struct LDKDecodeError DecodeError_short_read(void);
+
+/**
+ * Utility method to constructs a new BadLengthDescriptor-variant DecodeError
+ */
+struct LDKDecodeError DecodeError_bad_length_descriptor(void);
+
+/**
+ * Utility method to constructs a new Io-variant DecodeError
+ */
+struct LDKDecodeError DecodeError_io(enum LDKIOError a);
+
+/**
+ * Utility method to constructs a new UnsupportedCompression-variant DecodeError
+ */
+struct LDKDecodeError DecodeError_unsupported_compression(void);
+
+/**
+ * Checks if two DecodeErrors contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ */
+bool DecodeError_eq(const struct LDKDecodeError *NONNULL_PTR a, const struct LDKDecodeError *NONNULL_PTR b);
+
 /**
  * Frees any resources used by the Init, if is_owned is set and inner is non-NULL.
  */
@@ -22652,6 +23114,13 @@ MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg, struct
  */
 struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig);
 
+/**
+ * Checks if two Inits contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+bool Init_eq(const struct LDKInit *NONNULL_PTR a, const struct LDKInit *NONNULL_PTR b);
+
 /**
  * Frees any resources used by the ErrorMessage, if is_owned is set and inner is non-NULL.
  */
@@ -22699,6 +23168,13 @@ MUST_USE_RES struct LDKErrorMessage ErrorMessage_new(struct LDKThirtyTwoBytes ch
  */
 struct LDKErrorMessage ErrorMessage_clone(const struct LDKErrorMessage *NONNULL_PTR orig);
 
+/**
+ * Checks if two ErrorMessages contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+bool ErrorMessage_eq(const struct LDKErrorMessage *NONNULL_PTR a, const struct LDKErrorMessage *NONNULL_PTR b);
+
 /**
  * Frees any resources used by the WarningMessage, if is_owned is set and inner is non-NULL.
  */
@@ -22744,6 +23220,13 @@ MUST_USE_RES struct LDKWarningMessage WarningMessage_new(struct LDKThirtyTwoByte
  */
 struct LDKWarningMessage WarningMessage_clone(const struct LDKWarningMessage *NONNULL_PTR orig);
 
+/**
+ * Checks if two WarningMessages contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+bool WarningMessage_eq(const struct LDKWarningMessage *NONNULL_PTR a, const struct LDKWarningMessage *NONNULL_PTR b);
+
 /**
  * Frees any resources used by the Ping, if is_owned is set and inner is non-NULL.
  */
@@ -22781,6 +23264,13 @@ MUST_USE_RES struct LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg
  */
 struct LDKPing Ping_clone(const struct LDKPing *NONNULL_PTR orig);
 
+/**
+ * Checks if two Pings contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+bool Ping_eq(const struct LDKPing *NONNULL_PTR a, const struct LDKPing *NONNULL_PTR b);
+
 /**
  * Frees any resources used by the Pong, if is_owned is set and inner is non-NULL.
  */
@@ -22808,6 +23298,13 @@ MUST_USE_RES struct LDKPong Pong_new(uint16_t byteslen_arg);
  */
 struct LDKPong Pong_clone(const struct LDKPong *NONNULL_PTR orig);
 
+/**
+ * Checks if two Pongs contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+bool Pong_eq(const struct LDKPong *NONNULL_PTR a, const struct LDKPong *NONNULL_PTR b);
+
 /**
  * Frees any resources used by the OpenChannel, if is_owned is set and inner is non-NULL.
  */
@@ -23016,6 +23513,13 @@ void OpenChannel_set_channel_type(struct LDKOpenChannel *NONNULL_PTR this_ptr, s
  */
 struct LDKOpenChannel OpenChannel_clone(const struct LDKOpenChannel *NONNULL_PTR orig);
 
+/**
+ * Checks if two OpenChannels contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+bool OpenChannel_eq(const struct LDKOpenChannel *NONNULL_PTR a, const struct LDKOpenChannel *NONNULL_PTR b);
+
 /**
  * Frees any resources used by the AcceptChannel, if is_owned is set and inner is non-NULL.
  */
@@ -23188,6 +23692,13 @@ void AcceptChannel_set_channel_type(struct LDKAcceptChannel *NONNULL_PTR this_pt
  */
 struct LDKAcceptChannel AcceptChannel_clone(const struct LDKAcceptChannel *NONNULL_PTR orig);
 
+/**
+ * Checks if two AcceptChannels contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+bool AcceptChannel_eq(const struct LDKAcceptChannel *NONNULL_PTR a, const struct LDKAcceptChannel *NONNULL_PTR b);
+
 /**
  * Frees any resources used by the FundingCreated, if is_owned is set and inner is non-NULL.
  */
@@ -23243,6 +23754,13 @@ MUST_USE_RES struct LDKFundingCreated FundingCreated_new(struct LDKThirtyTwoByte
  */
 struct LDKFundingCreated FundingCreated_clone(const struct LDKFundingCreated *NONNULL_PTR orig);
 
+/**
+ * Checks if two FundingCreateds contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+bool FundingCreated_eq(const struct LDKFundingCreated *NONNULL_PTR a, const struct LDKFundingCreated *NONNULL_PTR b);
+
 /**
  * Frees any resources used by the FundingSigned, if is_owned is set and inner is non-NULL.
  */
@@ -23278,6 +23796,13 @@ MUST_USE_RES struct LDKFundingSigned FundingSigned_new(struct LDKThirtyTwoBytes
  */
 struct LDKFundingSigned FundingSigned_clone(const struct LDKFundingSigned *NONNULL_PTR orig);
 
+/**
+ * Checks if two FundingSigneds contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+bool FundingSigned_eq(const struct LDKFundingSigned *NONNULL_PTR a, const struct LDKFundingSigned *NONNULL_PTR b);
+
 /**
  * Frees any resources used by the ChannelReady, if is_owned is set and inner is non-NULL.
  */
@@ -23325,6 +23850,13 @@ MUST_USE_RES struct LDKChannelReady ChannelReady_new(struct LDKThirtyTwoBytes ch
  */
 struct LDKChannelReady ChannelReady_clone(const struct LDKChannelReady *NONNULL_PTR orig);
 
+/**
+ * Checks if two ChannelReadys contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+bool ChannelReady_eq(const struct LDKChannelReady *NONNULL_PTR a, const struct LDKChannelReady *NONNULL_PTR b);
+
 /**
  * Frees any resources used by the Shutdown, if is_owned is set and inner is non-NULL.
  */
@@ -23362,6 +23894,13 @@ MUST_USE_RES struct LDKShutdown Shutdown_new(struct LDKThirtyTwoBytes channel_id
  */
 struct LDKShutdown Shutdown_clone(const struct LDKShutdown *NONNULL_PTR orig);
 
+/**
+ * Checks if two Shutdowns contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+bool Shutdown_eq(const struct LDKShutdown *NONNULL_PTR a, const struct LDKShutdown *NONNULL_PTR b);
+
 /**
  * Frees any resources used by the ClosingSignedFeeRange, if is_owned is set and inner is non-NULL.
  */
@@ -23401,6 +23940,13 @@ MUST_USE_RES struct LDKClosingSignedFeeRange ClosingSignedFeeRange_new(uint64_t
  */
 struct LDKClosingSignedFeeRange ClosingSignedFeeRange_clone(const struct LDKClosingSignedFeeRange *NONNULL_PTR orig);
 
+/**
+ * Checks if two ClosingSignedFeeRanges contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+bool ClosingSignedFeeRange_eq(const struct LDKClosingSignedFeeRange *NONNULL_PTR a, const struct LDKClosingSignedFeeRange *NONNULL_PTR b);
+
 /**
  * Frees any resources used by the ClosingSigned, if is_owned is set and inner is non-NULL.
  */
@@ -23462,6 +24008,13 @@ MUST_USE_RES struct LDKClosingSigned ClosingSigned_new(struct LDKThirtyTwoBytes
  */
 struct LDKClosingSigned ClosingSigned_clone(const struct LDKClosingSigned *NONNULL_PTR orig);
 
+/**
+ * Checks if two ClosingSigneds contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+bool ClosingSigned_eq(const struct LDKClosingSigned *NONNULL_PTR a, const struct LDKClosingSigned *NONNULL_PTR b);
+
 /**
  * Frees any resources used by the UpdateAddHTLC, if is_owned is set and inner is non-NULL.
  */
@@ -23522,6 +24075,13 @@ void UpdateAddHTLC_set_cltv_expiry(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr
  */
 struct LDKUpdateAddHTLC UpdateAddHTLC_clone(const struct LDKUpdateAddHTLC *NONNULL_PTR orig);
 
+/**
+ * Checks if two UpdateAddHTLCs contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+bool UpdateAddHTLC_eq(const struct LDKUpdateAddHTLC *NONNULL_PTR a, const struct LDKUpdateAddHTLC *NONNULL_PTR b);
+
 /**
  * Frees any resources used by the OnionMessage, if is_owned is set and inner is non-NULL.
  */
@@ -23542,6 +24102,13 @@ void OnionMessage_set_blinding_point(struct LDKOnionMessage *NONNULL_PTR this_pt
  */
 struct LDKOnionMessage OnionMessage_clone(const struct LDKOnionMessage *NONNULL_PTR orig);
 
+/**
+ * Checks if two OnionMessages contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+bool OnionMessage_eq(const struct LDKOnionMessage *NONNULL_PTR a, const struct LDKOnionMessage *NONNULL_PTR b);
+
 /**
  * Frees any resources used by the UpdateFulfillHTLC, if is_owned is set and inner is non-NULL.
  */
@@ -23587,6 +24154,13 @@ MUST_USE_RES struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(struct LDKThirtyT
  */
 struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const struct LDKUpdateFulfillHTLC *NONNULL_PTR orig);
 
+/**
+ * Checks if two UpdateFulfillHTLCs contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+bool UpdateFulfillHTLC_eq(const struct LDKUpdateFulfillHTLC *NONNULL_PTR a, const struct LDKUpdateFulfillHTLC *NONNULL_PTR b);
+
 /**
  * Frees any resources used by the UpdateFailHTLC, if is_owned is set and inner is non-NULL.
  */
@@ -23617,6 +24191,13 @@ void UpdateFailHTLC_set_htlc_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr,
  */
 struct LDKUpdateFailHTLC UpdateFailHTLC_clone(const struct LDKUpdateFailHTLC *NONNULL_PTR orig);
 
+/**
+ * Checks if two UpdateFailHTLCs contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+bool UpdateFailHTLC_eq(const struct LDKUpdateFailHTLC *NONNULL_PTR a, const struct LDKUpdateFailHTLC *NONNULL_PTR b);
+
 /**
  * Frees any resources used by the UpdateFailMalformedHTLC, if is_owned is set and inner is non-NULL.
  */
@@ -23657,6 +24238,13 @@ void UpdateFailMalformedHTLC_set_failure_code(struct LDKUpdateFailMalformedHTLC
  */
 struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR orig);
 
+/**
+ * Checks if two UpdateFailMalformedHTLCs contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+bool UpdateFailMalformedHTLC_eq(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR a, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR b);
+
 /**
  * Frees any resources used by the CommitmentSigned, if is_owned is set and inner is non-NULL.
  */
@@ -23704,6 +24292,13 @@ MUST_USE_RES struct LDKCommitmentSigned CommitmentSigned_new(struct LDKThirtyTwo
  */
 struct LDKCommitmentSigned CommitmentSigned_clone(const struct LDKCommitmentSigned *NONNULL_PTR orig);
 
+/**
+ * Checks if two CommitmentSigneds contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+bool CommitmentSigned_eq(const struct LDKCommitmentSigned *NONNULL_PTR a, const struct LDKCommitmentSigned *NONNULL_PTR b);
+
 /**
  * Frees any resources used by the RevokeAndACK, if is_owned is set and inner is non-NULL.
  */
@@ -23749,6 +24344,13 @@ MUST_USE_RES struct LDKRevokeAndACK RevokeAndACK_new(struct LDKThirtyTwoBytes ch
  */
 struct LDKRevokeAndACK RevokeAndACK_clone(const struct LDKRevokeAndACK *NONNULL_PTR orig);
 
+/**
+ * Checks if two RevokeAndACKs contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+bool RevokeAndACK_eq(const struct LDKRevokeAndACK *NONNULL_PTR a, const struct LDKRevokeAndACK *NONNULL_PTR b);
+
 /**
  * Frees any resources used by the UpdateFee, if is_owned is set and inner is non-NULL.
  */
@@ -23784,6 +24386,13 @@ MUST_USE_RES struct LDKUpdateFee UpdateFee_new(struct LDKThirtyTwoBytes channel_
  */
 struct LDKUpdateFee UpdateFee_clone(const struct LDKUpdateFee *NONNULL_PTR orig);
 
+/**
+ * Checks if two UpdateFees contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+bool UpdateFee_eq(const struct LDKUpdateFee *NONNULL_PTR a, const struct LDKUpdateFee *NONNULL_PTR b);
+
 /**
  * Frees any resources used by the DataLossProtect, if is_owned is set and inner is non-NULL.
  */
@@ -23821,6 +24430,13 @@ MUST_USE_RES struct LDKDataLossProtect DataLossProtect_new(struct LDKThirtyTwoBy
  */
 struct LDKDataLossProtect DataLossProtect_clone(const struct LDKDataLossProtect *NONNULL_PTR orig);
 
+/**
+ * Checks if two DataLossProtects contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+bool DataLossProtect_eq(const struct LDKDataLossProtect *NONNULL_PTR a, const struct LDKDataLossProtect *NONNULL_PTR b);
+
 /**
  * Frees any resources used by the ChannelReestablish, if is_owned is set and inner is non-NULL.
  */
@@ -23861,6 +24477,13 @@ void ChannelReestablish_set_next_remote_commitment_number(struct LDKChannelReest
  */
 struct LDKChannelReestablish ChannelReestablish_clone(const struct LDKChannelReestablish *NONNULL_PTR orig);
 
+/**
+ * Checks if two ChannelReestablishs contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+bool ChannelReestablish_eq(const struct LDKChannelReestablish *NONNULL_PTR a, const struct LDKChannelReestablish *NONNULL_PTR b);
+
 /**
  * Frees any resources used by the AnnouncementSignatures, if is_owned is set and inner is non-NULL.
  */
@@ -23916,6 +24539,13 @@ MUST_USE_RES struct LDKAnnouncementSignatures AnnouncementSignatures_new(struct
  */
 struct LDKAnnouncementSignatures AnnouncementSignatures_clone(const struct LDKAnnouncementSignatures *NONNULL_PTR orig);
 
+/**
+ * Checks if two AnnouncementSignaturess contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+bool AnnouncementSignatures_eq(const struct LDKAnnouncementSignatures *NONNULL_PTR a, const struct LDKAnnouncementSignatures *NONNULL_PTR b);
+
 /**
  * Frees any resources used by the NetAddress
  */
@@ -23951,6 +24581,12 @@ struct LDKNetAddress NetAddress_onion_v3(struct LDKThirtyTwoBytes ed25519_pubkey
  */
 struct LDKNetAddress NetAddress_hostname(struct LDKHostname hostname, uint16_t port);
 
+/**
+ * Checks if two NetAddresss contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ */
+bool NetAddress_eq(const struct LDKNetAddress *NONNULL_PTR a, const struct LDKNetAddress *NONNULL_PTR b);
+
 /**
  * Serialize the NetAddress object into a byte array which can be read by NetAddress_read
  */
@@ -24037,6 +24673,13 @@ void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *
  */
 struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR orig);
 
+/**
+ * Checks if two UnsignedNodeAnnouncements contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+bool UnsignedNodeAnnouncement_eq(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR a, const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR b);
+
 /**
  * Frees any resources used by the NodeAnnouncement, if is_owned is set and inner is non-NULL.
  */
@@ -24072,6 +24715,13 @@ MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncement_new(struct LDKSignature
  */
 struct LDKNodeAnnouncement NodeAnnouncement_clone(const struct LDKNodeAnnouncement *NONNULL_PTR orig);
 
+/**
+ * Checks if two NodeAnnouncements contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+bool NodeAnnouncement_eq(const struct LDKNodeAnnouncement *NONNULL_PTR a, const struct LDKNodeAnnouncement *NONNULL_PTR b);
+
 /**
  * Frees any resources used by the UnsignedChannelAnnouncement, if is_owned is set and inner is non-NULL.
  */
@@ -24152,6 +24802,13 @@ void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnno
  */
 struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR orig);
 
+/**
+ * Checks if two UnsignedChannelAnnouncements contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+bool UnsignedChannelAnnouncement_eq(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR a, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR b);
+
 /**
  * Frees any resources used by the ChannelAnnouncement, if is_owned is set and inner is non-NULL.
  */
@@ -24217,6 +24874,13 @@ MUST_USE_RES struct LDKChannelAnnouncement ChannelAnnouncement_new(struct LDKSig
  */
 struct LDKChannelAnnouncement ChannelAnnouncement_clone(const struct LDKChannelAnnouncement *NONNULL_PTR orig);
 
+/**
+ * Checks if two ChannelAnnouncements contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+bool ChannelAnnouncement_eq(const struct LDKChannelAnnouncement *NONNULL_PTR a, const struct LDKChannelAnnouncement *NONNULL_PTR b);
+
 /**
  * Frees any resources used by the UnsignedChannelUpdate, if is_owned is set and inner is non-NULL.
  */
@@ -24352,6 +25016,13 @@ MUST_USE_RES struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_new(struct LD
  */
 struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const struct LDKUnsignedChannelUpdate *NONNULL_PTR orig);
 
+/**
+ * Checks if two UnsignedChannelUpdates contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+bool UnsignedChannelUpdate_eq(const struct LDKUnsignedChannelUpdate *NONNULL_PTR a, const struct LDKUnsignedChannelUpdate *NONNULL_PTR b);
+
 /**
  * Frees any resources used by the ChannelUpdate, if is_owned is set and inner is non-NULL.
  */
@@ -24387,6 +25058,13 @@ MUST_USE_RES struct LDKChannelUpdate ChannelUpdate_new(struct LDKSignature signa
  */
 struct LDKChannelUpdate ChannelUpdate_clone(const struct LDKChannelUpdate *NONNULL_PTR orig);
 
+/**
+ * Checks if two ChannelUpdates contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+bool ChannelUpdate_eq(const struct LDKChannelUpdate *NONNULL_PTR a, const struct LDKChannelUpdate *NONNULL_PTR b);
+
 /**
  * Frees any resources used by the QueryChannelRange, if is_owned is set and inner is non-NULL.
  */
@@ -24432,6 +25110,13 @@ MUST_USE_RES struct LDKQueryChannelRange QueryChannelRange_new(struct LDKThirtyT
  */
 struct LDKQueryChannelRange QueryChannelRange_clone(const struct LDKQueryChannelRange *NONNULL_PTR orig);
 
+/**
+ * Checks if two QueryChannelRanges contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+bool QueryChannelRange_eq(const struct LDKQueryChannelRange *NONNULL_PTR a, const struct LDKQueryChannelRange *NONNULL_PTR b);
+
 /**
  * Frees any resources used by the ReplyChannelRange, if is_owned is set and inner is non-NULL.
  */
@@ -24499,6 +25184,13 @@ MUST_USE_RES struct LDKReplyChannelRange ReplyChannelRange_new(struct LDKThirtyT
  */
 struct LDKReplyChannelRange ReplyChannelRange_clone(const struct LDKReplyChannelRange *NONNULL_PTR orig);
 
+/**
+ * Checks if two ReplyChannelRanges contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+bool ReplyChannelRange_eq(const struct LDKReplyChannelRange *NONNULL_PTR a, const struct LDKReplyChannelRange *NONNULL_PTR b);
+
 /**
  * Frees any resources used by the QueryShortChannelIds, if is_owned is set and inner is non-NULL.
  */
@@ -24536,6 +25228,13 @@ MUST_USE_RES struct LDKQueryShortChannelIds QueryShortChannelIds_new(struct LDKT
  */
 struct LDKQueryShortChannelIds QueryShortChannelIds_clone(const struct LDKQueryShortChannelIds *NONNULL_PTR orig);
 
+/**
+ * Checks if two QueryShortChannelIdss contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+bool QueryShortChannelIds_eq(const struct LDKQueryShortChannelIds *NONNULL_PTR a, const struct LDKQueryShortChannelIds *NONNULL_PTR b);
+
 /**
  * Frees any resources used by the ReplyShortChannelIdsEnd, if is_owned is set and inner is non-NULL.
  */
@@ -24573,6 +25272,13 @@ MUST_USE_RES struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(struc
  */
 struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR orig);
 
+/**
+ * Checks if two ReplyShortChannelIdsEnds contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+bool ReplyShortChannelIdsEnd_eq(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR a, const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR b);
+
 /**
  * Frees any resources used by the GossipTimestampFilter, if is_owned is set and inner is non-NULL.
  */
@@ -24618,6 +25324,13 @@ MUST_USE_RES struct LDKGossipTimestampFilter GossipTimestampFilter_new(struct LD
  */
 struct LDKGossipTimestampFilter GossipTimestampFilter_clone(const struct LDKGossipTimestampFilter *NONNULL_PTR orig);
 
+/**
+ * Checks if two GossipTimestampFilters contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+bool GossipTimestampFilter_eq(const struct LDKGossipTimestampFilter *NONNULL_PTR a, const struct LDKGossipTimestampFilter *NONNULL_PTR b);
+
 /**
  * Frees any resources used by the ErrorAction
  */
@@ -24772,6 +25485,13 @@ MUST_USE_RES struct LDKCommitmentUpdate CommitmentUpdate_new(struct LDKCVec_Upda
  */
 struct LDKCommitmentUpdate CommitmentUpdate_clone(const struct LDKCommitmentUpdate *NONNULL_PTR orig);
 
+/**
+ * Checks if two CommitmentUpdates contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+bool CommitmentUpdate_eq(const struct LDKCommitmentUpdate *NONNULL_PTR a, const struct LDKCommitmentUpdate *NONNULL_PTR b);
+
 /**
  * Calls the free function if one is set
  */
@@ -25171,6 +25891,12 @@ struct LDKOnionMessageProvider IgnoringMessageHandler_as_OnionMessageProvider(co
  */
 struct LDKOnionMessageHandler IgnoringMessageHandler_as_OnionMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
 
+/**
+ * Constructs a new CustomOnionMessageHandler which calls the relevant methods on this_arg.
+ * This copies the `inner` pointer in this_arg and thus the returned CustomOnionMessageHandler must be freed before this_arg is
+ */
+struct LDKCustomOnionMessageHandler IgnoringMessageHandler_as_CustomOnionMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
+
 /**
  * Constructs a new CustomMessageReader which calls the relevant methods on this_arg.
  * This copies the `inner` pointer in this_arg and thus the returned CustomMessageReader must be freed before this_arg is
@@ -25321,7 +26047,7 @@ void PeerManager_free(struct LDKPeerManager this_obj);
  * timestamp, however if it is not available a persistent counter that increases once per
  * minute should suffice.
  */
-MUST_USE_RES struct LDKPeerManager PeerManager_new(struct LDKMessageHandler message_handler, struct LDKSecretKey our_node_secret, uint64_t current_time, const uint8_t (*ephemeral_random_data)[32], struct LDKLogger logger, struct LDKCustomMessageHandler custom_message_handler);
+MUST_USE_RES struct LDKPeerManager PeerManager_new(struct LDKMessageHandler message_handler, struct LDKSecretKey our_node_secret, uint32_t current_time, const uint8_t (*ephemeral_random_data)[32], struct LDKLogger logger, struct LDKCustomMessageHandler custom_message_handler);
 
 /**
  * Get the list of node ids for peers which have completed the initial handshake.
@@ -25660,6 +26386,13 @@ void TxCreationKeys_set_broadcaster_delayed_payment_key(struct LDKTxCreationKeys
  */
 MUST_USE_RES struct LDKTxCreationKeys TxCreationKeys_new(struct LDKPublicKey per_commitment_point_arg, struct LDKPublicKey revocation_key_arg, struct LDKPublicKey broadcaster_htlc_key_arg, struct LDKPublicKey countersignatory_htlc_key_arg, struct LDKPublicKey broadcaster_delayed_payment_key_arg);
 
+/**
+ * Checks if two TxCreationKeyss contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+bool TxCreationKeys_eq(const struct LDKTxCreationKeys *NONNULL_PTR a, const struct LDKTxCreationKeys *NONNULL_PTR b);
+
 /**
  * Creates a copy of the TxCreationKeys
  */
@@ -25758,6 +26491,13 @@ MUST_USE_RES struct LDKChannelPublicKeys ChannelPublicKeys_new(struct LDKPublicK
  */
 struct LDKChannelPublicKeys ChannelPublicKeys_clone(const struct LDKChannelPublicKeys *NONNULL_PTR orig);
 
+/**
+ * Checks if two ChannelPublicKeyss contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+bool ChannelPublicKeys_eq(const struct LDKChannelPublicKeys *NONNULL_PTR a, const struct LDKChannelPublicKeys *NONNULL_PTR b);
+
 /**
  * Serialize the ChannelPublicKeys object into a byte array which can be read by ChannelPublicKeys_read
  */
@@ -25864,6 +26604,13 @@ MUST_USE_RES struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_new(bool of
  */
 struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const struct LDKHTLCOutputInCommitment *NONNULL_PTR orig);
 
+/**
+ * Checks if two HTLCOutputInCommitments contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+bool HTLCOutputInCommitment_eq(const struct LDKHTLCOutputInCommitment *NONNULL_PTR a, const struct LDKHTLCOutputInCommitment *NONNULL_PTR b);
+
 /**
  * Serialize the HTLCOutputInCommitment object into a byte array which can be read by HTLCOutputInCommitment_read
  */
@@ -25975,12 +26722,14 @@ struct LDKOutPoint ChannelTransactionParameters_get_funding_outpoint(const struc
 void ChannelTransactionParameters_set_funding_outpoint(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKOutPoint val);
 
 /**
- * Are anchors used for this channel.  Boolean is serialization backwards-compatible
+ * Are anchors (zero fee HTLC transaction variant) used for this channel. Boolean is
+ * serialization backwards-compatible.
  */
 enum LDKCOption_NoneZ ChannelTransactionParameters_get_opt_anchors(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
 
 /**
- * Are anchors used for this channel.  Boolean is serialization backwards-compatible
+ * Are anchors (zero fee HTLC transaction variant) used for this channel. Boolean is
+ * serialization backwards-compatible.
  */
 void ChannelTransactionParameters_set_opt_anchors(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, enum LDKCOption_NoneZ val);
 
@@ -26236,6 +26985,13 @@ struct LDKClosingTransaction ClosingTransaction_clone(const struct LDKClosingTra
  */
 uint64_t ClosingTransaction_hash(const struct LDKClosingTransaction *NONNULL_PTR o);
 
+/**
+ * Checks if two ClosingTransactions contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+bool ClosingTransaction_eq(const struct LDKClosingTransaction *NONNULL_PTR a, const struct LDKClosingTransaction *NONNULL_PTR b);
+
 /**
  * Construct an object of the class
  */
@@ -26494,27 +27250,11 @@ void InvoiceFeatures_free(struct LDKInvoiceFeatures this_obj);
  */
 void ChannelTypeFeatures_free(struct LDKChannelTypeFeatures this_obj);
 
-/**
- * Returns the set of known init features that are related to channels. At least some of
- * these features are likely required for peers to talk to us.
- */
-MUST_USE_RES struct LDKInitFeatures InitFeatures_known_channel_features(void);
-
-/**
- * Returns the set of known node features that are related to channels.
- */
-MUST_USE_RES struct LDKNodeFeatures NodeFeatures_known_channel_features(void);
-
 /**
  * Create a blank Features with no features set
  */
 MUST_USE_RES struct LDKInitFeatures InitFeatures_empty(void);
 
-/**
- * Creates a Features with the bits set which are known by the implementation
- */
-MUST_USE_RES struct LDKInitFeatures InitFeatures_known(void);
-
 /**
  * Returns true if this `Features` object contains unknown feature flags which are set as
  * \"required\".
@@ -26526,11 +27266,6 @@ MUST_USE_RES bool InitFeatures_requires_unknown_bits(const struct LDKInitFeature
  */
 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_empty(void);
 
-/**
- * Creates a Features with the bits set which are known by the implementation
- */
-MUST_USE_RES struct LDKNodeFeatures NodeFeatures_known(void);
-
 /**
  * Returns true if this `Features` object contains unknown feature flags which are set as
  * \"required\".
@@ -26542,11 +27277,6 @@ MUST_USE_RES bool NodeFeatures_requires_unknown_bits(const struct LDKNodeFeature
  */
 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_empty(void);
 
-/**
- * Creates a Features with the bits set which are known by the implementation
- */
-MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_known(void);
-
 /**
  * Returns true if this `Features` object contains unknown feature flags which are set as
  * \"required\".
@@ -26558,11 +27288,6 @@ MUST_USE_RES bool ChannelFeatures_requires_unknown_bits(const struct LDKChannelF
  */
 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_empty(void);
 
-/**
- * Creates a Features with the bits set which are known by the implementation
- */
-MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_known(void);
-
 /**
  * Returns true if this `Features` object contains unknown feature flags which are set as
  * \"required\".
@@ -26574,11 +27299,6 @@ MUST_USE_RES bool InvoiceFeatures_requires_unknown_bits(const struct LDKInvoiceF
  */
 MUST_USE_RES struct LDKChannelTypeFeatures ChannelTypeFeatures_empty(void);
 
-/**
- * Creates a Features with the bits set which are known by the implementation
- */
-MUST_USE_RES struct LDKChannelTypeFeatures ChannelTypeFeatures_known(void);
-
 /**
  * Returns true if this `Features` object contains unknown feature flags which are set as
  * \"required\".
@@ -27320,6 +28040,13 @@ void ShutdownScript_free(struct LDKShutdownScript this_obj);
  */
 struct LDKShutdownScript ShutdownScript_clone(const struct LDKShutdownScript *NONNULL_PTR orig);
 
+/**
+ * Checks if two ShutdownScripts contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+bool ShutdownScript_eq(const struct LDKShutdownScript *NONNULL_PTR a, const struct LDKShutdownScript *NONNULL_PTR b);
+
 /**
  * Frees any resources used by the InvalidShutdownScript, if is_owned is set and inner is non-NULL.
  */
@@ -27480,6 +28207,12 @@ struct LDKNetworkUpdate NetworkUpdate_channel_failure(uint64_t short_channel_id,
  */
 struct LDKNetworkUpdate NetworkUpdate_node_failure(struct LDKPublicKey node_id, bool is_permanent);
 
+/**
+ * Checks if two NetworkUpdates contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ */
+bool NetworkUpdate_eq(const struct LDKNetworkUpdate *NONNULL_PTR a, const struct LDKNetworkUpdate *NONNULL_PTR b);
+
 /**
  * Serialize the NetworkUpdate object into a byte array which can be read by NetworkUpdate_read
  */
@@ -27626,6 +28359,13 @@ MUST_USE_RES struct LDKChannelUpdateInfo ChannelUpdateInfo_new(uint32_t last_upd
  */
 struct LDKChannelUpdateInfo ChannelUpdateInfo_clone(const struct LDKChannelUpdateInfo *NONNULL_PTR orig);
 
+/**
+ * Checks if two ChannelUpdateInfos contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+bool ChannelUpdateInfo_eq(const struct LDKChannelUpdateInfo *NONNULL_PTR a, const struct LDKChannelUpdateInfo *NONNULL_PTR b);
+
 /**
  * Serialize the ChannelUpdateInfo object into a byte array which can be read by ChannelUpdateInfo_read
  */
@@ -27734,6 +28474,13 @@ void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR thi
  */
 struct LDKChannelInfo ChannelInfo_clone(const struct LDKChannelInfo *NONNULL_PTR orig);
 
+/**
+ * Checks if two ChannelInfos contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+bool ChannelInfo_eq(const struct LDKChannelInfo *NONNULL_PTR a, const struct LDKChannelInfo *NONNULL_PTR b);
+
 /**
  * Returns a [`ChannelUpdateInfo`] based on the direction implied by the channel_flag.
  *
@@ -27979,6 +28726,13 @@ MUST_USE_RES struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_new(struct LDKN
  */
 struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_clone(const struct LDKNodeAnnouncementInfo *NONNULL_PTR orig);
 
+/**
+ * Checks if two NodeAnnouncementInfos contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+bool NodeAnnouncementInfo_eq(const struct LDKNodeAnnouncementInfo *NONNULL_PTR a, const struct LDKNodeAnnouncementInfo *NONNULL_PTR b);
+
 /**
  * Serialize the NodeAnnouncementInfo object into a byte array which can be read by NodeAnnouncementInfo_read
  */
@@ -28008,6 +28762,13 @@ MUST_USE_RES struct LDKNodeAlias NodeAlias_new(struct LDKThirtyTwoBytes a_arg);
  */
 struct LDKNodeAlias NodeAlias_clone(const struct LDKNodeAlias *NONNULL_PTR orig);
 
+/**
+ * Checks if two NodeAliass contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+bool NodeAlias_eq(const struct LDKNodeAlias *NONNULL_PTR a, const struct LDKNodeAlias *NONNULL_PTR b);
+
 /**
  * Serialize the NodeAlias object into a byte array which can be read by NodeAlias_read
  */
@@ -28081,6 +28842,13 @@ MUST_USE_RES struct LDKNodeInfo NodeInfo_new(struct LDKCVec_u64Z channels_arg, s
  */
 struct LDKNodeInfo NodeInfo_clone(const struct LDKNodeInfo *NONNULL_PTR orig);
 
+/**
+ * Checks if two NodeInfos contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+bool NodeInfo_eq(const struct LDKNodeInfo *NONNULL_PTR a, const struct LDKNodeInfo *NONNULL_PTR b);
+
 /**
  * Serialize the NodeInfo object into a byte array which can be read by NodeInfo_read
  */
@@ -28182,9 +28950,10 @@ MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_add_channel_from
 void NetworkGraph_channel_failed(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, bool is_permanent);
 
 /**
- * Marks a node in the graph as failed.
+ * Marks a node in the graph as permanently failed, effectively removing it and its channels
+ * from local storage.
  */
-void NetworkGraph_node_failed(const struct LDKNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey _node_id, bool is_permanent);
+void NetworkGraph_node_failed_permanent(const struct LDKNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey node_id);
 
 /**
  * Removes information about channels that we haven't heard any updates about in some time.
@@ -28198,10 +28967,13 @@ void NetworkGraph_node_failed(const struct LDKNetworkGraph *NONNULL_PTR this_arg
  * Note that for users of the `lightning-background-processor` crate this method may be
  * automatically called regularly for you.
  *
+ * This method will also cause us to stop tracking removed nodes and channels if they have been
+ * in the map for a while so that these can be resynced from gossip in the future.
+ *
  * This method is only available with the `std` feature. See
- * [`NetworkGraph::remove_stale_channels_with_time`] for `no-std` use.
+ * [`NetworkGraph::remove_stale_channels_and_tracking_with_time`] for `no-std` use.
  */
-void NetworkGraph_remove_stale_channels(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
+void NetworkGraph_remove_stale_channels_and_tracking(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
 
 /**
  * Removes information about channels that we haven't heard any updates about in some time.
@@ -28212,10 +28984,13 @@ void NetworkGraph_remove_stale_channels(const struct LDKNetworkGraph *NONNULL_PT
  * updates every two weeks, the non-normative section of BOLT 7 currently suggests that
  * pruning occur for updates which are at least two weeks old, which we implement here.
  *
+ * This method will also cause us to stop tracking removed nodes and channels if they have been
+ * in the map for a while so that these can be resynced from gossip in the future.
+ *
  * This function takes the current unix time as an argument. For users with the `std` feature
- * enabled, [`NetworkGraph::remove_stale_channels`] may be preferable.
+ * enabled, [`NetworkGraph::remove_stale_channels_and_tracking`] may be preferable.
  */
-void NetworkGraph_remove_stale_channels_with_time(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t current_time_unix);
+void NetworkGraph_remove_stale_channels_and_tracking_with_time(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t current_time_unix);
 
 /**
  * For an already known (from announcement) channel, update info about one of the directions
@@ -28921,6 +29696,17 @@ struct LDKCVec_u8Z MultiThreadedScoreLock_write(const struct LDKMultiThreadedSco
  */
 struct LDKLockableScore MultiThreadedLockableScore_as_LockableScore(const struct LDKMultiThreadedLockableScore *NONNULL_PTR this_arg);
 
+/**
+ * Serialize the MultiThreadedLockableScore object into a byte array which can be read by MultiThreadedLockableScore_read
+ */
+struct LDKCVec_u8Z MultiThreadedLockableScore_write(const struct LDKMultiThreadedLockableScore *NONNULL_PTR obj);
+
+/**
+ * Constructs a new WriteableScore which calls the relevant methods on this_arg.
+ * This copies the `inner` pointer in this_arg and thus the returned WriteableScore must be freed before this_arg is
+ */
+struct LDKWriteableScore MultiThreadedLockableScore_as_WriteableScore(const struct LDKMultiThreadedLockableScore *NONNULL_PTR this_arg);
+
 /**
  * Creates a new [`MultiThreadedLockableScore`] given an underlying [`Score`].
  */
@@ -29062,7 +29848,8 @@ void ProbabilisticScoringParameters_set_base_penalty_amount_multiplier_msat(stru
 
 /**
  * A multiplier used in conjunction with the negative `log10` of the channel's success
- * probability for a payment to determine the liquidity penalty.
+ * probability for a payment, as determined by our latest estimates of the channel's
+ * liquidity, to determine the liquidity penalty.
  *
  * The penalty is based in part on the knowledge learned from prior successful and unsuccessful
  * payments. This knowledge is decayed over time based on [`liquidity_offset_half_life`]. The
@@ -29071,7 +29858,9 @@ void ProbabilisticScoringParameters_set_base_penalty_amount_multiplier_msat(stru
  * uncertainty bounds of the channel liquidity balance. Amounts above the upper bound will
  * result in a `u64::max_value` penalty, however.
  *
- * Default value: 40,000 msat
+ * `-log10(success_probability) * liquidity_penalty_multiplier_msat`
+ *
+ * Default value: 30,000 msat
  *
  * [`liquidity_offset_half_life`]: Self::liquidity_offset_half_life
  */
@@ -29079,7 +29868,8 @@ uint64_t ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(co
 
 /**
  * A multiplier used in conjunction with the negative `log10` of the channel's success
- * probability for a payment to determine the liquidity penalty.
+ * probability for a payment, as determined by our latest estimates of the channel's
+ * liquidity, to determine the liquidity penalty.
  *
  * The penalty is based in part on the knowledge learned from prior successful and unsuccessful
  * payments. This knowledge is decayed over time based on [`liquidity_offset_half_life`]. The
@@ -29088,21 +29878,29 @@ uint64_t ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(co
  * uncertainty bounds of the channel liquidity balance. Amounts above the upper bound will
  * result in a `u64::max_value` penalty, however.
  *
- * Default value: 40,000 msat
+ * `-log10(success_probability) * liquidity_penalty_multiplier_msat`
+ *
+ * Default value: 30,000 msat
  *
  * [`liquidity_offset_half_life`]: Self::liquidity_offset_half_life
  */
 void ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
 
 /**
- * The time required to elapse before any knowledge learned about channel liquidity balances is
- * cut in half.
+ * Whenever this amount of time elapses since the last update to a channel's liquidity bounds,
+ * the distance from the bounds to \"zero\" is cut in half. In other words, the lower-bound on
+ * the available liquidity is halved and the upper-bound moves half-way to the channel's total
+ * capacity.
+ *
+ * Because halving the liquidity bounds grows the uncertainty on the channel's liquidity,
+ * the penalty for an amount within the new bounds may change. See the [`ProbabilisticScorer`]
+ * struct documentation for more info on the way the liquidity bounds are used.
  *
- * The bounds are defined in terms of offsets and are initially zero. Increasing the offsets
- * gives tighter bounds on the channel liquidity balance. Thus, halving the offsets decreases
- * the certainty of the channel liquidity balance.
+ * For example, if the channel's capacity is 1 million sats, and the current upper and lower
+ * liquidity bounds are 200,000 sats and 600,000 sats, after this amount of time the upper
+ * and lower liquidity bounds will be decayed to 100,000 and 800,000 sats.
  *
- * Default value: 1 hour
+ * Default value: 6 hours
  *
  * # Note
  *
@@ -29112,14 +29910,20 @@ void ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(struct
 uint64_t ProbabilisticScoringParameters_get_liquidity_offset_half_life(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
 
 /**
- * The time required to elapse before any knowledge learned about channel liquidity balances is
- * cut in half.
+ * Whenever this amount of time elapses since the last update to a channel's liquidity bounds,
+ * the distance from the bounds to \"zero\" is cut in half. In other words, the lower-bound on
+ * the available liquidity is halved and the upper-bound moves half-way to the channel's total
+ * capacity.
+ *
+ * Because halving the liquidity bounds grows the uncertainty on the channel's liquidity,
+ * the penalty for an amount within the new bounds may change. See the [`ProbabilisticScorer`]
+ * struct documentation for more info on the way the liquidity bounds are used.
  *
- * The bounds are defined in terms of offsets and are initially zero. Increasing the offsets
- * gives tighter bounds on the channel liquidity balance. Thus, halving the offsets decreases
- * the certainty of the channel liquidity balance.
+ * For example, if the channel's capacity is 1 million sats, and the current upper and lower
+ * liquidity bounds are 200,000 sats and 600,000 sats, after this amount of time the upper
+ * and lower liquidity bounds will be decayed to 100,000 and 800,000 sats.
  *
- * Default value: 1 hour
+ * Default value: 6 hours
  *
  * # Note
  *
@@ -29130,7 +29934,8 @@ void ProbabilisticScoringParameters_set_liquidity_offset_half_life(struct LDKPro
 
 /**
  * A multiplier used in conjunction with a payment amount and the negative `log10` of the
- * channel's success probability for the payment to determine the amount penalty.
+ * channel's success probability for the payment, as determined by our latest estimates of the
+ * channel's liquidity, to determine the amount penalty.
  *
  * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e.,
  * fees plus penalty) for large payments. The penalty is computed as the product of this
@@ -29145,13 +29950,14 @@ void ProbabilisticScoringParameters_set_liquidity_offset_half_life(struct LDKPro
  * probabilities, the multiplier will have a decreasing effect as the negative `log10` will
  * fall below `1`.
  *
- * Default value: 256 msat
+ * Default value: 192 msat
  */
 uint64_t ProbabilisticScoringParameters_get_liquidity_penalty_amount_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
 
 /**
  * A multiplier used in conjunction with a payment amount and the negative `log10` of the
- * channel's success probability for the payment to determine the amount penalty.
+ * channel's success probability for the payment, as determined by our latest estimates of the
+ * channel's liquidity, to determine the amount penalty.
  *
  * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e.,
  * fees plus penalty) for large payments. The penalty is computed as the product of this
@@ -29166,10 +29972,114 @@ uint64_t ProbabilisticScoringParameters_get_liquidity_penalty_amount_multiplier_
  * probabilities, the multiplier will have a decreasing effect as the negative `log10` will
  * fall below `1`.
  *
- * Default value: 256 msat
+ * Default value: 192 msat
  */
 void ProbabilisticScoringParameters_set_liquidity_penalty_amount_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
 
+/**
+ * A multiplier used in conjunction with the negative `log10` of the channel's success
+ * probability for the payment, as determined based on the history of our estimates of the
+ * channel's available liquidity, to determine a penalty.
+ *
+ * This penalty is similar to [`liquidity_penalty_multiplier_msat`], however, instead of using
+ * only our latest estimate for the current liquidity available in the channel, it estimates
+ * success probability based on the estimated liquidity available in the channel through
+ * history. Specifically, every time we update our liquidity bounds on a given channel, we
+ * track which of several buckets those bounds fall into, exponentially decaying the
+ * probability of each bucket as new samples are added.
+ *
+ * Default value: 10,000 msat
+ *
+ * [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat
+ */
+uint64_t ProbabilisticScoringParameters_get_historical_liquidity_penalty_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
+
+/**
+ * A multiplier used in conjunction with the negative `log10` of the channel's success
+ * probability for the payment, as determined based on the history of our estimates of the
+ * channel's available liquidity, to determine a penalty.
+ *
+ * This penalty is similar to [`liquidity_penalty_multiplier_msat`], however, instead of using
+ * only our latest estimate for the current liquidity available in the channel, it estimates
+ * success probability based on the estimated liquidity available in the channel through
+ * history. Specifically, every time we update our liquidity bounds on a given channel, we
+ * track which of several buckets those bounds fall into, exponentially decaying the
+ * probability of each bucket as new samples are added.
+ *
+ * Default value: 10,000 msat
+ *
+ * [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat
+ */
+void ProbabilisticScoringParameters_set_historical_liquidity_penalty_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
+
+/**
+ * A multiplier used in conjunction with the payment amount and the negative `log10` of the
+ * channel's success probability for the payment, as determined based on the history of our
+ * estimates of the channel's available liquidity, to determine a penalty.
+ *
+ * The purpose of the amount penalty is to avoid having fees dominate the channel cost for
+ * large payments. The penalty is computed as the product of this multiplier and the `2^20`ths
+ * of the payment amount, weighted by the negative `log10` of the success probability.
+ *
+ * This penalty is similar to [`liquidity_penalty_amount_multiplier_msat`], however, instead
+ * of using only our latest estimate for the current liquidity available in the channel, it
+ * estimates success probability based on the estimated liquidity available in the channel
+ * through history. Specifically, every time we update our liquidity bounds on a given
+ * channel, we track which of several buckets those bounds fall into, exponentially decaying
+ * the probability of each bucket as new samples are added.
+ *
+ * Default value: 64 msat
+ *
+ * [`liquidity_penalty_amount_multiplier_msat`]: Self::liquidity_penalty_amount_multiplier_msat
+ */
+uint64_t ProbabilisticScoringParameters_get_historical_liquidity_penalty_amount_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
+
+/**
+ * A multiplier used in conjunction with the payment amount and the negative `log10` of the
+ * channel's success probability for the payment, as determined based on the history of our
+ * estimates of the channel's available liquidity, to determine a penalty.
+ *
+ * The purpose of the amount penalty is to avoid having fees dominate the channel cost for
+ * large payments. The penalty is computed as the product of this multiplier and the `2^20`ths
+ * of the payment amount, weighted by the negative `log10` of the success probability.
+ *
+ * This penalty is similar to [`liquidity_penalty_amount_multiplier_msat`], however, instead
+ * of using only our latest estimate for the current liquidity available in the channel, it
+ * estimates success probability based on the estimated liquidity available in the channel
+ * through history. Specifically, every time we update our liquidity bounds on a given
+ * channel, we track which of several buckets those bounds fall into, exponentially decaying
+ * the probability of each bucket as new samples are added.
+ *
+ * Default value: 64 msat
+ *
+ * [`liquidity_penalty_amount_multiplier_msat`]: Self::liquidity_penalty_amount_multiplier_msat
+ */
+void ProbabilisticScoringParameters_set_historical_liquidity_penalty_amount_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
+
+/**
+ * If we aren't learning any new datapoints for a channel, the historical liquidity bounds
+ * tracking can simply live on with increasingly stale data. Instead, when a channel has not
+ * seen a liquidity estimate update for this amount of time, the historical datapoints are
+ * decayed by half.
+ *
+ * Note that after 16 or more half lives all historical data will be completely gone.
+ *
+ * Default value: 14 days
+ */
+uint64_t ProbabilisticScoringParameters_get_historical_no_updates_half_life(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
+
+/**
+ * If we aren't learning any new datapoints for a channel, the historical liquidity bounds
+ * tracking can simply live on with increasingly stale data. Instead, when a channel has not
+ * seen a liquidity estimate update for this amount of time, the historical datapoints are
+ * decayed by half.
+ *
+ * Note that after 16 or more half lives all historical data will be completely gone.
+ *
+ * Default value: 14 days
+ */
+void ProbabilisticScoringParameters_set_historical_no_updates_half_life(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
+
 /**
  * This penalty is applied when `htlc_maximum_msat` is equal to or larger than half of the
  * channel's capacity, which makes us prefer nodes with a smaller `htlc_maximum_msat`. We
@@ -29398,24 +30308,40 @@ struct LDKSendError SendError_too_few_blinded_hops(void);
  */
 struct LDKSendError SendError_invalid_first_hop(void);
 
+/**
+ * Utility method to constructs a new InvalidMessage-variant SendError
+ */
+struct LDKSendError SendError_invalid_message(void);
+
 /**
  * Utility method to constructs a new BufferFull-variant SendError
  */
 struct LDKSendError SendError_buffer_full(void);
 
+/**
+ * Checks if two SendErrors contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ */
+bool SendError_eq(const struct LDKSendError *NONNULL_PTR a, const struct LDKSendError *NONNULL_PTR b);
+
+/**
+ * Calls the free function if one is set
+ */
+void CustomOnionMessageHandler_free(struct LDKCustomOnionMessageHandler this_ptr);
+
 /**
  * Constructs a new `OnionMessenger` to send, forward, and delegate received onion messages to
  * their respective handlers.
  */
-MUST_USE_RES struct LDKOnionMessenger OnionMessenger_new(struct LDKKeysInterface keys_manager, struct LDKLogger logger);
+MUST_USE_RES struct LDKOnionMessenger OnionMessenger_new(struct LDKKeysInterface keys_manager, struct LDKLogger logger, struct LDKCustomOnionMessageHandler custom_handler);
 
 /**
- * Send an empty onion message to `destination`, routing it through `intermediate_nodes`.
+ * Send an onion message with contents `message` to `destination`, routing it through `intermediate_nodes`.
  * See [`OnionMessenger`] for example usage.
  *
  * Note that reply_path (or a relevant inner pointer) may be NULL or all-0s to represent None
  */
-MUST_USE_RES struct LDKCResult_NoneSendErrorZ OnionMessenger_send_onion_message(const struct LDKOnionMessenger *NONNULL_PTR this_arg, struct LDKCVec_PublicKeyZ intermediate_nodes, struct LDKDestination destination, struct LDKBlindedRoute reply_path);
+MUST_USE_RES struct LDKCResult_NoneSendErrorZ OnionMessenger_send_custom_onion_message(const struct LDKOnionMessenger *NONNULL_PTR this_arg, struct LDKCVec_PublicKeyZ intermediate_nodes, struct LDKDestination destination, struct LDKCustomOnionMessageContents msg, struct LDKBlindedRoute reply_path);
 
 /**
  * Constructs a new OnionMessageHandler which calls the relevant methods on this_arg.
@@ -29429,6 +30355,11 @@ struct LDKOnionMessageHandler OnionMessenger_as_OnionMessageHandler(const struct
  */
 struct LDKOnionMessageProvider OnionMessenger_as_OnionMessageProvider(const struct LDKOnionMessenger *NONNULL_PTR this_arg);
 
+/**
+ * Calls the free function if one is set
+ */
+void CustomOnionMessageContents_free(struct LDKCustomOnionMessageContents this_ptr);
+
 /**
  * Frees any resources used by the FilesystemPersister, if is_owned is set and inner is non-NULL.
  */
@@ -29649,6 +30580,12 @@ struct LDKParseError ParseError_invalid_slice_length(struct LDKStr a);
  */
 struct LDKParseError ParseError_skip(void);
 
+/**
+ * Checks if two ParseErrors contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ */
+bool ParseError_eq(const struct LDKParseError *NONNULL_PTR a, const struct LDKParseError *NONNULL_PTR b);
+
 /**
  * Frees any resources used by the ParseOrSemanticError
  */
@@ -29669,6 +30606,12 @@ struct LDKParseOrSemanticError ParseOrSemanticError_parse_error(struct LDKParseE
  */
 struct LDKParseOrSemanticError ParseOrSemanticError_semantic_error(enum LDKSemanticError a);
 
+/**
+ * Checks if two ParseOrSemanticErrors contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ */
+bool ParseOrSemanticError_eq(const struct LDKParseOrSemanticError *NONNULL_PTR a, const struct LDKParseOrSemanticError *NONNULL_PTR b);
+
 /**
  * Frees any resources used by the Invoice, if is_owned is set and inner is non-NULL.
  */
@@ -30194,6 +31137,8 @@ MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp
  * Creates a `PositiveTimestamp` from a [`SystemTime`] with a corresponding Unix timestamp in
  * the range `0..=MAX_TIMESTAMP`.
  *
+ * Note that the subsecond part is dropped as it is not representable in BOLT 11 invoices.
+ *
  * Otherwise, returns a [`CreationError::TimestampOutOfBounds`].
  */
 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_system_time(uint64_t time);
@@ -30202,6 +31147,8 @@ MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp
  * Creates a `PositiveTimestamp` from a [`Duration`] since the Unix epoch in the range
  * `0..=MAX_TIMESTAMP`.
  *
+ * Note that the subsecond part is dropped as it is not representable in BOLT 11 invoices.
+ *
  * Otherwise, returns a [`CreationError::TimestampOutOfBounds`].
  */
 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_duration_since_epoch(uint64_t duration);
@@ -30355,7 +31302,7 @@ MUST_USE_RES struct LDKStr Description_into_inner(struct LDKDescription this_arg
 MUST_USE_RES struct LDKExpiryTime ExpiryTime_from_seconds(uint64_t seconds);
 
 /**
- * Construct an `ExpiryTime` from a `Duration`.
+ * Construct an `ExpiryTime` from a `Duration`, dropping the sub-second part.
  */
 MUST_USE_RES struct LDKExpiryTime ExpiryTime_from_duration(uint64_t duration);
 
@@ -30692,7 +31639,7 @@ struct LDKCResult_InFlightHtlcsDecodeErrorZ InFlightHtlcs_read(struct LDKu8slice
  *
  * Note that payment_hash (or a relevant inner pointer) may be NULL or all-0s to represent None
  */
-struct LDKCResult_InvoiceSignOrCreationErrorZ create_phantom_invoice(struct LDKCOption_u64Z amt_msat, struct LDKThirtyTwoBytes payment_hash, struct LDKStr description, uint32_t invoice_expiry_delta_secs, struct LDKCVec_PhantomRouteHintsZ phantom_route_hints, struct LDKKeysInterface keys_manager, enum LDKCurrency network);
+struct LDKCResult_InvoiceSignOrCreationErrorZ create_phantom_invoice(struct LDKCOption_u64Z amt_msat, struct LDKThirtyTwoBytes payment_hash, struct LDKStr description, uint32_t invoice_expiry_delta_secs, struct LDKCVec_PhantomRouteHintsZ phantom_route_hints, struct LDKKeysInterface keys_manager, struct LDKLogger logger, enum LDKCurrency network);
 
 /**
  * Utility to create an invoice that can be paid to one of multiple nodes, or a \"phantom invoice.\"
@@ -30729,7 +31676,7 @@ struct LDKCResult_InvoiceSignOrCreationErrorZ create_phantom_invoice(struct LDKC
  *
  * Note that payment_hash (or a relevant inner pointer) may be NULL or all-0s to represent None
  */
-struct LDKCResult_InvoiceSignOrCreationErrorZ create_phantom_invoice_with_description_hash(struct LDKCOption_u64Z amt_msat, struct LDKThirtyTwoBytes payment_hash, uint32_t invoice_expiry_delta_secs, struct LDKSha256 description_hash, struct LDKCVec_PhantomRouteHintsZ phantom_route_hints, struct LDKKeysInterface keys_manager, enum LDKCurrency network);
+struct LDKCResult_InvoiceSignOrCreationErrorZ create_phantom_invoice_with_description_hash(struct LDKCOption_u64Z amt_msat, struct LDKThirtyTwoBytes payment_hash, uint32_t invoice_expiry_delta_secs, struct LDKSha256 description_hash, struct LDKCVec_PhantomRouteHintsZ phantom_route_hints, struct LDKKeysInterface keys_manager, struct LDKLogger logger, enum LDKCurrency network);
 
 /**
  * Utility to construct an invoice. Generally, unless you want to do something like a custom
@@ -30741,7 +31688,7 @@ struct LDKCResult_InvoiceSignOrCreationErrorZ create_phantom_invoice_with_descri
  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
  * in excess of the current time.
  */
-struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKKeysInterface keys_manager, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKStr description, uint32_t invoice_expiry_delta_secs);
+struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKKeysInterface keys_manager, struct LDKLogger logger, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKStr description, uint32_t invoice_expiry_delta_secs);
 
 /**
  * Utility to construct an invoice. Generally, unless you want to do something like a custom
@@ -30754,21 +31701,21 @@ struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager
  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
  * in excess of the current time.
  */
-struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_with_description_hash(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKKeysInterface keys_manager, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKSha256 description_hash, uint32_t invoice_expiry_delta_secs);
+struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_with_description_hash(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKKeysInterface keys_manager, struct LDKLogger logger, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKSha256 description_hash, uint32_t invoice_expiry_delta_secs);
 
 /**
  * See [`create_invoice_from_channelmanager_with_description_hash`]
  * This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not
  * available and the current time is supplied by the caller.
  */
-struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKKeysInterface keys_manager, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKSha256 description_hash, uint64_t duration_since_epoch, uint32_t invoice_expiry_delta_secs);
+struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKKeysInterface keys_manager, struct LDKLogger logger, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKSha256 description_hash, uint64_t duration_since_epoch, uint32_t invoice_expiry_delta_secs);
 
 /**
  * See [`create_invoice_from_channelmanager`]
  * This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not
  * available and the current time is supplied by the caller.
  */
-struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_and_duration_since_epoch(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKKeysInterface keys_manager, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKStr description, uint64_t duration_since_epoch, uint32_t invoice_expiry_delta_secs);
+struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_and_duration_since_epoch(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKKeysInterface keys_manager, struct LDKLogger logger, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKStr description, uint64_t duration_since_epoch, uint32_t invoice_expiry_delta_secs);
 
 /**
  * Frees any resources used by the DefaultRouter, if is_owned is set and inner is non-NULL.
index 7c9ce3112103365069c996f8eac98b2a8e9f010a..544d53170e3650ef3ce26defdb150a5efc0c7074 100644 (file)
@@ -44,7 +44,7 @@ class AccessError;
 class Access;
 class Listen;
 class Confirm;
-class ChannelMonitorUpdateErr;
+class ChannelMonitorUpdateStatus;
 class Watch;
 class Filter;
 class WatchedOutput;
@@ -62,6 +62,7 @@ class NodeFeatures;
 class ChannelFeatures;
 class InvoiceFeatures;
 class ChannelTypeFeatures;
+class CustomOnionMessageContents;
 class NodeId;
 class NetworkGraph;
 class ReadOnlyNetworkGraph;
@@ -146,6 +147,7 @@ class PeerManager;
 class OnionMessenger;
 class Destination;
 class SendError;
+class CustomOnionMessageHandler;
 class RapidGossipSync;
 class Persister;
 class DecodeError;
@@ -236,21 +238,21 @@ class CResult_CommitmentSignedDecodeErrorZ;
 class COption_u32Z;
 class CResult_InitFeaturesDecodeErrorZ;
 class CResult_StaticPaymentOutputDescriptorDecodeErrorZ;
+class CResult_PublicKeyNoneZ;
 class CResult_PaymentIdPaymentSendFailureZ;
-class CResult_OnionMessageDecodeErrorZ;
 class CResult_CommitmentTransactionDecodeErrorZ;
 class CResult_TransactionNoneZ;
 class CResult_ClosingSignedFeeRangeDecodeErrorZ;
+class CResult_OnionMessageDecodeErrorZ;
 class CResult_PingDecodeErrorZ;
 class CResult_UnsignedNodeAnnouncementDecodeErrorZ;
 class CResult_ReplyChannelRangeDecodeErrorZ;
 class CResult_GossipTimestampFilterDecodeErrorZ;
-class CResult_InvoiceSignOrCreationErrorZ;
 class CVec_TransactionOutputsZ;
 class CResult_ErrorMessageDecodeErrorZ;
 class CResult_OpenChannelDecodeErrorZ;
 class CVec_CVec_u8ZZ;
-class COption_FilterZ;
+class CResult_COption_CustomOnionMessageContentsZDecodeErrorZ;
 class CResult_SecretKeyErrorZ;
 class CResult_ShutdownScriptDecodeErrorZ;
 class CResult_ProbabilisticScorerDecodeErrorZ;
@@ -279,7 +281,10 @@ class C3Tuple_RawInvoice_u832InvoiceSignatureZ;
 class CVec_UpdateFailMalformedHTLCZ;
 class CResult_FundingSignedDecodeErrorZ;
 class CResult_NetworkGraphDecodeErrorZ;
+class CResult_InvoiceSignOrCreationErrorZ;
 class CVec_RouteHopZ;
+class COption_FilterZ;
+class COption_CustomOnionMessageContentsZ;
 class CResult_NodeInfoDecodeErrorZ;
 class CVec_NodeIdZ;
 class CResult_RouteLightningErrorZ;
@@ -388,7 +393,6 @@ class CResult_NoneSemanticErrorZ;
 class CVec_MonitorEventZ;
 class CVec_PaymentPreimageZ;
 class CVec_C2Tuple_u32ScriptZZ;
-class CResult_NoneChannelMonitorUpdateErrZ;
 class CResult_COption_ClosureReasonZDecodeErrorZ;
 class CResult_PublicKeyErrorZ;
 class CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ;
@@ -1174,19 +1178,19 @@ public:
         */
        inline LDK::CVec_TxidZ get_relevant_txids();
 };
-class ChannelMonitorUpdateErr {
+class ChannelMonitorUpdateStatus {
 private:
-       LDKChannelMonitorUpdateErr self;
+       LDKChannelMonitorUpdateStatus self;
 public:
-       ChannelMonitorUpdateErr(const ChannelMonitorUpdateErr&) = delete;
-       ChannelMonitorUpdateErr(ChannelMonitorUpdateErr&& o) : self(o.self) { memset(&o, 0, sizeof(ChannelMonitorUpdateErr)); }
-       ChannelMonitorUpdateErr(LDKChannelMonitorUpdateErr&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChannelMonitorUpdateErr)); }
-       operator LDKChannelMonitorUpdateErr() && { LDKChannelMonitorUpdateErr res = self; memset(&self, 0, sizeof(LDKChannelMonitorUpdateErr)); return res; }
-       ChannelMonitorUpdateErr& operator=(ChannelMonitorUpdateErr&& o) { self = o.self; memset(&o, 0, sizeof(ChannelMonitorUpdateErr)); return *this; }
-       LDKChannelMonitorUpdateErr* operator &() { return &self; }
-       LDKChannelMonitorUpdateErr* operator ->() { return &self; }
-       const LDKChannelMonitorUpdateErr* operator &() const { return &self; }
-       const LDKChannelMonitorUpdateErr* operator ->() const { return &self; }
+       ChannelMonitorUpdateStatus(const ChannelMonitorUpdateStatus&) = delete;
+       ChannelMonitorUpdateStatus(ChannelMonitorUpdateStatus&& o) : self(o.self) { memset(&o, 0, sizeof(ChannelMonitorUpdateStatus)); }
+       ChannelMonitorUpdateStatus(LDKChannelMonitorUpdateStatus&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChannelMonitorUpdateStatus)); }
+       operator LDKChannelMonitorUpdateStatus() && { LDKChannelMonitorUpdateStatus res = self; memset(&self, 0, sizeof(LDKChannelMonitorUpdateStatus)); return res; }
+       ChannelMonitorUpdateStatus& operator=(ChannelMonitorUpdateStatus&& o) { self = o.self; memset(&o, 0, sizeof(ChannelMonitorUpdateStatus)); return *this; }
+       LDKChannelMonitorUpdateStatus* operator &() { return &self; }
+       LDKChannelMonitorUpdateStatus* operator ->() { return &self; }
+       const LDKChannelMonitorUpdateStatus* operator &() const { return &self; }
+       const LDKChannelMonitorUpdateStatus* operator ->() const { return &self; }
 };
 class Watch {
 private:
@@ -1209,23 +1213,23 @@ public:
         *  with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means
         *  calling [`block_connected`] and [`block_disconnected`] on the monitor.
         * 
-        *  Note: this interface MUST error with `ChannelMonitorUpdateErr::PermanentFailure` if
+        *  Note: this interface MUST error with [`ChannelMonitorUpdateStatus::PermanentFailure`] if
         *  the given `funding_txo` has previously been registered via `watch_channel`.
         * 
         *  [`get_outputs_to_watch`]: channelmonitor::ChannelMonitor::get_outputs_to_watch
         *  [`block_connected`]: channelmonitor::ChannelMonitor::block_connected
         *  [`block_disconnected`]: channelmonitor::ChannelMonitor::block_disconnected
         */
-       inline LDK::CResult_NoneChannelMonitorUpdateErrZ watch_channel(struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor);
+       inline LDK::ChannelMonitorUpdateStatus watch_channel(struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor);
        /**
         *  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.
+        *  [`ChannelMonitorUpdateStatus`] for invariants around returning an error.
         * 
         *  [`update_monitor`]: channelmonitor::ChannelMonitor::update_monitor
         */
-       inline LDK::CResult_NoneChannelMonitorUpdateErrZ update_channel(struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update);
+       inline LDK::ChannelMonitorUpdateStatus update_channel(struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update);
        /**
         *  Returns any monitor events since the last call. Subsequent calls must only return new
         *  events.
@@ -1235,7 +1239,7 @@ public:
         *  to disk.
         * 
         *  For details on asynchronous [`ChannelMonitor`] updating and returning
-        *  [`MonitorEvent::UpdateCompleted`] here, see [`ChannelMonitorUpdateErr::TemporaryFailure`].
+        *  [`MonitorEvent::Completed`] here, see [`ChannelMonitorUpdateStatus::InProgress`].
         */
        inline LDK::CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ release_pending_monitor_events();
 };
@@ -1524,6 +1528,25 @@ public:
        const LDKChannelTypeFeatures* operator &() const { return &self; }
        const LDKChannelTypeFeatures* operator ->() const { return &self; }
 };
+class CustomOnionMessageContents {
+private:
+       LDKCustomOnionMessageContents self;
+public:
+       CustomOnionMessageContents(const CustomOnionMessageContents&) = delete;
+       CustomOnionMessageContents(CustomOnionMessageContents&& o) : self(o.self) { memset(&o, 0, sizeof(CustomOnionMessageContents)); }
+       CustomOnionMessageContents(LDKCustomOnionMessageContents&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCustomOnionMessageContents)); }
+       operator LDKCustomOnionMessageContents() && { LDKCustomOnionMessageContents res = self; memset(&self, 0, sizeof(LDKCustomOnionMessageContents)); return res; }
+       ~CustomOnionMessageContents() { CustomOnionMessageContents_free(self); }
+       CustomOnionMessageContents& operator=(CustomOnionMessageContents&& o) { CustomOnionMessageContents_free(self); self = o.self; memset(&o, 0, sizeof(CustomOnionMessageContents)); return *this; }
+       LDKCustomOnionMessageContents* operator &() { return &self; }
+       LDKCustomOnionMessageContents* operator ->() { return &self; }
+       const LDKCustomOnionMessageContents* operator &() const { return &self; }
+       const LDKCustomOnionMessageContents* operator ->() const { return &self; }
+       /**
+        *  Returns the TLV type identifying the message contents. MUST be >= 64.
+        */
+       inline uint64_t tlv_type();
+};
 class NodeId {
 private:
        LDKNodeId self;
@@ -1918,6 +1941,11 @@ public:
         *  chosen to forgo their output as dust.
         */
        inline LDK::CResult_SignatureNoneZ sign_closing_transaction(const struct LDKClosingTransaction *NONNULL_PTR closing_tx);
+       /**
+        *  Computes the signature for a commitment transaction's anchor output used as an
+        *  input within `anchor_tx`, which spends the commitment transaction, at index `input`.
+        */
+       inline LDK::CResult_SignatureNoneZ sign_holder_anchor_input(struct LDKTransaction anchor_tx, uintptr_t input);
        /**
         *  Signs a channel announcement message with our funding key and our node secret key (aka
         *  node_id or network_key), proving it comes from one of the channel participants.
@@ -1994,13 +2022,29 @@ public:
         * 
         *  This method must return the same value each time it is called with a given `Recipient`
         *  parameter.
+        * 
+        *  Errors if the `Recipient` variant is not supported by the implementation.
         */
        inline LDK::CResult_SecretKeyNoneZ get_node_secret(enum LDKRecipient recipient);
+       /**
+        *  Get node id based on the provided [`Recipient`]. This public key corresponds to the secret in
+        *  [`get_node_secret`].
+        * 
+        *  This method must return the same value each time it is called with a given `Recipient`
+        *  parameter.
+        * 
+        *  Errors if the `Recipient` variant is not supported by the implementation.
+        * 
+        *  [`get_node_secret`]: KeysInterface::get_node_secret
+        */
+       inline LDK::CResult_PublicKeyNoneZ get_node_id(enum LDKRecipient recipient);
        /**
         *  Gets the ECDH shared secret of our [`node secret`] and `other_key`, multiplying by `tweak` if
         *  one is provided. Note that this tweak can be applied to `other_key` instead of our node
         *  secret, though this is less efficient.
         * 
+        *  Errors if the `Recipient` variant is not supported by the implementation.
+        * 
         *  [`node secret`]: Self::get_node_secret
         */
        inline LDK::CResult_SharedSecretNoneZ ecdh(enum LDKRecipient recipient, struct LDKPublicKey other_key, struct LDKCOption_ScalarZ tweak);
@@ -2050,6 +2094,8 @@ public:
         *  The hrp is ascii bytes, while the invoice data is base32.
         * 
         *  The secret key used to sign the invoice is dependent on the [`Recipient`].
+        * 
+        *  Errors if the `Recipient` variant is not supported by the implementation.
         */
        inline LDK::CResult_RecoverableSignatureNoneZ sign_invoice(struct LDKu8slice hrp_bytes, struct LDKCVec_u5Z invoice_data, enum LDKRecipient receipient);
        /**
@@ -3130,6 +3176,30 @@ public:
        const LDKSendError* operator &() const { return &self; }
        const LDKSendError* operator ->() const { return &self; }
 };
+class CustomOnionMessageHandler {
+private:
+       LDKCustomOnionMessageHandler self;
+public:
+       CustomOnionMessageHandler(const CustomOnionMessageHandler&) = delete;
+       CustomOnionMessageHandler(CustomOnionMessageHandler&& o) : self(o.self) { memset(&o, 0, sizeof(CustomOnionMessageHandler)); }
+       CustomOnionMessageHandler(LDKCustomOnionMessageHandler&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCustomOnionMessageHandler)); }
+       operator LDKCustomOnionMessageHandler() && { LDKCustomOnionMessageHandler res = self; memset(&self, 0, sizeof(LDKCustomOnionMessageHandler)); return res; }
+       ~CustomOnionMessageHandler() { CustomOnionMessageHandler_free(self); }
+       CustomOnionMessageHandler& operator=(CustomOnionMessageHandler&& o) { CustomOnionMessageHandler_free(self); self = o.self; memset(&o, 0, sizeof(CustomOnionMessageHandler)); return *this; }
+       LDKCustomOnionMessageHandler* operator &() { return &self; }
+       LDKCustomOnionMessageHandler* operator ->() { return &self; }
+       const LDKCustomOnionMessageHandler* operator &() const { return &self; }
+       const LDKCustomOnionMessageHandler* operator ->() const { return &self; }
+       /**
+        *  Called with the custom message that was received.
+        */
+       inline void handle_custom_message(struct LDKCustomOnionMessageContents msg);
+       /**
+        *  Read a custom message of type `message_type` from `buffer`, returning `Ok(None)` if the
+        *  message type is unknown.
+        */
+       inline LDK::CResult_COption_CustomOnionMessageContentsZDecodeErrorZ read_custom_message(uint64_t message_type, struct LDKu8slice buffer);
+};
 class RapidGossipSync {
 private:
        LDKRapidGossipSync self;
@@ -3851,12 +3921,19 @@ public:
         *  is believed to be possible in the future (eg they're sending us messages we don't
         *  understand or indicate they require unknown feature bits), no_connection_possible is set
         *  and any outstanding channels should be failed.
+        * 
+        *  Note that in some rare cases this may be called without a corresponding
+        *  [`Self::peer_connected`].
         */
        inline void peer_disconnected(struct LDKPublicKey their_node_id, bool no_connection_possible);
        /**
         *  Handle a peer reconnecting, possibly generating channel_reestablish message(s).
+        * 
+        *  May return an `Err(())` if the features the peer supports are not sufficient to communicate
+        *  with us. Implementors should be somewhat conservative about doing so, however, as other
+        *  message handlers may still wish to communicate with this peer.
         */
-       inline void peer_connected(struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg);
+       inline LDK::CResult_NoneNoneZ peer_connected(struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg);
        /**
         *  Handle an incoming channel_reestablish message from the given peer.
         */
@@ -3933,8 +4010,12 @@ public:
         *  Called when a connection is established with a peer. This can be used to
         *  perform routing table synchronization using a strategy defined by the
         *  implementor.
+        * 
+        *  May return an `Err(())` if the features the peer supports are not sufficient to communicate
+        *  with us. Implementors should be somewhat conservative about doing so, however, as other
+        *  message handlers may still wish to communicate with this peer.
         */
-       inline void peer_connected(struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init);
+       inline LDK::CResult_NoneNoneZ peer_connected(struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init);
        /**
         *  Handles the reply of a query we initiated to learn about channels
         *  for a given range of blocks. We can expect to receive one or more
@@ -3994,11 +4075,18 @@ public:
        /**
         *  Called when a connection is established with a peer. Can be used to track which peers
         *  advertise onion message support and are online.
+        * 
+        *  May return an `Err(())` if the features the peer supports are not sufficient to communicate
+        *  with us. Implementors should be somewhat conservative about doing so, however, as other
+        *  message handlers may still wish to communicate with this peer.
         */
-       inline void peer_connected(struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init);
+       inline LDK::CResult_NoneNoneZ peer_connected(struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init);
        /**
         *  Indicates a connection to the peer failed/an existing connection was lost. Allows handlers to
         *  drop and refuse to forward onion messages to this peer.
+        * 
+        *  Note that in some rare cases this may be called without a corresponding
+        *  [`Self::peer_connected`].
         */
        inline void peer_disconnected(struct LDKPublicKey their_node_id, bool no_connection_possible);
        /**
@@ -4166,15 +4254,15 @@ public:
         *  and the stored channel data). Note that you **must** persist every new monitor to disk.
         * 
         *  The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`],
-        *  if you return [`ChannelMonitorUpdateErr::TemporaryFailure`].
+        *  if you return [`ChannelMonitorUpdateStatus::InProgress`].
         * 
         *  See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`
-        *  and [`ChannelMonitorUpdateErr`] for requirements when returning errors.
+        *  and [`ChannelMonitorUpdateStatus`] for requirements when returning errors.
         * 
         *  [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
         *  [`Writeable::write`]: crate::util::ser::Writeable::write
         */
-       inline LDK::CResult_NoneChannelMonitorUpdateErrZ persist_new_channel(struct LDKOutPoint channel_id, const struct LDKChannelMonitor *NONNULL_PTR data, struct LDKMonitorUpdateId update_id);
+       inline LDK::ChannelMonitorUpdateStatus persist_new_channel(struct LDKOutPoint channel_id, const struct LDKChannelMonitor *NONNULL_PTR data, struct LDKMonitorUpdateId update_id);
        /**
         *  Update one channel's data. The provided [`ChannelMonitor`] has already applied the given
         *  update.
@@ -4202,17 +4290,17 @@ public:
         *  whereas updates are small and `O(1)`.
         * 
         *  The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`],
-        *  if you return [`ChannelMonitorUpdateErr::TemporaryFailure`].
+        *  if you return [`ChannelMonitorUpdateStatus::InProgress`].
         * 
         *  See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`,
         *  [`Writeable::write`] on [`ChannelMonitorUpdate`] for writing out an update, and
-        *  [`ChannelMonitorUpdateErr`] for requirements when returning errors.
+        *  [`ChannelMonitorUpdateStatus`] for requirements when returning errors.
         * 
         *  [`Writeable::write`]: crate::util::ser::Writeable::write
         * 
         *  Note that update (or a relevant inner pointer) may be NULL or all-0s to represent None
         */
-       inline LDK::CResult_NoneChannelMonitorUpdateErrZ update_persisted_channel(struct LDKOutPoint channel_id, const struct LDKChannelMonitorUpdate *NONNULL_PTR update, const struct LDKChannelMonitor *NONNULL_PTR data, struct LDKMonitorUpdateId update_id);
+       inline LDK::ChannelMonitorUpdateStatus update_persisted_channel(struct LDKOutPoint channel_id, const struct LDKChannelMonitorUpdate *NONNULL_PTR update, const struct LDKChannelMonitor *NONNULL_PTR data, struct LDKMonitorUpdateId update_id);
 };
 class LockedChannelMonitor {
 private:
@@ -4754,6 +4842,21 @@ public:
        const LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* operator &() const { return &self; }
        const LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* operator ->() const { return &self; }
 };
+class CResult_PublicKeyNoneZ {
+private:
+       LDKCResult_PublicKeyNoneZ self;
+public:
+       CResult_PublicKeyNoneZ(const CResult_PublicKeyNoneZ&) = delete;
+       CResult_PublicKeyNoneZ(CResult_PublicKeyNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PublicKeyNoneZ)); }
+       CResult_PublicKeyNoneZ(LDKCResult_PublicKeyNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PublicKeyNoneZ)); }
+       operator LDKCResult_PublicKeyNoneZ() && { LDKCResult_PublicKeyNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_PublicKeyNoneZ)); return res; }
+       ~CResult_PublicKeyNoneZ() { CResult_PublicKeyNoneZ_free(self); }
+       CResult_PublicKeyNoneZ& operator=(CResult_PublicKeyNoneZ&& o) { CResult_PublicKeyNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PublicKeyNoneZ)); return *this; }
+       LDKCResult_PublicKeyNoneZ* operator &() { return &self; }
+       LDKCResult_PublicKeyNoneZ* operator ->() { return &self; }
+       const LDKCResult_PublicKeyNoneZ* operator &() const { return &self; }
+       const LDKCResult_PublicKeyNoneZ* operator ->() const { return &self; }
+};
 class CResult_PaymentIdPaymentSendFailureZ {
 private:
        LDKCResult_PaymentIdPaymentSendFailureZ self;
@@ -4769,21 +4872,6 @@ public:
        const LDKCResult_PaymentIdPaymentSendFailureZ* operator &() const { return &self; }
        const LDKCResult_PaymentIdPaymentSendFailureZ* operator ->() const { return &self; }
 };
-class CResult_OnionMessageDecodeErrorZ {
-private:
-       LDKCResult_OnionMessageDecodeErrorZ self;
-public:
-       CResult_OnionMessageDecodeErrorZ(const CResult_OnionMessageDecodeErrorZ&) = delete;
-       CResult_OnionMessageDecodeErrorZ(CResult_OnionMessageDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_OnionMessageDecodeErrorZ)); }
-       CResult_OnionMessageDecodeErrorZ(LDKCResult_OnionMessageDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_OnionMessageDecodeErrorZ)); }
-       operator LDKCResult_OnionMessageDecodeErrorZ() && { LDKCResult_OnionMessageDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_OnionMessageDecodeErrorZ)); return res; }
-       ~CResult_OnionMessageDecodeErrorZ() { CResult_OnionMessageDecodeErrorZ_free(self); }
-       CResult_OnionMessageDecodeErrorZ& operator=(CResult_OnionMessageDecodeErrorZ&& o) { CResult_OnionMessageDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_OnionMessageDecodeErrorZ)); return *this; }
-       LDKCResult_OnionMessageDecodeErrorZ* operator &() { return &self; }
-       LDKCResult_OnionMessageDecodeErrorZ* operator ->() { return &self; }
-       const LDKCResult_OnionMessageDecodeErrorZ* operator &() const { return &self; }
-       const LDKCResult_OnionMessageDecodeErrorZ* operator ->() const { return &self; }
-};
 class CResult_CommitmentTransactionDecodeErrorZ {
 private:
        LDKCResult_CommitmentTransactionDecodeErrorZ self;
@@ -4829,6 +4917,21 @@ public:
        const LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* operator &() const { return &self; }
        const LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* operator ->() const { return &self; }
 };
+class CResult_OnionMessageDecodeErrorZ {
+private:
+       LDKCResult_OnionMessageDecodeErrorZ self;
+public:
+       CResult_OnionMessageDecodeErrorZ(const CResult_OnionMessageDecodeErrorZ&) = delete;
+       CResult_OnionMessageDecodeErrorZ(CResult_OnionMessageDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_OnionMessageDecodeErrorZ)); }
+       CResult_OnionMessageDecodeErrorZ(LDKCResult_OnionMessageDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_OnionMessageDecodeErrorZ)); }
+       operator LDKCResult_OnionMessageDecodeErrorZ() && { LDKCResult_OnionMessageDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_OnionMessageDecodeErrorZ)); return res; }
+       ~CResult_OnionMessageDecodeErrorZ() { CResult_OnionMessageDecodeErrorZ_free(self); }
+       CResult_OnionMessageDecodeErrorZ& operator=(CResult_OnionMessageDecodeErrorZ&& o) { CResult_OnionMessageDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_OnionMessageDecodeErrorZ)); return *this; }
+       LDKCResult_OnionMessageDecodeErrorZ* operator &() { return &self; }
+       LDKCResult_OnionMessageDecodeErrorZ* operator ->() { return &self; }
+       const LDKCResult_OnionMessageDecodeErrorZ* operator &() const { return &self; }
+       const LDKCResult_OnionMessageDecodeErrorZ* operator ->() const { return &self; }
+};
 class CResult_PingDecodeErrorZ {
 private:
        LDKCResult_PingDecodeErrorZ self;
@@ -4889,21 +4992,6 @@ public:
        const LDKCResult_GossipTimestampFilterDecodeErrorZ* operator &() const { return &self; }
        const LDKCResult_GossipTimestampFilterDecodeErrorZ* operator ->() const { return &self; }
 };
-class CResult_InvoiceSignOrCreationErrorZ {
-private:
-       LDKCResult_InvoiceSignOrCreationErrorZ self;
-public:
-       CResult_InvoiceSignOrCreationErrorZ(const CResult_InvoiceSignOrCreationErrorZ&) = delete;
-       CResult_InvoiceSignOrCreationErrorZ(CResult_InvoiceSignOrCreationErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_InvoiceSignOrCreationErrorZ)); }
-       CResult_InvoiceSignOrCreationErrorZ(LDKCResult_InvoiceSignOrCreationErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_InvoiceSignOrCreationErrorZ)); }
-       operator LDKCResult_InvoiceSignOrCreationErrorZ() && { LDKCResult_InvoiceSignOrCreationErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_InvoiceSignOrCreationErrorZ)); return res; }
-       ~CResult_InvoiceSignOrCreationErrorZ() { CResult_InvoiceSignOrCreationErrorZ_free(self); }
-       CResult_InvoiceSignOrCreationErrorZ& operator=(CResult_InvoiceSignOrCreationErrorZ&& o) { CResult_InvoiceSignOrCreationErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_InvoiceSignOrCreationErrorZ)); return *this; }
-       LDKCResult_InvoiceSignOrCreationErrorZ* operator &() { return &self; }
-       LDKCResult_InvoiceSignOrCreationErrorZ* operator ->() { return &self; }
-       const LDKCResult_InvoiceSignOrCreationErrorZ* operator &() const { return &self; }
-       const LDKCResult_InvoiceSignOrCreationErrorZ* operator ->() const { return &self; }
-};
 class CVec_TransactionOutputsZ {
 private:
        LDKCVec_TransactionOutputsZ self;
@@ -4964,20 +5052,20 @@ public:
        const LDKCVec_CVec_u8ZZ* operator &() const { return &self; }
        const LDKCVec_CVec_u8ZZ* operator ->() const { return &self; }
 };
-class COption_FilterZ {
+class CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
 private:
-       LDKCOption_FilterZ self;
+       LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ self;
 public:
-       COption_FilterZ(const COption_FilterZ&) = delete;
-       COption_FilterZ(COption_FilterZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_FilterZ)); }
-       COption_FilterZ(LDKCOption_FilterZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_FilterZ)); }
-       operator LDKCOption_FilterZ() && { LDKCOption_FilterZ res = self; memset(&self, 0, sizeof(LDKCOption_FilterZ)); return res; }
-       ~COption_FilterZ() { COption_FilterZ_free(self); }
-       COption_FilterZ& operator=(COption_FilterZ&& o) { COption_FilterZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_FilterZ)); return *this; }
-       LDKCOption_FilterZ* operator &() { return &self; }
-       LDKCOption_FilterZ* operator ->() { return &self; }
-       const LDKCOption_FilterZ* operator &() const { return &self; }
-       const LDKCOption_FilterZ* operator ->() const { return &self; }
+       CResult_COption_CustomOnionMessageContentsZDecodeErrorZ(const CResult_COption_CustomOnionMessageContentsZDecodeErrorZ&) = delete;
+       CResult_COption_CustomOnionMessageContentsZDecodeErrorZ(CResult_COption_CustomOnionMessageContentsZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_COption_CustomOnionMessageContentsZDecodeErrorZ)); }
+       CResult_COption_CustomOnionMessageContentsZDecodeErrorZ(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ)); }
+       operator LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ() && { LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ)); return res; }
+       ~CResult_COption_CustomOnionMessageContentsZDecodeErrorZ() { CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(self); }
+       CResult_COption_CustomOnionMessageContentsZDecodeErrorZ& operator=(CResult_COption_CustomOnionMessageContentsZDecodeErrorZ&& o) { CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_COption_CustomOnionMessageContentsZDecodeErrorZ)); return *this; }
+       LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* operator &() { return &self; }
+       LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* operator ->() { return &self; }
+       const LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* operator &() const { return &self; }
+       const LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* operator ->() const { return &self; }
 };
 class CResult_SecretKeyErrorZ {
 private:
@@ -5399,6 +5487,21 @@ public:
        const LDKCResult_NetworkGraphDecodeErrorZ* operator &() const { return &self; }
        const LDKCResult_NetworkGraphDecodeErrorZ* operator ->() const { return &self; }
 };
+class CResult_InvoiceSignOrCreationErrorZ {
+private:
+       LDKCResult_InvoiceSignOrCreationErrorZ self;
+public:
+       CResult_InvoiceSignOrCreationErrorZ(const CResult_InvoiceSignOrCreationErrorZ&) = delete;
+       CResult_InvoiceSignOrCreationErrorZ(CResult_InvoiceSignOrCreationErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_InvoiceSignOrCreationErrorZ)); }
+       CResult_InvoiceSignOrCreationErrorZ(LDKCResult_InvoiceSignOrCreationErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_InvoiceSignOrCreationErrorZ)); }
+       operator LDKCResult_InvoiceSignOrCreationErrorZ() && { LDKCResult_InvoiceSignOrCreationErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_InvoiceSignOrCreationErrorZ)); return res; }
+       ~CResult_InvoiceSignOrCreationErrorZ() { CResult_InvoiceSignOrCreationErrorZ_free(self); }
+       CResult_InvoiceSignOrCreationErrorZ& operator=(CResult_InvoiceSignOrCreationErrorZ&& o) { CResult_InvoiceSignOrCreationErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_InvoiceSignOrCreationErrorZ)); return *this; }
+       LDKCResult_InvoiceSignOrCreationErrorZ* operator &() { return &self; }
+       LDKCResult_InvoiceSignOrCreationErrorZ* operator ->() { return &self; }
+       const LDKCResult_InvoiceSignOrCreationErrorZ* operator &() const { return &self; }
+       const LDKCResult_InvoiceSignOrCreationErrorZ* operator ->() const { return &self; }
+};
 class CVec_RouteHopZ {
 private:
        LDKCVec_RouteHopZ self;
@@ -5414,6 +5517,36 @@ public:
        const LDKCVec_RouteHopZ* operator &() const { return &self; }
        const LDKCVec_RouteHopZ* operator ->() const { return &self; }
 };
+class COption_FilterZ {
+private:
+       LDKCOption_FilterZ self;
+public:
+       COption_FilterZ(const COption_FilterZ&) = delete;
+       COption_FilterZ(COption_FilterZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_FilterZ)); }
+       COption_FilterZ(LDKCOption_FilterZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_FilterZ)); }
+       operator LDKCOption_FilterZ() && { LDKCOption_FilterZ res = self; memset(&self, 0, sizeof(LDKCOption_FilterZ)); return res; }
+       ~COption_FilterZ() { COption_FilterZ_free(self); }
+       COption_FilterZ& operator=(COption_FilterZ&& o) { COption_FilterZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_FilterZ)); return *this; }
+       LDKCOption_FilterZ* operator &() { return &self; }
+       LDKCOption_FilterZ* operator ->() { return &self; }
+       const LDKCOption_FilterZ* operator &() const { return &self; }
+       const LDKCOption_FilterZ* operator ->() const { return &self; }
+};
+class COption_CustomOnionMessageContentsZ {
+private:
+       LDKCOption_CustomOnionMessageContentsZ self;
+public:
+       COption_CustomOnionMessageContentsZ(const COption_CustomOnionMessageContentsZ&) = delete;
+       COption_CustomOnionMessageContentsZ(COption_CustomOnionMessageContentsZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_CustomOnionMessageContentsZ)); }
+       COption_CustomOnionMessageContentsZ(LDKCOption_CustomOnionMessageContentsZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_CustomOnionMessageContentsZ)); }
+       operator LDKCOption_CustomOnionMessageContentsZ() && { LDKCOption_CustomOnionMessageContentsZ res = self; memset(&self, 0, sizeof(LDKCOption_CustomOnionMessageContentsZ)); return res; }
+       ~COption_CustomOnionMessageContentsZ() { COption_CustomOnionMessageContentsZ_free(self); }
+       COption_CustomOnionMessageContentsZ& operator=(COption_CustomOnionMessageContentsZ&& o) { COption_CustomOnionMessageContentsZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_CustomOnionMessageContentsZ)); return *this; }
+       LDKCOption_CustomOnionMessageContentsZ* operator &() { return &self; }
+       LDKCOption_CustomOnionMessageContentsZ* operator ->() { return &self; }
+       const LDKCOption_CustomOnionMessageContentsZ* operator &() const { return &self; }
+       const LDKCOption_CustomOnionMessageContentsZ* operator ->() const { return &self; }
+};
 class CResult_NodeInfoDecodeErrorZ {
 private:
        LDKCResult_NodeInfoDecodeErrorZ self;
@@ -7034,21 +7167,6 @@ public:
        const LDKCVec_C2Tuple_u32ScriptZZ* operator &() const { return &self; }
        const LDKCVec_C2Tuple_u32ScriptZZ* operator ->() const { return &self; }
 };
-class CResult_NoneChannelMonitorUpdateErrZ {
-private:
-       LDKCResult_NoneChannelMonitorUpdateErrZ self;
-public:
-       CResult_NoneChannelMonitorUpdateErrZ(const CResult_NoneChannelMonitorUpdateErrZ&) = delete;
-       CResult_NoneChannelMonitorUpdateErrZ(CResult_NoneChannelMonitorUpdateErrZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NoneChannelMonitorUpdateErrZ)); }
-       CResult_NoneChannelMonitorUpdateErrZ(LDKCResult_NoneChannelMonitorUpdateErrZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ)); }
-       operator LDKCResult_NoneChannelMonitorUpdateErrZ() && { LDKCResult_NoneChannelMonitorUpdateErrZ res = self; memset(&self, 0, sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ)); return res; }
-       ~CResult_NoneChannelMonitorUpdateErrZ() { CResult_NoneChannelMonitorUpdateErrZ_free(self); }
-       CResult_NoneChannelMonitorUpdateErrZ& operator=(CResult_NoneChannelMonitorUpdateErrZ&& o) { CResult_NoneChannelMonitorUpdateErrZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NoneChannelMonitorUpdateErrZ)); return *this; }
-       LDKCResult_NoneChannelMonitorUpdateErrZ* operator &() { return &self; }
-       LDKCResult_NoneChannelMonitorUpdateErrZ* operator ->() { return &self; }
-       const LDKCResult_NoneChannelMonitorUpdateErrZ* operator &() const { return &self; }
-       const LDKCResult_NoneChannelMonitorUpdateErrZ* operator ->() const { return &self; }
-};
 class CResult_COption_ClosureReasonZDecodeErrorZ {
 private:
        LDKCResult_COption_ClosureReasonZDecodeErrorZ self;
@@ -7577,12 +7695,12 @@ inline LDK::CVec_TxidZ Confirm::get_relevant_txids() {
        LDK::CVec_TxidZ ret = (self.get_relevant_txids)(self.this_arg);
        return ret;
 }
-inline LDK::CResult_NoneChannelMonitorUpdateErrZ Watch::watch_channel(struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor) {
-       LDK::CResult_NoneChannelMonitorUpdateErrZ ret = (self.watch_channel)(self.this_arg, funding_txo, monitor);
+inline LDK::ChannelMonitorUpdateStatus Watch::watch_channel(struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor) {
+       LDK::ChannelMonitorUpdateStatus ret = (self.watch_channel)(self.this_arg, funding_txo, monitor);
        return ret;
 }
-inline LDK::CResult_NoneChannelMonitorUpdateErrZ Watch::update_channel(struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update) {
-       LDK::CResult_NoneChannelMonitorUpdateErrZ ret = (self.update_channel)(self.this_arg, funding_txo, update);
+inline LDK::ChannelMonitorUpdateStatus Watch::update_channel(struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update) {
+       LDK::ChannelMonitorUpdateStatus ret = (self.update_channel)(self.this_arg, funding_txo, update);
        return ret;
 }
 inline LDK::CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Watch::release_pending_monitor_events() {
@@ -7615,6 +7733,10 @@ inline LDK::Score LockableScore::lock() {
        LDK::Score ret = (self.lock)(self.this_arg);
        return ret;
 }
+inline uint64_t CustomOnionMessageContents::tlv_type() {
+       uint64_t ret = (self.tlv_type)(self.this_arg);
+       return ret;
+}
 inline LDKPublicKey BaseSign::get_per_commitment_point(uint64_t idx) {
        LDKPublicKey ret = (self.get_per_commitment_point)(self.this_arg, idx);
        return ret;
@@ -7659,6 +7781,10 @@ inline LDK::CResult_SignatureNoneZ BaseSign::sign_closing_transaction(const stru
        LDK::CResult_SignatureNoneZ ret = (self.sign_closing_transaction)(self.this_arg, closing_tx);
        return ret;
 }
+inline LDK::CResult_SignatureNoneZ BaseSign::sign_holder_anchor_input(struct LDKTransaction anchor_tx, uintptr_t input) {
+       LDK::CResult_SignatureNoneZ ret = (self.sign_holder_anchor_input)(self.this_arg, anchor_tx, input);
+       return ret;
+}
 inline LDK::CResult_C2Tuple_SignatureSignatureZNoneZ BaseSign::sign_channel_announcement(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg) {
        LDK::CResult_C2Tuple_SignatureSignatureZNoneZ ret = (self.sign_channel_announcement)(self.this_arg, msg);
        return ret;
@@ -7670,6 +7796,10 @@ inline LDK::CResult_SecretKeyNoneZ KeysInterface::get_node_secret(enum LDKRecipi
        LDK::CResult_SecretKeyNoneZ ret = (self.get_node_secret)(self.this_arg, recipient);
        return ret;
 }
+inline LDK::CResult_PublicKeyNoneZ KeysInterface::get_node_id(enum LDKRecipient recipient) {
+       LDK::CResult_PublicKeyNoneZ ret = (self.get_node_id)(self.this_arg, recipient);
+       return ret;
+}
 inline LDK::CResult_SharedSecretNoneZ KeysInterface::ecdh(enum LDKRecipient recipient, struct LDKPublicKey other_key, struct LDKCOption_ScalarZ tweak) {
        LDK::CResult_SharedSecretNoneZ ret = (self.ecdh)(self.this_arg, recipient, other_key, tweak);
        return ret;
@@ -7776,6 +7906,13 @@ inline uint64_t SocketDescriptor::hash() {
        uint64_t ret = (self.hash)(self.this_arg);
        return ret;
 }
+inline void CustomOnionMessageHandler::handle_custom_message(struct LDKCustomOnionMessageContents msg) {
+       (self.handle_custom_message)(self.this_arg, msg);
+}
+inline LDK::CResult_COption_CustomOnionMessageContentsZDecodeErrorZ CustomOnionMessageHandler::read_custom_message(uint64_t message_type, struct LDKu8slice buffer) {
+       LDK::CResult_COption_CustomOnionMessageContentsZDecodeErrorZ ret = (self.read_custom_message)(self.this_arg, message_type, buffer);
+       return ret;
+}
 inline LDK::CResult_NoneErrorZ Persister::persist_manager(const struct LDKChannelManager *NONNULL_PTR channel_manager) {
        LDK::CResult_NoneErrorZ ret = (self.persist_manager)(self.this_arg, channel_manager);
        return ret;
@@ -7836,8 +7973,9 @@ inline void ChannelMessageHandler::handle_announcement_signatures(struct LDKPubl
 inline void ChannelMessageHandler::peer_disconnected(struct LDKPublicKey their_node_id, bool no_connection_possible) {
        (self.peer_disconnected)(self.this_arg, their_node_id, no_connection_possible);
 }
-inline void ChannelMessageHandler::peer_connected(struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg) {
-       (self.peer_connected)(self.this_arg, their_node_id, msg);
+inline LDK::CResult_NoneNoneZ ChannelMessageHandler::peer_connected(struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg) {
+       LDK::CResult_NoneNoneZ ret = (self.peer_connected)(self.this_arg, their_node_id, msg);
+       return ret;
 }
 inline void ChannelMessageHandler::handle_channel_reestablish(struct LDKPublicKey their_node_id, const struct LDKChannelReestablish *NONNULL_PTR msg) {
        (self.handle_channel_reestablish)(self.this_arg, their_node_id, msg);
@@ -7876,8 +8014,9 @@ inline LDK::NodeAnnouncement RoutingMessageHandler::get_next_node_announcement(s
        LDK::NodeAnnouncement ret = (self.get_next_node_announcement)(self.this_arg, starting_point);
        return ret;
 }
-inline void RoutingMessageHandler::peer_connected(struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init) {
-       (self.peer_connected)(self.this_arg, their_node_id, init);
+inline LDK::CResult_NoneNoneZ RoutingMessageHandler::peer_connected(struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init) {
+       LDK::CResult_NoneNoneZ ret = (self.peer_connected)(self.this_arg, their_node_id, init);
+       return ret;
 }
 inline LDK::CResult_NoneLightningErrorZ RoutingMessageHandler::handle_reply_channel_range(struct LDKPublicKey their_node_id, struct LDKReplyChannelRange msg) {
        LDK::CResult_NoneLightningErrorZ ret = (self.handle_reply_channel_range)(self.this_arg, their_node_id, msg);
@@ -7906,8 +8045,9 @@ inline LDK::InitFeatures RoutingMessageHandler::provided_init_features(struct LD
 inline void OnionMessageHandler::handle_onion_message(struct LDKPublicKey peer_node_id, const struct LDKOnionMessage *NONNULL_PTR msg) {
        (self.handle_onion_message)(self.this_arg, peer_node_id, msg);
 }
-inline void OnionMessageHandler::peer_connected(struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init) {
-       (self.peer_connected)(self.this_arg, their_node_id, init);
+inline LDK::CResult_NoneNoneZ OnionMessageHandler::peer_connected(struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init) {
+       LDK::CResult_NoneNoneZ ret = (self.peer_connected)(self.this_arg, their_node_id, init);
+       return ret;
 }
 inline void OnionMessageHandler::peer_disconnected(struct LDKPublicKey their_node_id, bool no_connection_possible) {
        (self.peer_disconnected)(self.this_arg, their_node_id, no_connection_possible);
@@ -7926,12 +8066,12 @@ inline void Logger::log(const struct LDKRecord *NONNULL_PTR record) {
 inline void FutureCallback::call() {
        (self.call)(self.this_arg);
 }
-inline LDK::CResult_NoneChannelMonitorUpdateErrZ Persist::persist_new_channel(struct LDKOutPoint channel_id, const struct LDKChannelMonitor *NONNULL_PTR data, struct LDKMonitorUpdateId update_id) {
-       LDK::CResult_NoneChannelMonitorUpdateErrZ ret = (self.persist_new_channel)(self.this_arg, channel_id, data, update_id);
+inline LDK::ChannelMonitorUpdateStatus Persist::persist_new_channel(struct LDKOutPoint channel_id, const struct LDKChannelMonitor *NONNULL_PTR data, struct LDKMonitorUpdateId update_id) {
+       LDK::ChannelMonitorUpdateStatus ret = (self.persist_new_channel)(self.this_arg, channel_id, data, update_id);
        return ret;
 }
-inline LDK::CResult_NoneChannelMonitorUpdateErrZ Persist::update_persisted_channel(struct LDKOutPoint channel_id, const struct LDKChannelMonitorUpdate *NONNULL_PTR update, const struct LDKChannelMonitor *NONNULL_PTR data, struct LDKMonitorUpdateId update_id) {
-       LDK::CResult_NoneChannelMonitorUpdateErrZ ret = (self.update_persisted_channel)(self.this_arg, channel_id, update, data, update_id);
+inline LDK::ChannelMonitorUpdateStatus Persist::update_persisted_channel(struct LDKOutPoint channel_id, const struct LDKChannelMonitorUpdate *NONNULL_PTR update, const struct LDKChannelMonitor *NONNULL_PTR data, struct LDKMonitorUpdateId update_id) {
+       LDK::ChannelMonitorUpdateStatus ret = (self.update_persisted_channel)(self.this_arg, channel_id, update, data, update_id);
        return ret;
 }
 }
index 8351b949774c415a823b5678fb8dbabc1eb95cda..63bab7ed2649d475a72de9a5db6f950e57298824 100644 (file)
@@ -4036,98 +4036,6 @@ impl Clone for CVec_TxidZ {
        }
 }
 #[repr(C)]
-/// The contents of CResult_NoneChannelMonitorUpdateErrZ
-pub union CResult_NoneChannelMonitorUpdateErrZPtr {
-       /// Note that this value is always NULL, as there are no contents in the OK variant
-       pub result: *mut core::ffi::c_void,
-       /// A pointer to the contents in the error state.
-       /// Reading from this pointer when `result_ok` is set is undefined.
-       pub err: *mut crate::lightning::chain::ChannelMonitorUpdateErr,
-}
-#[repr(C)]
-/// A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
-/// containing a () on success and a crate::lightning::chain::ChannelMonitorUpdateErr on failure.
-/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult_NoneChannelMonitorUpdateErrZ {
-       /// The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
-       /// `err` or `result` depending on the state of `result_ok`.
-       pub contents: CResult_NoneChannelMonitorUpdateErrZPtr,
-       /// Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
-       pub result_ok: bool,
-}
-#[no_mangle]
-/// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
-pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_ok() -> CResult_NoneChannelMonitorUpdateErrZ {
-       CResult_NoneChannelMonitorUpdateErrZ {
-               contents: CResult_NoneChannelMonitorUpdateErrZPtr {
-                       result: core::ptr::null_mut(),
-               },
-               result_ok: true,
-       }
-}
-#[no_mangle]
-/// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
-pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_err(e: crate::lightning::chain::ChannelMonitorUpdateErr) -> CResult_NoneChannelMonitorUpdateErrZ {
-       CResult_NoneChannelMonitorUpdateErrZ {
-               contents: CResult_NoneChannelMonitorUpdateErrZPtr {
-                       err: Box::into_raw(Box::new(e)),
-               },
-               result_ok: false,
-       }
-}
-/// Checks if the given object is currently in the success state
-#[no_mangle]
-pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_is_ok(o: &CResult_NoneChannelMonitorUpdateErrZ) -> bool {
-       o.result_ok
-}
-#[no_mangle]
-/// Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
-pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_free(_res: CResult_NoneChannelMonitorUpdateErrZ) { }
-impl Drop for CResult_NoneChannelMonitorUpdateErrZ {
-       fn drop(&mut self) {
-               if self.result_ok {
-               } else {
-                       if unsafe { !(self.contents.err as *mut ()).is_null() } {
-                               let _ = unsafe { Box::from_raw(self.contents.err) };
-                       }
-               }
-       }
-}
-impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>> for CResult_NoneChannelMonitorUpdateErrZ {
-       fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>) -> Self {
-               let contents = if o.result_ok {
-                       let _ = unsafe { Box::from_raw(o.contents.result) };
-                       o.contents.result = core::ptr::null_mut();
-                       CResult_NoneChannelMonitorUpdateErrZPtr { result: core::ptr::null_mut() }
-               } else {
-                       let err = unsafe { o.contents.err };
-                       unsafe { o.contents.err = core::ptr::null_mut(); }
-                       CResult_NoneChannelMonitorUpdateErrZPtr { err }
-               };
-               Self {
-                       contents,
-                       result_ok: o.result_ok,
-               }
-       }
-}
-impl Clone for CResult_NoneChannelMonitorUpdateErrZ {
-       fn clone(&self) -> Self {
-               if self.result_ok {
-                       Self { result_ok: true, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
-                               result: core::ptr::null_mut()
-                       } }
-               } else {
-                       Self { result_ok: false, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
-                               err: Box::into_raw(Box::new(<crate::lightning::chain::ChannelMonitorUpdateErr>::clone(unsafe { &*self.contents.err })))
-                       } }
-               }
-       }
-}
-#[no_mangle]
-/// Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
-/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_clone(orig: &CResult_NoneChannelMonitorUpdateErrZ) -> CResult_NoneChannelMonitorUpdateErrZ { Clone::clone(&orig) }
-#[repr(C)]
 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
 /// This corresponds to std::vector in C++
 pub struct CVec_MonitorEventZ {
@@ -7065,6 +6973,98 @@ impl Clone for CResult_SecretKeyNoneZ {
 /// but with all dynamically-allocated buffers duplicated in new buffers.
 pub extern "C" fn CResult_SecretKeyNoneZ_clone(orig: &CResult_SecretKeyNoneZ) -> CResult_SecretKeyNoneZ { Clone::clone(&orig) }
 #[repr(C)]
+/// The contents of CResult_PublicKeyNoneZ
+pub union CResult_PublicKeyNoneZPtr {
+       /// A pointer to the contents in the success state.
+       /// Reading from this pointer when `result_ok` is not set is undefined.
+       pub result: *mut crate::c_types::PublicKey,
+       /// Note that this value is always NULL, as there are no contents in the Err variant
+       pub err: *mut core::ffi::c_void,
+}
+#[repr(C)]
+/// A CResult_PublicKeyNoneZ represents the result of a fallible operation,
+/// containing a crate::c_types::PublicKey on success and a () on failure.
+/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
+pub struct CResult_PublicKeyNoneZ {
+       /// The contents of this CResult_PublicKeyNoneZ, accessible via either
+       /// `err` or `result` depending on the state of `result_ok`.
+       pub contents: CResult_PublicKeyNoneZPtr,
+       /// Whether this CResult_PublicKeyNoneZ represents a success state.
+       pub result_ok: bool,
+}
+#[no_mangle]
+/// Creates a new CResult_PublicKeyNoneZ in the success state.
+pub extern "C" fn CResult_PublicKeyNoneZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyNoneZ {
+       CResult_PublicKeyNoneZ {
+               contents: CResult_PublicKeyNoneZPtr {
+                       result: Box::into_raw(Box::new(o)),
+               },
+               result_ok: true,
+       }
+}
+#[no_mangle]
+/// Creates a new CResult_PublicKeyNoneZ in the error state.
+pub extern "C" fn CResult_PublicKeyNoneZ_err() -> CResult_PublicKeyNoneZ {
+       CResult_PublicKeyNoneZ {
+               contents: CResult_PublicKeyNoneZPtr {
+                       err: core::ptr::null_mut(),
+               },
+               result_ok: false,
+       }
+}
+/// Checks if the given object is currently in the success state
+#[no_mangle]
+pub extern "C" fn CResult_PublicKeyNoneZ_is_ok(o: &CResult_PublicKeyNoneZ) -> bool {
+       o.result_ok
+}
+#[no_mangle]
+/// Frees any resources used by the CResult_PublicKeyNoneZ.
+pub extern "C" fn CResult_PublicKeyNoneZ_free(_res: CResult_PublicKeyNoneZ) { }
+impl Drop for CResult_PublicKeyNoneZ {
+       fn drop(&mut self) {
+               if self.result_ok {
+                       if unsafe { !(self.contents.result as *mut ()).is_null() } {
+                               let _ = unsafe { Box::from_raw(self.contents.result) };
+                       }
+               } else {
+               }
+       }
+}
+impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, ()>> for CResult_PublicKeyNoneZ {
+       fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, ()>) -> Self {
+               let contents = if o.result_ok {
+                       let result = unsafe { o.contents.result };
+                       unsafe { o.contents.result = core::ptr::null_mut() };
+                       CResult_PublicKeyNoneZPtr { result }
+               } else {
+                       let _ = unsafe { Box::from_raw(o.contents.err) };
+                       o.contents.err = core::ptr::null_mut();
+                       CResult_PublicKeyNoneZPtr { err: core::ptr::null_mut() }
+               };
+               Self {
+                       contents,
+                       result_ok: o.result_ok,
+               }
+       }
+}
+impl Clone for CResult_PublicKeyNoneZ {
+       fn clone(&self) -> Self {
+               if self.result_ok {
+                       Self { result_ok: true, contents: CResult_PublicKeyNoneZPtr {
+                               result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
+                       } }
+               } else {
+                       Self { result_ok: false, contents: CResult_PublicKeyNoneZPtr {
+                               err: core::ptr::null_mut()
+                       } }
+               }
+       }
+}
+#[no_mangle]
+/// Creates a new CResult_PublicKeyNoneZ which has the same data as `orig`
+/// but with all dynamically-allocated buffers duplicated in new buffers.
+pub extern "C" fn CResult_PublicKeyNoneZ_clone(orig: &CResult_PublicKeyNoneZ) -> CResult_PublicKeyNoneZ { Clone::clone(&orig) }
+#[repr(C)]
 /// An enum which can either contain a crate::c_types::BigEndianScalar or not
 pub enum COption_ScalarZ {
        /// When we're in this state, this COption_ScalarZ contains a crate::c_types::BigEndianScalar
@@ -12252,6 +12252,117 @@ impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
        }
 }
 #[repr(C)]
+/// An enum which can either contain a crate::lightning::onion_message::packet::CustomOnionMessageContents or not
+pub enum COption_CustomOnionMessageContentsZ {
+       /// When we're in this state, this COption_CustomOnionMessageContentsZ contains a crate::lightning::onion_message::packet::CustomOnionMessageContents
+       Some(crate::lightning::onion_message::packet::CustomOnionMessageContents),
+       /// When we're in this state, this COption_CustomOnionMessageContentsZ contains nothing
+       None
+}
+impl COption_CustomOnionMessageContentsZ {
+       #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
+               if let Self::None = self { false } else { true }
+       }
+       #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
+               !self.is_some()
+       }
+       #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::onion_message::packet::CustomOnionMessageContents {
+               if let Self::Some(v) = self { v } else { unreachable!() }
+       }
+}
+#[no_mangle]
+/// Constructs a new COption_CustomOnionMessageContentsZ containing a crate::lightning::onion_message::packet::CustomOnionMessageContents
+pub extern "C" fn COption_CustomOnionMessageContentsZ_some(o: crate::lightning::onion_message::packet::CustomOnionMessageContents) -> COption_CustomOnionMessageContentsZ {
+       COption_CustomOnionMessageContentsZ::Some(o)
+}
+#[no_mangle]
+/// Constructs a new COption_CustomOnionMessageContentsZ containing nothing
+pub extern "C" fn COption_CustomOnionMessageContentsZ_none() -> COption_CustomOnionMessageContentsZ {
+       COption_CustomOnionMessageContentsZ::None
+}
+#[no_mangle]
+/// Frees any resources associated with the crate::lightning::onion_message::packet::CustomOnionMessageContents, if we are in the Some state
+pub extern "C" fn COption_CustomOnionMessageContentsZ_free(_res: COption_CustomOnionMessageContentsZ) { }
+#[repr(C)]
+/// The contents of CResult_COption_CustomOnionMessageContentsZDecodeErrorZ
+pub union CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
+       /// A pointer to the contents in the success state.
+       /// Reading from this pointer when `result_ok` is not set is undefined.
+       pub result: *mut crate::c_types::derived::COption_CustomOnionMessageContentsZ,
+       /// A pointer to the contents in the error state.
+       /// Reading from this pointer when `result_ok` is set is undefined.
+       pub err: *mut crate::lightning::ln::msgs::DecodeError,
+}
+#[repr(C)]
+/// A CResult_COption_CustomOnionMessageContentsZDecodeErrorZ represents the result of a fallible operation,
+/// containing a crate::c_types::derived::COption_CustomOnionMessageContentsZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
+/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
+pub struct CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
+       /// The contents of this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ, accessible via either
+       /// `err` or `result` depending on the state of `result_ok`.
+       pub contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr,
+       /// Whether this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ represents a success state.
+       pub result_ok: bool,
+}
+#[no_mangle]
+/// Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the success state.
+pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(o: crate::c_types::derived::COption_CustomOnionMessageContentsZ) -> CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
+       CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
+               contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
+                       result: Box::into_raw(Box::new(o)),
+               },
+               result_ok: true,
+       }
+}
+#[no_mangle]
+/// Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the error state.
+pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
+       CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
+               contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
+                       err: Box::into_raw(Box::new(e)),
+               },
+               result_ok: false,
+       }
+}
+/// Checks if the given object is currently in the success state
+#[no_mangle]
+pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(o: &CResult_COption_CustomOnionMessageContentsZDecodeErrorZ) -> bool {
+       o.result_ok
+}
+#[no_mangle]
+/// Frees any resources used by the CResult_COption_CustomOnionMessageContentsZDecodeErrorZ.
+pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(_res: CResult_COption_CustomOnionMessageContentsZDecodeErrorZ) { }
+impl Drop for CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
+       fn drop(&mut self) {
+               if self.result_ok {
+                       if unsafe { !(self.contents.result as *mut ()).is_null() } {
+                               let _ = unsafe { Box::from_raw(self.contents.result) };
+                       }
+               } else {
+                       if unsafe { !(self.contents.err as *mut ()).is_null() } {
+                               let _ = unsafe { Box::from_raw(self.contents.err) };
+                       }
+               }
+       }
+}
+impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_CustomOnionMessageContentsZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
+       fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_CustomOnionMessageContentsZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
+               let contents = if o.result_ok {
+                       let result = unsafe { o.contents.result };
+                       unsafe { o.contents.result = core::ptr::null_mut() };
+                       CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr { result }
+               } else {
+                       let err = unsafe { o.contents.err };
+                       unsafe { o.contents.err = core::ptr::null_mut(); }
+                       CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr { err }
+               };
+               Self {
+                       contents,
+                       result_ok: o.result_ok,
+               }
+       }
+}
+#[repr(C)]
 #[derive(Clone)]
 /// An enum which can either contain a crate::lightning::ln::msgs::NetAddress or not
 pub enum COption_NetAddressZ {
index 2d722b77029e8270ec74b4e2c77a315d5110c938..4955ca0a8a10529718ade6c94991b21835071154 100644 (file)
@@ -124,20 +124,21 @@ pub extern "C" fn MonitorUpdateId_eq(a: &MonitorUpdateId, b: &MonitorUpdateId) -
 ///
 /// Each method can return three possible values:
 ///  * If persistence (including any relevant `fsync()` calls) happens immediately, the
-///    implementation should return `Ok(())`, indicating normal channel operation should continue.
+///    implementation should return [`ChannelMonitorUpdateStatus::Completed`], indicating normal
+///    channel operation should continue.
 ///  * If persistence happens asynchronously, implementations should first ensure the
 ///    [`ChannelMonitor`] or [`ChannelMonitorUpdate`] are written durably to disk, and then return
-///    `Err(ChannelMonitorUpdateErr::TemporaryFailure)` while the update continues in the
-///    background. Once the update completes, [`ChainMonitor::channel_monitor_updated`] should be
-///    called with the corresponding [`MonitorUpdateId`].
+///    [`ChannelMonitorUpdateStatus::InProgress`] while the update continues in the background.
+///    Once the update completes, [`ChainMonitor::channel_monitor_updated`] should be called with
+///    the corresponding [`MonitorUpdateId`].
 ///
 ///    Note that unlike the direct [`chain::Watch`] interface,
 ///    [`ChainMonitor::channel_monitor_updated`] must be called once for *each* update which occurs.
 ///
 ///  * If persistence fails for some reason, implementations should return
-///    `Err(ChannelMonitorUpdateErr::PermanentFailure)`, in which case the channel will likely be
+///    [`ChannelMonitorUpdateStatus::PermanentFailure`], in which case the channel will likely be
 ///    closed without broadcasting the latest state. See
-///    [`ChannelMonitorUpdateErr::PermanentFailure`] for more details.
+///    [`ChannelMonitorUpdateStatus::PermanentFailure`] for more details.
 #[repr(C)]
 pub struct Persist {
        /// An opaque pointer which is passed to your function implementations as an argument.
@@ -151,15 +152,15 @@ pub struct Persist {
        /// and the stored channel data). Note that you **must** persist every new monitor to disk.
        ///
        /// The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`],
-       /// if you return [`ChannelMonitorUpdateErr::TemporaryFailure`].
+       /// if you return [`ChannelMonitorUpdateStatus::InProgress`].
        ///
        /// See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`
-       /// and [`ChannelMonitorUpdateErr`] for requirements when returning errors.
+       /// and [`ChannelMonitorUpdateStatus`] for requirements when returning errors.
        ///
        /// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
        /// [`Writeable::write`]: crate::util::ser::Writeable::write
        #[must_use]
-       pub persist_new_channel: extern "C" fn (this_arg: *const c_void, channel_id: crate::lightning::chain::transaction::OutPoint, data: &crate::lightning::chain::channelmonitor::ChannelMonitor, update_id: crate::lightning::chain::chainmonitor::MonitorUpdateId) -> crate::c_types::derived::CResult_NoneChannelMonitorUpdateErrZ,
+       pub persist_new_channel: extern "C" fn (this_arg: *const c_void, channel_id: crate::lightning::chain::transaction::OutPoint, data: &crate::lightning::chain::channelmonitor::ChannelMonitor, update_id: crate::lightning::chain::chainmonitor::MonitorUpdateId) -> crate::lightning::chain::ChannelMonitorUpdateStatus,
        /// Update one channel's data. The provided [`ChannelMonitor`] has already applied the given
        /// update.
        ///
@@ -186,17 +187,17 @@ pub struct Persist {
        /// whereas updates are small and `O(1)`.
        ///
        /// The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`],
-       /// if you return [`ChannelMonitorUpdateErr::TemporaryFailure`].
+       /// if you return [`ChannelMonitorUpdateStatus::InProgress`].
        ///
        /// See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`,
        /// [`Writeable::write`] on [`ChannelMonitorUpdate`] for writing out an update, and
-       /// [`ChannelMonitorUpdateErr`] for requirements when returning errors.
+       /// [`ChannelMonitorUpdateStatus`] for requirements when returning errors.
        ///
        /// [`Writeable::write`]: crate::util::ser::Writeable::write
        ///
        /// Note that update (or a relevant inner pointer) may be NULL or all-0s to represent None
        #[must_use]
-       pub update_persisted_channel: extern "C" fn (this_arg: *const c_void, channel_id: crate::lightning::chain::transaction::OutPoint, update: &crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, data: &crate::lightning::chain::channelmonitor::ChannelMonitor, update_id: crate::lightning::chain::chainmonitor::MonitorUpdateId) -> crate::c_types::derived::CResult_NoneChannelMonitorUpdateErrZ,
+       pub update_persisted_channel: extern "C" fn (this_arg: *const c_void, channel_id: crate::lightning::chain::transaction::OutPoint, update: &crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, data: &crate::lightning::chain::channelmonitor::ChannelMonitor, update_id: crate::lightning::chain::chainmonitor::MonitorUpdateId) -> crate::lightning::chain::ChannelMonitorUpdateStatus,
        /// Frees any resources associated with this object given its this_arg pointer.
        /// Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
        pub free: Option<extern "C" fn(this_arg: *mut c_void)>,
@@ -215,16 +216,14 @@ pub(crate) extern "C" fn Persist_clone_fields(orig: &Persist) -> Persist {
 
 use lightning::chain::chainmonitor::Persist as rustPersist;
 impl rustPersist<crate::lightning::chain::keysinterface::Sign> for Persist {
-       fn persist_new_channel(&self, mut channel_id: lightning::chain::transaction::OutPoint, mut data: &lightning::chain::channelmonitor::ChannelMonitor<crate::lightning::chain::keysinterface::Sign>, mut update_id: lightning::chain::chainmonitor::MonitorUpdateId) -> Result<(), lightning::chain::ChannelMonitorUpdateErr> {
+       fn persist_new_channel(&self, mut channel_id: lightning::chain::transaction::OutPoint, mut data: &lightning::chain::channelmonitor::ChannelMonitor<crate::lightning::chain::keysinterface::Sign>, mut update_id: lightning::chain::chainmonitor::MonitorUpdateId) -> lightning::chain::ChannelMonitorUpdateStatus {
                let mut ret = (self.persist_new_channel)(self.this_arg, crate::lightning::chain::transaction::OutPoint { inner: ObjOps::heap_alloc(channel_id), is_owned: true }, &crate::lightning::chain::channelmonitor::ChannelMonitor { inner: unsafe { ObjOps::nonnull_ptr_to_inner((data as *const lightning::chain::channelmonitor::ChannelMonitor<_, >) as *mut _) }, is_owned: false }, crate::lightning::chain::chainmonitor::MonitorUpdateId { inner: ObjOps::heap_alloc(update_id), is_owned: true });
-               let mut local_ret = match ret.result_ok { true => Ok( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) })*/ }), false => Err( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).into_native() })};
-               local_ret
+               ret.into_native()
        }
-       fn update_persisted_channel(&self, mut channel_id: lightning::chain::transaction::OutPoint, mut update: &Option<lightning::chain::channelmonitor::ChannelMonitorUpdate>, mut data: &lightning::chain::channelmonitor::ChannelMonitor<crate::lightning::chain::keysinterface::Sign>, mut update_id: lightning::chain::chainmonitor::MonitorUpdateId) -> Result<(), lightning::chain::ChannelMonitorUpdateErr> {
+       fn update_persisted_channel(&self, mut channel_id: lightning::chain::transaction::OutPoint, mut update: &Option<lightning::chain::channelmonitor::ChannelMonitorUpdate>, mut data: &lightning::chain::channelmonitor::ChannelMonitor<crate::lightning::chain::keysinterface::Sign>, mut update_id: lightning::chain::chainmonitor::MonitorUpdateId) -> lightning::chain::ChannelMonitorUpdateStatus {
                let mut local_update = &crate::lightning::chain::channelmonitor::ChannelMonitorUpdate { inner: unsafe { (if update.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (update.as_ref().unwrap()) }) } as *const lightning::chain::channelmonitor::ChannelMonitorUpdate<>) as *mut _ }, is_owned: false };
                let mut ret = (self.update_persisted_channel)(self.this_arg, crate::lightning::chain::transaction::OutPoint { inner: ObjOps::heap_alloc(channel_id), is_owned: true }, local_update, &crate::lightning::chain::channelmonitor::ChannelMonitor { inner: unsafe { ObjOps::nonnull_ptr_to_inner((data as *const lightning::chain::channelmonitor::ChannelMonitor<_, >) as *mut _) }, is_owned: false }, crate::lightning::chain::chainmonitor::MonitorUpdateId { inner: ObjOps::heap_alloc(update_id), is_owned: true });
-               let mut local_ret = match ret.result_ok { true => Ok( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) })*/ }), false => Err( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).into_native() })};
-               local_ret
+               ret.into_native()
        }
 }
 
@@ -418,12 +417,12 @@ pub extern "C" fn ChainMonitor_list_monitors(this_arg: &crate::lightning::chain:
 }
 
 /// Indicates the persistence of a [`ChannelMonitor`] has completed after
-/// [`ChannelMonitorUpdateErr::TemporaryFailure`] was returned from an update operation.
+/// [`ChannelMonitorUpdateStatus::InProgress`] was returned from an update operation.
 ///
 /// Thus, the anticipated use is, at a high level:
 ///  1) This [`ChainMonitor`] calls [`Persist::update_persisted_channel`] which stores the
 ///     update to disk and begins updating any remote (e.g. watchtower/backup) copies,
-///     returning [`ChannelMonitorUpdateErr::TemporaryFailure`],
+///     returning [`ChannelMonitorUpdateStatus::InProgress`],
 ///  2) once all remote copies are updated, you call this function with the
 ///     `completed_update_id` that completed, and once all pending updates have completed the
 ///     channel will be re-enabled.
@@ -537,16 +536,14 @@ pub extern "C" fn ChainMonitor_as_Watch(this_arg: &ChainMonitor) -> crate::light
 }
 
 #[must_use]
-extern "C" fn ChainMonitor_Watch_watch_channel(this_arg: *const c_void, mut funding_txo: crate::lightning::chain::transaction::OutPoint, mut monitor: crate::lightning::chain::channelmonitor::ChannelMonitor) -> crate::c_types::derived::CResult_NoneChannelMonitorUpdateErrZ {
+extern "C" fn ChainMonitor_Watch_watch_channel(this_arg: *const c_void, mut funding_txo: crate::lightning::chain::transaction::OutPoint, mut monitor: crate::lightning::chain::channelmonitor::ChannelMonitor) -> crate::lightning::chain::ChannelMonitorUpdateStatus {
        let mut ret = <nativeChainMonitor as lightning::chain::Watch<_>>::watch_channel(unsafe { &mut *(this_arg as *mut nativeChainMonitor) }, *unsafe { Box::from_raw(funding_txo.take_inner()) }, *unsafe { Box::from_raw(monitor.take_inner()) });
-       let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::chain::ChannelMonitorUpdateErr::native_into(e) }).into() };
-       local_ret
+       crate::lightning::chain::ChannelMonitorUpdateStatus::native_into(ret)
 }
 #[must_use]
-extern "C" fn ChainMonitor_Watch_update_channel(this_arg: *const c_void, mut funding_txo: crate::lightning::chain::transaction::OutPoint, mut update: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> crate::c_types::derived::CResult_NoneChannelMonitorUpdateErrZ {
+extern "C" fn ChainMonitor_Watch_update_channel(this_arg: *const c_void, mut funding_txo: crate::lightning::chain::transaction::OutPoint, mut update: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> crate::lightning::chain::ChannelMonitorUpdateStatus {
        let mut ret = <nativeChainMonitor as lightning::chain::Watch<_>>::update_channel(unsafe { &mut *(this_arg as *mut nativeChainMonitor) }, *unsafe { Box::from_raw(funding_txo.take_inner()) }, *unsafe { Box::from_raw(update.take_inner()) });
-       let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::chain::ChannelMonitorUpdateErr::native_into(e) }).into() };
-       local_ret
+       crate::lightning::chain::ChannelMonitorUpdateStatus::native_into(ret)
 }
 #[must_use]
 extern "C" fn ChainMonitor_Watch_release_pending_monitor_events(this_arg: *const c_void) -> crate::c_types::derived::CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
index 88fcd36749e73b3d3642cb7997d95672a5c7ce33..bfa80877d8a99300e39f91da585df67940566bfd 100644 (file)
@@ -89,12 +89,14 @@ impl ChannelMonitorUpdate {
 /// increasing and increase by one for each new update, with one exception specified below.
 ///
 /// This sequence number is also used to track up to which points updates which returned
-/// ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
+/// [`ChannelMonitorUpdateStatus::InProgress`] have been applied to all copies of a given
 /// ChannelMonitor when ChannelManager::channel_monitor_updated is called.
 ///
 /// The only instance where update_id values are not strictly increasing is the case where we
 /// allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
 /// its docs for more details.
+///
+/// [`ChannelMonitorUpdateStatus::InProgress`]: super::ChannelMonitorUpdateStatus::InProgress
 #[no_mangle]
 pub extern "C" fn ChannelMonitorUpdate_get_update_id(this_ptr: &ChannelMonitorUpdate) -> u64 {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().update_id;
@@ -105,12 +107,14 @@ pub extern "C" fn ChannelMonitorUpdate_get_update_id(this_ptr: &ChannelMonitorUp
 /// increasing and increase by one for each new update, with one exception specified below.
 ///
 /// This sequence number is also used to track up to which points updates which returned
-/// ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
+/// [`ChannelMonitorUpdateStatus::InProgress`] have been applied to all copies of a given
 /// ChannelMonitor when ChannelManager::channel_monitor_updated is called.
 ///
 /// The only instance where update_id values are not strictly increasing is the case where we
 /// allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
 /// its docs for more details.
+///
+/// [`ChannelMonitorUpdateStatus::InProgress`]: super::ChannelMonitorUpdateStatus::InProgress
 #[no_mangle]
 pub extern "C" fn ChannelMonitorUpdate_set_update_id(this_ptr: &mut ChannelMonitorUpdate, mut val: u64) {
        unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.update_id = val;
@@ -157,7 +161,7 @@ pub(crate) extern "C" fn ChannelMonitorUpdate_write_void(obj: *const c_void) ->
 /// Read a ChannelMonitorUpdate from a byte array, created by ChannelMonitorUpdate_write
 pub extern "C" fn ChannelMonitorUpdate_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelMonitorUpdateDecodeErrorZ {
        let res: Result<lightning::chain::channelmonitor::ChannelMonitorUpdate, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::chain::channelmonitor::ChannelMonitorUpdate { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::chain::channelmonitor::ChannelMonitorUpdate { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 /// An event to be processed by the ChannelManager.
@@ -172,10 +176,10 @@ pub enum MonitorEvent {
        CommitmentTxConfirmed(
                crate::lightning::chain::transaction::OutPoint),
        /// Indicates a [`ChannelMonitor`] update has completed. See
-       /// [`ChannelMonitorUpdateErr::TemporaryFailure`] for more information on how this is used.
+       /// [`ChannelMonitorUpdateStatus::InProgress`] for more information on how this is used.
        ///
-       /// [`ChannelMonitorUpdateErr::TemporaryFailure`]: super::ChannelMonitorUpdateErr::TemporaryFailure
-       UpdateCompleted {
+       /// [`ChannelMonitorUpdateStatus::InProgress`]: super::ChannelMonitorUpdateStatus::InProgress
+       Completed {
                /// The funding outpoint of the [`ChannelMonitor`] that was updated
                funding_txo: crate::lightning::chain::transaction::OutPoint,
                /// The Update ID from [`ChannelMonitorUpdate::update_id`] which was applied or
@@ -186,9 +190,9 @@ pub enum MonitorEvent {
                monitor_update_id: u64,
        },
        /// Indicates a [`ChannelMonitor`] update has failed. See
-       /// [`ChannelMonitorUpdateErr::PermanentFailure`] for more information on how this is used.
+       /// [`ChannelMonitorUpdateStatus::PermanentFailure`] for more information on how this is used.
        ///
-       /// [`ChannelMonitorUpdateErr::PermanentFailure`]: super::ChannelMonitorUpdateErr::PermanentFailure
+       /// [`ChannelMonitorUpdateStatus::PermanentFailure`]: super::ChannelMonitorUpdateStatus::PermanentFailure
        UpdateFailed(
                crate::lightning::chain::transaction::OutPoint),
 }
@@ -211,10 +215,10 @@ impl MonitorEvent {
                                        *unsafe { Box::from_raw(a_nonref.take_inner()) },
                                )
                        },
-                       MonitorEvent::UpdateCompleted {ref funding_txo, ref monitor_update_id, } => {
+                       MonitorEvent::Completed {ref funding_txo, ref monitor_update_id, } => {
                                let mut funding_txo_nonref = (*funding_txo).clone();
                                let mut monitor_update_id_nonref = (*monitor_update_id).clone();
-                               nativeMonitorEvent::UpdateCompleted {
+                               nativeMonitorEvent::Completed {
                                        funding_txo: *unsafe { Box::from_raw(funding_txo_nonref.take_inner()) },
                                        monitor_update_id: monitor_update_id_nonref,
                                }
@@ -240,8 +244,8 @@ impl MonitorEvent {
                                        *unsafe { Box::from_raw(a.take_inner()) },
                                )
                        },
-                       MonitorEvent::UpdateCompleted {mut funding_txo, mut monitor_update_id, } => {
-                               nativeMonitorEvent::UpdateCompleted {
+                       MonitorEvent::Completed {mut funding_txo, mut monitor_update_id, } => {
+                               nativeMonitorEvent::Completed {
                                        funding_txo: *unsafe { Box::from_raw(funding_txo.take_inner()) },
                                        monitor_update_id: monitor_update_id,
                                }
@@ -268,10 +272,10 @@ impl MonitorEvent {
                                        crate::lightning::chain::transaction::OutPoint { inner: ObjOps::heap_alloc(a_nonref), is_owned: true },
                                )
                        },
-                       nativeMonitorEvent::UpdateCompleted {ref funding_txo, ref monitor_update_id, } => {
+                       nativeMonitorEvent::Completed {ref funding_txo, ref monitor_update_id, } => {
                                let mut funding_txo_nonref = (*funding_txo).clone();
                                let mut monitor_update_id_nonref = (*monitor_update_id).clone();
-                               MonitorEvent::UpdateCompleted {
+                               MonitorEvent::Completed {
                                        funding_txo: crate::lightning::chain::transaction::OutPoint { inner: ObjOps::heap_alloc(funding_txo_nonref), is_owned: true },
                                        monitor_update_id: monitor_update_id_nonref,
                                }
@@ -297,8 +301,8 @@ impl MonitorEvent {
                                        crate::lightning::chain::transaction::OutPoint { inner: ObjOps::heap_alloc(a), is_owned: true },
                                )
                        },
-                       nativeMonitorEvent::UpdateCompleted {mut funding_txo, mut monitor_update_id, } => {
-                               MonitorEvent::UpdateCompleted {
+                       nativeMonitorEvent::Completed {mut funding_txo, mut monitor_update_id, } => {
+                               MonitorEvent::Completed {
                                        funding_txo: crate::lightning::chain::transaction::OutPoint { inner: ObjOps::heap_alloc(funding_txo), is_owned: true },
                                        monitor_update_id: monitor_update_id,
                                }
@@ -330,9 +334,9 @@ pub extern "C" fn MonitorEvent_commitment_tx_confirmed(a: crate::lightning::chai
        MonitorEvent::CommitmentTxConfirmed(a, )
 }
 #[no_mangle]
-/// Utility method to constructs a new UpdateCompleted-variant MonitorEvent
-pub extern "C" fn MonitorEvent_update_completed(funding_txo: crate::lightning::chain::transaction::OutPoint, monitor_update_id: u64) -> MonitorEvent {
-       MonitorEvent::UpdateCompleted {
+/// Utility method to constructs a new Completed-variant MonitorEvent
+pub extern "C" fn MonitorEvent_completed(funding_txo: crate::lightning::chain::transaction::OutPoint, monitor_update_id: u64) -> MonitorEvent {
+       MonitorEvent::Completed {
                funding_txo,
                monitor_update_id,
        }
@@ -342,6 +346,12 @@ pub extern "C" fn MonitorEvent_update_completed(funding_txo: crate::lightning::c
 pub extern "C" fn MonitorEvent_update_failed(a: crate::lightning::chain::transaction::OutPoint) -> MonitorEvent {
        MonitorEvent::UpdateFailed(a, )
 }
+/// Checks if two MonitorEvents contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+#[no_mangle]
+pub extern "C" fn MonitorEvent_eq(a: &MonitorEvent, b: &MonitorEvent) -> bool {
+       if &a.to_native() == &b.to_native() { true } else { false }
+}
 #[no_mangle]
 /// Serialize the MonitorEvent object into a byte array which can be read by MonitorEvent_read
 pub extern "C" fn MonitorEvent_write(obj: &crate::lightning::chain::channelmonitor::MonitorEvent) -> crate::c_types::derived::CVec_u8Z {
@@ -351,7 +361,7 @@ pub extern "C" fn MonitorEvent_write(obj: &crate::lightning::chain::channelmonit
 /// Read a MonitorEvent from a byte array, created by MonitorEvent_write
 pub extern "C" fn MonitorEvent_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_COption_MonitorEventZDecodeErrorZ {
        let res: Result<Option<lightning::chain::channelmonitor::MonitorEvent>, lightning::ln::msgs::DecodeError> = crate::c_types::maybe_deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { let mut local_res_0 = if o.is_none() { crate::c_types::derived::COption_MonitorEventZ::None } else { crate::c_types::derived::COption_MonitorEventZ::Some( { crate::lightning::chain::channelmonitor::MonitorEvent::native_into(o.unwrap()) }) }; local_res_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { let mut local_res_0 = if o.is_none() { crate::c_types::derived::COption_MonitorEventZ::None } else { crate::c_types::derived::COption_MonitorEventZ::Some( { crate::lightning::chain::channelmonitor::MonitorEvent::native_into(o.unwrap()) }) }; local_res_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 
@@ -426,6 +436,15 @@ pub(crate) extern "C" fn HTLCUpdate_clone_void(this_ptr: *const c_void) -> *mut
 pub extern "C" fn HTLCUpdate_clone(orig: &HTLCUpdate) -> HTLCUpdate {
        orig.clone()
 }
+/// Checks if two HTLCUpdates contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn HTLCUpdate_eq(a: &HTLCUpdate, b: &HTLCUpdate) -> bool {
+       if a.inner == b.inner { return true; }
+       if a.inner.is_null() || b.inner.is_null() { return false; }
+       if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
 #[no_mangle]
 /// Serialize the HTLCUpdate object into a byte array which can be read by HTLCUpdate_read
 pub extern "C" fn HTLCUpdate_write(obj: &crate::lightning::chain::channelmonitor::HTLCUpdate) -> crate::c_types::derived::CVec_u8Z {
@@ -439,7 +458,7 @@ pub(crate) extern "C" fn HTLCUpdate_write_void(obj: *const c_void) -> crate::c_t
 /// Read a HTLCUpdate from a byte array, created by HTLCUpdate_write
 pub extern "C" fn HTLCUpdate_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_HTLCUpdateDecodeErrorZ {
        let res: Result<lightning::chain::channelmonitor::HTLCUpdate, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::chain::channelmonitor::HTLCUpdate { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::chain::channelmonitor::HTLCUpdate { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 /// Number of blocks we wait on seeing a HTLC output being solved before we fail corresponding
@@ -931,14 +950,20 @@ pub extern "C" fn ChannelMonitor_get_counterparty_node_id(this_arg: &crate::ligh
 }
 
 /// 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.
+/// the Channel was out-of-date.
+///
+/// You may also use this to broadcast the latest local commitment transaction, either because
+/// a monitor update failed with [`ChannelMonitorUpdateStatus::PermanentFailure`] or because we've
+/// fallen behind (i.e. we've received proof that our counterparty side knows a revocation
+/// secret we gave them that they shouldn't know).
+///
+/// Broadcasting these transactions in the second case is UNSAFE, as they allow counterparty
+/// side to punish you. Nevertheless you may want to broadcast them if counterparty doesn't
+/// close channel with their commitment transaction after a substantial amount of time. Best
+/// may be to contact the other node operator out-of-band to coordinate other options available
+/// to you. In any-case, the choice is up to you.
+///
+/// [`ChannelMonitorUpdateStatus::PermanentFailure`]: super::ChannelMonitorUpdateStatus::PermanentFailure
 #[must_use]
 #[no_mangle]
 pub extern "C" fn ChannelMonitor_get_latest_holder_commitment_txn(this_arg: &crate::lightning::chain::channelmonitor::ChannelMonitor, logger: &crate::lightning::util::logger::Logger) -> crate::c_types::derived::CVec_TransactionZ {
@@ -1062,6 +1087,6 @@ pub extern "C" fn ChannelMonitor_get_claimable_balances(this_arg: &crate::lightn
 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_read(ser: crate::c_types::u8slice, arg: &crate::lightning::chain::keysinterface::KeysInterface) -> crate::c_types::derived::CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
        let arg_conv = arg;
        let res: Result<(bitcoin::hash_types::BlockHash, lightning::chain::channelmonitor::ChannelMonitor<crate::lightning::chain::keysinterface::Sign>), lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj_arg(ser, arg_conv);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { let (mut orig_res_0_0, mut orig_res_0_1) = o; let mut local_res_0 = (crate::c_types::ThirtyTwoBytes { data: orig_res_0_0.into_inner() }, crate::lightning::chain::channelmonitor::ChannelMonitor { inner: ObjOps::heap_alloc(orig_res_0_1), is_owned: true }).into(); local_res_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { let (mut orig_res_0_0, mut orig_res_0_1) = o; let mut local_res_0 = (crate::c_types::ThirtyTwoBytes { data: orig_res_0_0.into_inner() }, crate::lightning::chain::channelmonitor::ChannelMonitor { inner: ObjOps::heap_alloc(orig_res_0_1), is_owned: true }).into(); local_res_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
index 417e73dd8b77c26111f2d95d1568892de4d01929..f2c7993d7b8cbaf7761030a52bffef7e270958cf 100644 (file)
@@ -190,6 +190,15 @@ pub(crate) extern "C" fn DelayedPaymentOutputDescriptor_clone_void(this_ptr: *co
 pub extern "C" fn DelayedPaymentOutputDescriptor_clone(orig: &DelayedPaymentOutputDescriptor) -> DelayedPaymentOutputDescriptor {
        orig.clone()
 }
+/// Checks if two DelayedPaymentOutputDescriptors contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn DelayedPaymentOutputDescriptor_eq(a: &DelayedPaymentOutputDescriptor, b: &DelayedPaymentOutputDescriptor) -> bool {
+       if a.inner == b.inner { return true; }
+       if a.inner.is_null() || b.inner.is_null() { return false; }
+       if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
 #[no_mangle]
 /// Serialize the DelayedPaymentOutputDescriptor object into a byte array which can be read by DelayedPaymentOutputDescriptor_read
 pub extern "C" fn DelayedPaymentOutputDescriptor_write(obj: &crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor) -> crate::c_types::derived::CVec_u8Z {
@@ -203,7 +212,7 @@ pub(crate) extern "C" fn DelayedPaymentOutputDescriptor_write_void(obj: *const c
 /// Read a DelayedPaymentOutputDescriptor from a byte array, created by DelayedPaymentOutputDescriptor_write
 pub extern "C" fn DelayedPaymentOutputDescriptor_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
        let res: Result<lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 
@@ -338,6 +347,15 @@ pub(crate) extern "C" fn StaticPaymentOutputDescriptor_clone_void(this_ptr: *con
 pub extern "C" fn StaticPaymentOutputDescriptor_clone(orig: &StaticPaymentOutputDescriptor) -> StaticPaymentOutputDescriptor {
        orig.clone()
 }
+/// Checks if two StaticPaymentOutputDescriptors contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn StaticPaymentOutputDescriptor_eq(a: &StaticPaymentOutputDescriptor, b: &StaticPaymentOutputDescriptor) -> bool {
+       if a.inner == b.inner { return true; }
+       if a.inner.is_null() || b.inner.is_null() { return false; }
+       if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
 #[no_mangle]
 /// Serialize the StaticPaymentOutputDescriptor object into a byte array which can be read by StaticPaymentOutputDescriptor_read
 pub extern "C" fn StaticPaymentOutputDescriptor_write(obj: &crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor) -> crate::c_types::derived::CVec_u8Z {
@@ -351,7 +369,7 @@ pub(crate) extern "C" fn StaticPaymentOutputDescriptor_write_void(obj: *const c_
 /// Read a StaticPaymentOutputDescriptor from a byte array, created by StaticPaymentOutputDescriptor_write
 pub extern "C" fn StaticPaymentOutputDescriptor_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
        let res: Result<lightning::chain::keysinterface::StaticPaymentOutputDescriptor, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 /// When on-chain outputs are created by rust-lightning (which our counterparty is not able to
@@ -537,6 +555,12 @@ pub extern "C" fn SpendableOutputDescriptor_delayed_payment_output(a: crate::lig
 pub extern "C" fn SpendableOutputDescriptor_static_payment_output(a: crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor) -> SpendableOutputDescriptor {
        SpendableOutputDescriptor::StaticPaymentOutput(a, )
 }
+/// Checks if two SpendableOutputDescriptors contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+#[no_mangle]
+pub extern "C" fn SpendableOutputDescriptor_eq(a: &SpendableOutputDescriptor, b: &SpendableOutputDescriptor) -> bool {
+       if &a.to_native() == &b.to_native() { true } else { false }
+}
 #[no_mangle]
 /// Serialize the SpendableOutputDescriptor object into a byte array which can be read by SpendableOutputDescriptor_read
 pub extern "C" fn SpendableOutputDescriptor_write(obj: &crate::lightning::chain::keysinterface::SpendableOutputDescriptor) -> crate::c_types::derived::CVec_u8Z {
@@ -546,7 +570,7 @@ pub extern "C" fn SpendableOutputDescriptor_write(obj: &crate::lightning::chain:
 /// Read a SpendableOutputDescriptor from a byte array, created by SpendableOutputDescriptor_write
 pub extern "C" fn SpendableOutputDescriptor_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_SpendableOutputDescriptorDecodeErrorZ {
        let res: Result<lightning::chain::keysinterface::SpendableOutputDescriptor, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::chain::keysinterface::SpendableOutputDescriptor::native_into(o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::chain::keysinterface::SpendableOutputDescriptor::native_into(o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 /// A trait to sign lightning channel transactions as described in BOLT 3.
@@ -706,6 +730,10 @@ pub struct BaseSign {
        /// chosen to forgo their output as dust.
        #[must_use]
        pub sign_closing_transaction: extern "C" fn (this_arg: *const c_void, closing_tx: &crate::lightning::ln::chan_utils::ClosingTransaction) -> crate::c_types::derived::CResult_SignatureNoneZ,
+       /// Computes the signature for a commitment transaction's anchor output used as an
+       /// input within `anchor_tx`, which spends the commitment transaction, at index `input`.
+       #[must_use]
+       pub sign_holder_anchor_input: extern "C" fn (this_arg: *const c_void, anchor_tx: crate::c_types::Transaction, input: usize) -> crate::c_types::derived::CResult_SignatureNoneZ,
        /// Signs a channel announcement message with our funding key and our node secret key (aka
        /// node_id or network_key), proving it comes from one of the channel participants.
        ///
@@ -751,6 +779,7 @@ pub(crate) extern "C" fn BaseSign_clone_fields(orig: &BaseSign) -> BaseSign {
                sign_justice_revoked_htlc: Clone::clone(&orig.sign_justice_revoked_htlc),
                sign_counterparty_htlc_transaction: Clone::clone(&orig.sign_counterparty_htlc_transaction),
                sign_closing_transaction: Clone::clone(&orig.sign_closing_transaction),
+               sign_holder_anchor_input: Clone::clone(&orig.sign_holder_anchor_input),
                sign_channel_announcement: Clone::clone(&orig.sign_channel_announcement),
                ready_channel: Clone::clone(&orig.ready_channel),
                free: Clone::clone(&orig.free),
@@ -819,6 +848,11 @@ impl rustBaseSign for BaseSign {
                let mut local_ret = match ret.result_ok { true => Ok( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).into_rust() }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })};
                local_ret
        }
+       fn sign_holder_anchor_input(&self, mut anchor_tx: &bitcoin::blockdata::transaction::Transaction, mut input: usize, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1<bitcoin::secp256k1::All>) -> Result<bitcoin::secp256k1::ecdsa::Signature, ()> {
+               let mut ret = (self.sign_holder_anchor_input)(self.this_arg, crate::c_types::Transaction::from_bitcoin(anchor_tx), input);
+               let mut local_ret = match ret.result_ok { true => Ok( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).into_rust() }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })};
+               local_ret
+       }
        fn sign_channel_announcement(&self, mut msg: &lightning::ln::msgs::UnsignedChannelAnnouncement, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1<bitcoin::secp256k1::All>) -> Result<(bitcoin::secp256k1::ecdsa::Signature, bitcoin::secp256k1::ecdsa::Signature), ()> {
                let mut ret = (self.sign_channel_announcement)(self.this_arg, &crate::lightning::ln::msgs::UnsignedChannelAnnouncement { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::UnsignedChannelAnnouncement<>) as *mut _) }, is_owned: false });
                let mut local_ret = match ret.result_ok { true => Ok( { let (mut orig_ret_0_0, mut orig_ret_0_1) = (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).to_rust(); let mut local_ret_0 = (orig_ret_0_0.into_rust(), orig_ret_0_1.into_rust()); local_ret_0 }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })};
@@ -942,6 +976,11 @@ impl lightning::chain::keysinterface::BaseSign for Sign {
                let mut local_ret = match ret.result_ok { true => Ok( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).into_rust() }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })};
                local_ret
        }
+       fn sign_holder_anchor_input(&self, mut anchor_tx: &bitcoin::blockdata::transaction::Transaction, mut input: usize, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1<bitcoin::secp256k1::All>) -> Result<bitcoin::secp256k1::ecdsa::Signature, ()> {
+               let mut ret = (self.BaseSign.sign_holder_anchor_input)(self.BaseSign.this_arg, crate::c_types::Transaction::from_bitcoin(anchor_tx), input);
+               let mut local_ret = match ret.result_ok { true => Ok( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).into_rust() }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })};
+               local_ret
+       }
        fn sign_channel_announcement(&self, mut msg: &lightning::ln::msgs::UnsignedChannelAnnouncement, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1<bitcoin::secp256k1::All>) -> Result<(bitcoin::secp256k1::ecdsa::Signature, bitcoin::secp256k1::ecdsa::Signature), ()> {
                let mut ret = (self.BaseSign.sign_channel_announcement)(self.BaseSign.this_arg, &crate::lightning::ln::msgs::UnsignedChannelAnnouncement { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::UnsignedChannelAnnouncement<>) as *mut _) }, is_owned: false });
                let mut local_ret = match ret.result_ok { true => Ok( { let (mut orig_ret_0_0, mut orig_ret_0_1) = (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).to_rust(); let mut local_ret_0 = (orig_ret_0_0.into_rust(), orig_ret_0_1.into_rust()); local_ret_0 }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })};
@@ -1064,12 +1103,27 @@ pub struct KeysInterface {
        ///
        /// This method must return the same value each time it is called with a given `Recipient`
        /// parameter.
+       ///
+       /// Errors if the `Recipient` variant is not supported by the implementation.
        #[must_use]
        pub get_node_secret: extern "C" fn (this_arg: *const c_void, recipient: crate::lightning::chain::keysinterface::Recipient) -> crate::c_types::derived::CResult_SecretKeyNoneZ,
+       /// Get node id based on the provided [`Recipient`]. This public key corresponds to the secret in
+       /// [`get_node_secret`].
+       ///
+       /// This method must return the same value each time it is called with a given `Recipient`
+       /// parameter.
+       ///
+       /// Errors if the `Recipient` variant is not supported by the implementation.
+       ///
+       /// [`get_node_secret`]: KeysInterface::get_node_secret
+       #[must_use]
+       pub get_node_id: extern "C" fn (this_arg: *const c_void, recipient: crate::lightning::chain::keysinterface::Recipient) -> crate::c_types::derived::CResult_PublicKeyNoneZ,
        /// Gets the ECDH shared secret of our [`node secret`] and `other_key`, multiplying by `tweak` if
        /// one is provided. Note that this tweak can be applied to `other_key` instead of our node
        /// secret, though this is less efficient.
        ///
+       /// Errors if the `Recipient` variant is not supported by the implementation.
+       ///
        /// [`node secret`]: Self::get_node_secret
        #[must_use]
        pub ecdh: extern "C" fn (this_arg: *const c_void, recipient: crate::lightning::chain::keysinterface::Recipient, other_key: crate::c_types::PublicKey, tweak: crate::c_types::derived::COption_ScalarZ) -> crate::c_types::derived::CResult_SharedSecretNoneZ,
@@ -1113,6 +1167,8 @@ pub struct KeysInterface {
        /// The hrp is ascii bytes, while the invoice data is base32.
        ///
        /// The secret key used to sign the invoice is dependent on the [`Recipient`].
+       ///
+       /// Errors if the `Recipient` variant is not supported by the implementation.
        #[must_use]
        pub sign_invoice: extern "C" fn (this_arg: *const c_void, hrp_bytes: crate::c_types::u8slice, invoice_data: crate::c_types::derived::CVec_u5Z, receipient: crate::lightning::chain::keysinterface::Recipient) -> crate::c_types::derived::CResult_RecoverableSignatureNoneZ,
        /// Get secret key material as bytes for use in encrypting and decrypting inbound payment data.
@@ -1137,6 +1193,7 @@ pub(crate) extern "C" fn KeysInterface_clone_fields(orig: &KeysInterface) -> Key
        KeysInterface {
                this_arg: orig.this_arg,
                get_node_secret: Clone::clone(&orig.get_node_secret),
+               get_node_id: Clone::clone(&orig.get_node_id),
                ecdh: Clone::clone(&orig.ecdh),
                get_destination_script: Clone::clone(&orig.get_destination_script),
                get_shutdown_scriptpubkey: Clone::clone(&orig.get_shutdown_scriptpubkey),
@@ -1157,6 +1214,11 @@ impl rustKeysInterface for KeysInterface {
                let mut local_ret = match ret.result_ok { true => Ok( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).into_rust() }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })};
                local_ret
        }
+       fn get_node_id(&self, mut recipient: lightning::chain::keysinterface::Recipient) -> Result<bitcoin::secp256k1::PublicKey, ()> {
+               let mut ret = (self.get_node_id)(self.this_arg, crate::lightning::chain::keysinterface::Recipient::native_into(recipient));
+               let mut local_ret = match ret.result_ok { true => Ok( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).into_rust() }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })};
+               local_ret
+       }
        fn ecdh(&self, mut recipient: lightning::chain::keysinterface::Recipient, mut other_key: &bitcoin::secp256k1::PublicKey, mut tweak: Option<&bitcoin::secp256k1::Scalar>) -> Result<bitcoin::secp256k1::ecdh::SharedSecret, ()> {
                let mut local_tweak = if tweak.is_none() { crate::c_types::derived::COption_ScalarZ::None } else { crate::c_types::derived::COption_ScalarZ::Some(/* WARNING: CLONING CONVERSION HERE! &Option<Enum> is otherwise un-expressable. */ { crate::c_types::BigEndianScalar::from_rust(tweak.clone().unwrap()) }) };
                let mut ret = (self.ecdh)(self.this_arg, crate::lightning::chain::keysinterface::Recipient::native_into(recipient), crate::c_types::PublicKey::from_rust(&other_key), local_tweak);
@@ -1182,7 +1244,7 @@ impl rustKeysInterface for KeysInterface {
        fn read_chan_signer(&self, mut reader: &[u8]) -> Result<crate::lightning::chain::keysinterface::Sign, lightning::ln::msgs::DecodeError> {
                let mut local_reader = crate::c_types::u8slice::from_slice(reader);
                let mut ret = (self.read_chan_signer)(self.this_arg, local_reader);
-               let mut local_ret = match ret.result_ok { true => Ok( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }) }), false => Err( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).take_inner()) } })};
+               let mut local_ret = match ret.result_ok { true => Ok( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }) }), false => Err( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).into_native() })};
                local_ret
        }
        fn sign_invoice(&self, mut hrp_bytes: &[u8], mut invoice_data: &[bitcoin::bech32::u5], mut receipient: lightning::chain::keysinterface::Recipient) -> Result<bitcoin::secp256k1::ecdsa::RecoverableSignature, ()> {
@@ -1492,6 +1554,7 @@ pub extern "C" fn InMemorySigner_as_BaseSign(this_arg: &InMemorySigner) -> crate
                sign_justice_revoked_htlc: InMemorySigner_BaseSign_sign_justice_revoked_htlc,
                sign_counterparty_htlc_transaction: InMemorySigner_BaseSign_sign_counterparty_htlc_transaction,
                sign_closing_transaction: InMemorySigner_BaseSign_sign_closing_transaction,
+               sign_holder_anchor_input: InMemorySigner_BaseSign_sign_holder_anchor_input,
                sign_channel_announcement: InMemorySigner_BaseSign_sign_channel_announcement,
                ready_channel: InMemorySigner_BaseSign_ready_channel,
        }
@@ -1575,6 +1638,12 @@ extern "C" fn InMemorySigner_BaseSign_sign_closing_transaction(this_arg: *const
        local_ret
 }
 #[must_use]
+extern "C" fn InMemorySigner_BaseSign_sign_holder_anchor_input(this_arg: *const c_void, mut anchor_tx: crate::c_types::Transaction, mut input: usize) -> crate::c_types::derived::CResult_SignatureNoneZ {
+       let mut ret = <nativeInMemorySigner as lightning::chain::keysinterface::BaseSign<>>::sign_holder_anchor_input(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, &anchor_tx.into_bitcoin(), input, secp256k1::global::SECP256K1);
+       let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::Signature::from_rust(&o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() };
+       local_ret
+}
+#[must_use]
 extern "C" fn InMemorySigner_BaseSign_sign_channel_announcement(this_arg: *const c_void, msg: &crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> crate::c_types::derived::CResult_C2Tuple_SignatureSignatureZNoneZ {
        let mut ret = <nativeInMemorySigner as lightning::chain::keysinterface::BaseSign<>>::sign_channel_announcement(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, msg.get_native_ref(), secp256k1::global::SECP256K1);
        let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { let (mut orig_ret_0_0, mut orig_ret_0_1) = o; let mut local_ret_0 = (crate::c_types::Signature::from_rust(&orig_ret_0_0), crate::c_types::Signature::from_rust(&orig_ret_0_1)).into(); local_ret_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() };
@@ -1618,6 +1687,7 @@ pub extern "C" fn InMemorySigner_as_Sign(this_arg: &InMemorySigner) -> crate::li
                        sign_justice_revoked_htlc: InMemorySigner_BaseSign_sign_justice_revoked_htlc,
                        sign_counterparty_htlc_transaction: InMemorySigner_BaseSign_sign_counterparty_htlc_transaction,
                        sign_closing_transaction: InMemorySigner_BaseSign_sign_closing_transaction,
+                       sign_holder_anchor_input: InMemorySigner_BaseSign_sign_holder_anchor_input,
                        sign_channel_announcement: InMemorySigner_BaseSign_sign_channel_announcement,
                        ready_channel: InMemorySigner_BaseSign_ready_channel,
                },
@@ -1647,7 +1717,7 @@ pub(crate) extern "C" fn InMemorySigner_write_void(obj: *const c_void) -> crate:
 pub extern "C" fn InMemorySigner_read(ser: crate::c_types::u8slice, arg: crate::c_types::SecretKey) -> crate::c_types::derived::CResult_InMemorySignerDecodeErrorZ {
        let arg_conv = arg.into_rust();
        let res: Result<lightning::chain::keysinterface::InMemorySigner, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj_arg(ser, arg_conv);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::chain::keysinterface::InMemorySigner { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::chain::keysinterface::InMemorySigner { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 
@@ -1791,6 +1861,7 @@ pub extern "C" fn KeysManager_as_KeysInterface(this_arg: &KeysManager) -> crate:
                this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void },
                free: None,
                get_node_secret: KeysManager_KeysInterface_get_node_secret,
+               get_node_id: KeysManager_KeysInterface_get_node_id,
                ecdh: KeysManager_KeysInterface_ecdh,
                get_destination_script: KeysManager_KeysInterface_get_destination_script,
                get_shutdown_scriptpubkey: KeysManager_KeysInterface_get_shutdown_scriptpubkey,
@@ -1809,6 +1880,12 @@ extern "C" fn KeysManager_KeysInterface_get_node_secret(this_arg: *const c_void,
        local_ret
 }
 #[must_use]
+extern "C" fn KeysManager_KeysInterface_get_node_id(this_arg: *const c_void, mut recipient: crate::lightning::chain::keysinterface::Recipient) -> crate::c_types::derived::CResult_PublicKeyNoneZ {
+       let mut ret = <nativeKeysManager as lightning::chain::keysinterface::KeysInterface<>>::get_node_id(unsafe { &mut *(this_arg as *mut nativeKeysManager) }, recipient.into_native());
+       let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::PublicKey::from_rust(&o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() };
+       local_ret
+}
+#[must_use]
 extern "C" fn KeysManager_KeysInterface_ecdh(this_arg: *const c_void, mut recipient: crate::lightning::chain::keysinterface::Recipient, mut other_key: crate::c_types::PublicKey, mut tweak: crate::c_types::derived::COption_ScalarZ) -> crate::c_types::derived::CResult_SharedSecretNoneZ {
        let mut local_tweak_base = { /* tweak*/ let tweak_opt = tweak; { } if tweak_opt.is_none() { None } else { Some({ tweak_opt.take().into_rust() }) } }; let mut local_tweak = local_tweak_base.as_ref();
        let mut ret = <nativeKeysManager as lightning::chain::keysinterface::KeysInterface<>>::ecdh(unsafe { &mut *(this_arg as *mut nativeKeysManager) }, recipient.into_native(), &other_key.into_rust(), local_tweak);
@@ -1838,7 +1915,7 @@ extern "C" fn KeysManager_KeysInterface_get_secure_random_bytes(this_arg: *const
 #[must_use]
 extern "C" fn KeysManager_KeysInterface_read_chan_signer(this_arg: *const c_void, mut reader: crate::c_types::u8slice) -> crate::c_types::derived::CResult_SignDecodeErrorZ {
        let mut ret = <nativeKeysManager as lightning::chain::keysinterface::KeysInterface<>>::read_chan_signer(unsafe { &mut *(this_arg as *mut nativeKeysManager) }, reader.to_slice());
-       let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { Into::into(o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { Into::into(o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_ret
 }
 #[must_use]
@@ -1937,6 +2014,7 @@ pub extern "C" fn PhantomKeysManager_as_KeysInterface(this_arg: &PhantomKeysMana
                this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void },
                free: None,
                get_node_secret: PhantomKeysManager_KeysInterface_get_node_secret,
+               get_node_id: PhantomKeysManager_KeysInterface_get_node_id,
                ecdh: PhantomKeysManager_KeysInterface_ecdh,
                get_destination_script: PhantomKeysManager_KeysInterface_get_destination_script,
                get_shutdown_scriptpubkey: PhantomKeysManager_KeysInterface_get_shutdown_scriptpubkey,
@@ -1955,6 +2033,12 @@ extern "C" fn PhantomKeysManager_KeysInterface_get_node_secret(this_arg: *const
        local_ret
 }
 #[must_use]
+extern "C" fn PhantomKeysManager_KeysInterface_get_node_id(this_arg: *const c_void, mut recipient: crate::lightning::chain::keysinterface::Recipient) -> crate::c_types::derived::CResult_PublicKeyNoneZ {
+       let mut ret = <nativePhantomKeysManager as lightning::chain::keysinterface::KeysInterface<>>::get_node_id(unsafe { &mut *(this_arg as *mut nativePhantomKeysManager) }, recipient.into_native());
+       let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::PublicKey::from_rust(&o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() };
+       local_ret
+}
+#[must_use]
 extern "C" fn PhantomKeysManager_KeysInterface_ecdh(this_arg: *const c_void, mut recipient: crate::lightning::chain::keysinterface::Recipient, mut other_key: crate::c_types::PublicKey, mut tweak: crate::c_types::derived::COption_ScalarZ) -> crate::c_types::derived::CResult_SharedSecretNoneZ {
        let mut local_tweak_base = { /* tweak*/ let tweak_opt = tweak; { } if tweak_opt.is_none() { None } else { Some({ tweak_opt.take().into_rust() }) } }; let mut local_tweak = local_tweak_base.as_ref();
        let mut ret = <nativePhantomKeysManager as lightning::chain::keysinterface::KeysInterface<>>::ecdh(unsafe { &mut *(this_arg as *mut nativePhantomKeysManager) }, recipient.into_native(), &other_key.into_rust(), local_tweak);
@@ -1984,7 +2068,7 @@ extern "C" fn PhantomKeysManager_KeysInterface_get_secure_random_bytes(this_arg:
 #[must_use]
 extern "C" fn PhantomKeysManager_KeysInterface_read_chan_signer(this_arg: *const c_void, mut reader: crate::c_types::u8slice) -> crate::c_types::derived::CResult_SignDecodeErrorZ {
        let mut ret = <nativePhantomKeysManager as lightning::chain::keysinterface::KeysInterface<>>::read_chan_signer(unsafe { &mut *(this_arg as *mut nativePhantomKeysManager) }, reader.to_slice());
-       let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { Into::into(o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { Into::into(o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_ret
 }
 #[must_use]
index 5ab4d47cdeaabd1344e3ff2e692da94efce0805a..fb9794fab8883aa76559703817abacb325f5c227 100644 (file)
@@ -113,6 +113,15 @@ pub(crate) extern "C" fn BestBlock_clone_void(this_ptr: *const c_void) -> *mut c
 pub extern "C" fn BestBlock_clone(orig: &BestBlock) -> BestBlock {
        orig.clone()
 }
+/// Checks if two BestBlocks contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn BestBlock_eq(a: &BestBlock, b: &BestBlock) -> bool {
+       if a.inner == b.inner { return true; }
+       if a.inner.is_null() || b.inner.is_null() { return false; }
+       if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
 /// Constructs a `BestBlock` that represents the genesis block at height 0 of the given
 /// network.
 #[must_use]
@@ -470,118 +479,145 @@ impl Drop for Confirm {
                }
        }
 }
-/// An error enum representing a failure to persist a channel monitor update.
+/// An enum representing the status of a channel monitor update persistence.
 #[derive(Clone)]
 #[must_use]
 #[repr(C)]
-pub enum ChannelMonitorUpdateErr {
+pub enum ChannelMonitorUpdateStatus {
+       /// The update has been durably persisted and all copies of the relevant [`ChannelMonitor`]
+       /// have been updated.
+       ///
+       /// This includes performing any `fsync()` calls required to ensure the update is guaranteed to
+       /// be available on restart even if the application crashes.
+       Completed,
        /// Used to indicate a temporary failure (eg connection to a watchtower or remote backup of
        /// our state failed, but is expected to succeed at some point in the future).
        ///
        /// Such a failure will \"freeze\" a channel, preventing us from revoking old states or
-       /// submitting new commitment transactions to the counterparty. Once the update(s) that failed
-       /// have been successfully applied, a [`MonitorEvent::UpdateCompleted`] event should be returned
-       /// via [`Watch::release_pending_monitor_events`] which will then restore the channel to an
-       /// operational state.
-       ///
-       /// Note that a given ChannelManager will *never* re-generate a given ChannelMonitorUpdate. If
-       /// you return a TemporaryFailure you must ensure that it is written to disk safely before
-       /// writing out the latest ChannelManager state.
-       ///
-       /// Even when a channel has been \"frozen\" updates to the ChannelMonitor can continue to occur
-       /// (eg if an inbound HTLC which we forwarded was claimed upstream resulting in us attempting
-       /// to claim it on this channel) and those updates must be applied wherever they can be. At
-       /// least one such updated ChannelMonitor must be persisted otherwise PermanentFailure should
-       /// be returned to get things on-chain ASAP using only the in-memory copy. Obviously updates to
-       /// the channel which would invalidate previous ChannelMonitors are not made when a channel has
-       /// been \"frozen\".
-       ///
-       /// Note that even if updates made after TemporaryFailure succeed you must still provide a
-       /// [`MonitorEvent::UpdateCompleted`] to ensure you have the latest monitor and re-enable
-       /// normal channel operation. Note that this is normally generated through a call to
-       /// [`ChainMonitor::channel_monitor_updated`].
-       ///
-       /// Note that the update being processed here will not be replayed for you when you return a
-       /// [`MonitorEvent::UpdateCompleted`] event via [`Watch::release_pending_monitor_events`], so
-       /// you must store the update itself on your own local disk prior to returning a
-       /// TemporaryFailure. You may, of course, employ a journaling approach, storing only the
-       /// ChannelMonitorUpdate on disk without updating the monitor itself, replaying the journal at
-       /// reload-time.
+       /// submitting new commitment transactions to the counterparty. Once the update(s) which failed
+       /// have been successfully applied, a [`MonitorEvent::Completed`] can be used to restore the
+       /// channel to an operational state.
+       ///
+       /// Note that a given [`ChannelManager`] will *never* re-generate a [`ChannelMonitorUpdate`].
+       /// If you return this error you must ensure that it is written to disk safely before writing
+       /// the latest [`ChannelManager`] state, or you should return [`PermanentFailure`] instead.
+       ///
+       /// Even when a channel has been \"frozen\", updates to the [`ChannelMonitor`] can continue to
+       /// occur (e.g. if an inbound HTLC which we forwarded was claimed upstream, resulting in us
+       /// attempting to claim it on this channel) and those updates must still be persisted.
+       ///
+       /// No updates to the channel will be made which could invalidate other [`ChannelMonitor`]s
+       /// until a [`MonitorEvent::Completed`] is provided, even if you return no error on a later
+       /// monitor update for the same channel.
        ///
        /// For deployments where a copy of ChannelMonitors and other local state are backed up in a
        /// remote location (with local copies persisted immediately), it is anticipated that all
-       /// updates will return TemporaryFailure until the remote copies could be updated.
+       /// updates will return [`InProgress`] until the remote copies could be updated.
+       ///
+       /// [`PermanentFailure`]: ChannelMonitorUpdateStatus::PermanentFailure
+       /// [`InProgress`]: ChannelMonitorUpdateStatus::InProgress
+       /// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
+       InProgress,
+       /// Used to indicate no further channel monitor updates will be allowed (likely a disk failure
+       /// or a remote copy of this [`ChannelMonitor`] is no longer reachable and thus not updatable).
        ///
-       /// [`ChainMonitor::channel_monitor_updated`]: chainmonitor::ChainMonitor::channel_monitor_updated
-       TemporaryFailure,
-       /// Used to indicate no further channel monitor updates will be allowed (eg we've moved on to a
-       /// different watchtower and cannot update with all watchtowers that were previously informed
-       /// of this channel).
+       /// When this is returned, [`ChannelManager`] will force-close the channel but *not* broadcast
+       /// our current commitment transaction. This avoids a dangerous case where a local disk failure
+       /// (e.g. the Linux-default remounting of the disk as read-only) causes [`PermanentFailure`]s
+       /// for all monitor updates. If we were to broadcast our latest commitment transaction and then
+       /// restart, we could end up reading a previous [`ChannelMonitor`] and [`ChannelManager`],
+       /// revoking our now-broadcasted state before seeing it confirm and losing all our funds.
        ///
-       /// 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.
+       /// Note that this is somewhat of a tradeoff - if the disk is really gone and we may have lost
+       /// the data permanently, we really should broadcast immediately. If the data can be recovered
+       /// with manual intervention, we'd rather close the channel, rejecting future updates to it,
+       /// and broadcast the latest state only if we have HTLCs to claim which are timing out (which
+       /// we do as long as blocks are connected).
        ///
-       /// This failure may also signal a failure to update the local persisted copy of one of
-       /// the channel monitor instance.
+       /// In order to broadcast the latest local commitment transaction, you'll need to call
+       /// [`ChannelMonitor::get_latest_holder_commitment_txn`] and broadcast the resulting
+       /// transactions once you've safely ensured no further channel updates can be generated by your
+       /// [`ChannelManager`].
        ///
-       /// 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)
+       /// Note that at least one final [`ChannelMonitorUpdate`] may still be provided, which must
+       /// still be processed by a running [`ChannelMonitor`]. This final update will mark the
+       /// [`ChannelMonitor`] as finalized, ensuring no further updates (e.g. revocation of the latest
+       /// commitment transaction) are allowed.
+       ///
+       /// Note that even if you return a [`PermanentFailure`] due to unavailability of secondary
+       /// [`ChannelMonitor`] copies, you should still make an attempt to store the update where
+       /// possible to ensure you can claim HTLC outputs on the latest commitment transaction
+       /// broadcasted later.
        ///
        /// In case of distributed watchtowers deployment, the new version must be written to disk, as
        /// state may have been stored but rejected due to a block forcing a commitment broadcast. This
        /// storage is used to claim outputs of rejected state confirmed onchain by another watchtower,
        /// lagging behind on block processing.
+       ///
+       /// [`PermanentFailure`]: ChannelMonitorUpdateStatus::PermanentFailure
+       /// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
        PermanentFailure,
 }
-use lightning::chain::ChannelMonitorUpdateErr as ChannelMonitorUpdateErrImport;
-pub(crate) type nativeChannelMonitorUpdateErr = ChannelMonitorUpdateErrImport;
+use lightning::chain::ChannelMonitorUpdateStatus as ChannelMonitorUpdateStatusImport;
+pub(crate) type nativeChannelMonitorUpdateStatus = ChannelMonitorUpdateStatusImport;
 
-impl ChannelMonitorUpdateErr {
+impl ChannelMonitorUpdateStatus {
        #[allow(unused)]
-       pub(crate) fn to_native(&self) -> nativeChannelMonitorUpdateErr {
+       pub(crate) fn to_native(&self) -> nativeChannelMonitorUpdateStatus {
                match self {
-                       ChannelMonitorUpdateErr::TemporaryFailure => nativeChannelMonitorUpdateErr::TemporaryFailure,
-                       ChannelMonitorUpdateErr::PermanentFailure => nativeChannelMonitorUpdateErr::PermanentFailure,
+                       ChannelMonitorUpdateStatus::Completed => nativeChannelMonitorUpdateStatus::Completed,
+                       ChannelMonitorUpdateStatus::InProgress => nativeChannelMonitorUpdateStatus::InProgress,
+                       ChannelMonitorUpdateStatus::PermanentFailure => nativeChannelMonitorUpdateStatus::PermanentFailure,
                }
        }
        #[allow(unused)]
-       pub(crate) fn into_native(self) -> nativeChannelMonitorUpdateErr {
+       pub(crate) fn into_native(self) -> nativeChannelMonitorUpdateStatus {
                match self {
-                       ChannelMonitorUpdateErr::TemporaryFailure => nativeChannelMonitorUpdateErr::TemporaryFailure,
-                       ChannelMonitorUpdateErr::PermanentFailure => nativeChannelMonitorUpdateErr::PermanentFailure,
+                       ChannelMonitorUpdateStatus::Completed => nativeChannelMonitorUpdateStatus::Completed,
+                       ChannelMonitorUpdateStatus::InProgress => nativeChannelMonitorUpdateStatus::InProgress,
+                       ChannelMonitorUpdateStatus::PermanentFailure => nativeChannelMonitorUpdateStatus::PermanentFailure,
                }
        }
        #[allow(unused)]
-       pub(crate) fn from_native(native: &nativeChannelMonitorUpdateErr) -> Self {
+       pub(crate) fn from_native(native: &nativeChannelMonitorUpdateStatus) -> Self {
                match native {
-                       nativeChannelMonitorUpdateErr::TemporaryFailure => ChannelMonitorUpdateErr::TemporaryFailure,
-                       nativeChannelMonitorUpdateErr::PermanentFailure => ChannelMonitorUpdateErr::PermanentFailure,
+                       nativeChannelMonitorUpdateStatus::Completed => ChannelMonitorUpdateStatus::Completed,
+                       nativeChannelMonitorUpdateStatus::InProgress => ChannelMonitorUpdateStatus::InProgress,
+                       nativeChannelMonitorUpdateStatus::PermanentFailure => ChannelMonitorUpdateStatus::PermanentFailure,
                }
        }
        #[allow(unused)]
-       pub(crate) fn native_into(native: nativeChannelMonitorUpdateErr) -> Self {
+       pub(crate) fn native_into(native: nativeChannelMonitorUpdateStatus) -> Self {
                match native {
-                       nativeChannelMonitorUpdateErr::TemporaryFailure => ChannelMonitorUpdateErr::TemporaryFailure,
-                       nativeChannelMonitorUpdateErr::PermanentFailure => ChannelMonitorUpdateErr::PermanentFailure,
+                       nativeChannelMonitorUpdateStatus::Completed => ChannelMonitorUpdateStatus::Completed,
+                       nativeChannelMonitorUpdateStatus::InProgress => ChannelMonitorUpdateStatus::InProgress,
+                       nativeChannelMonitorUpdateStatus::PermanentFailure => ChannelMonitorUpdateStatus::PermanentFailure,
                }
        }
 }
-/// Creates a copy of the ChannelMonitorUpdateErr
+/// Creates a copy of the ChannelMonitorUpdateStatus
 #[no_mangle]
-pub extern "C" fn ChannelMonitorUpdateErr_clone(orig: &ChannelMonitorUpdateErr) -> ChannelMonitorUpdateErr {
+pub extern "C" fn ChannelMonitorUpdateStatus_clone(orig: &ChannelMonitorUpdateStatus) -> ChannelMonitorUpdateStatus {
        orig.clone()
 }
 #[no_mangle]
-/// Utility method to constructs a new TemporaryFailure-variant ChannelMonitorUpdateErr
-pub extern "C" fn ChannelMonitorUpdateErr_temporary_failure() -> ChannelMonitorUpdateErr {
-       ChannelMonitorUpdateErr::TemporaryFailure}
+/// Utility method to constructs a new Completed-variant ChannelMonitorUpdateStatus
+pub extern "C" fn ChannelMonitorUpdateStatus_completed() -> ChannelMonitorUpdateStatus {
+       ChannelMonitorUpdateStatus::Completed}
 #[no_mangle]
-/// Utility method to constructs a new PermanentFailure-variant ChannelMonitorUpdateErr
-pub extern "C" fn ChannelMonitorUpdateErr_permanent_failure() -> ChannelMonitorUpdateErr {
-       ChannelMonitorUpdateErr::PermanentFailure}
+/// Utility method to constructs a new InProgress-variant ChannelMonitorUpdateStatus
+pub extern "C" fn ChannelMonitorUpdateStatus_in_progress() -> ChannelMonitorUpdateStatus {
+       ChannelMonitorUpdateStatus::InProgress}
+#[no_mangle]
+/// Utility method to constructs a new PermanentFailure-variant ChannelMonitorUpdateStatus
+pub extern "C" fn ChannelMonitorUpdateStatus_permanent_failure() -> ChannelMonitorUpdateStatus {
+       ChannelMonitorUpdateStatus::PermanentFailure}
+/// Checks if two ChannelMonitorUpdateStatuss contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+#[no_mangle]
+pub extern "C" fn ChannelMonitorUpdateStatus_eq(a: &ChannelMonitorUpdateStatus, b: &ChannelMonitorUpdateStatus) -> bool {
+       if &a.to_native() == &b.to_native() { true } else { false }
+}
 /// The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as
 /// blocks are connected and disconnected.
 ///
@@ -597,10 +633,10 @@ pub extern "C" fn ChannelMonitorUpdateErr_permanent_failure() -> ChannelMonitorU
 /// 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
+/// funds in the channel. See [`ChannelMonitorUpdateStatus`] for more details about how to handle
 /// multiple instances.
 ///
-/// [`PermanentFailure`]: ChannelMonitorUpdateErr::PermanentFailure
+/// [`PermanentFailure`]: ChannelMonitorUpdateStatus::PermanentFailure
 #[repr(C)]
 pub struct Watch {
        /// An opaque pointer which is passed to your function implementations as an argument.
@@ -612,22 +648,22 @@ pub struct Watch {
        /// with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means
        /// calling [`block_connected`] and [`block_disconnected`] on the monitor.
        ///
-       /// Note: this interface MUST error with `ChannelMonitorUpdateErr::PermanentFailure` if
+       /// Note: this interface MUST error with [`ChannelMonitorUpdateStatus::PermanentFailure`] if
        /// the given `funding_txo` has previously been registered via `watch_channel`.
        ///
        /// [`get_outputs_to_watch`]: channelmonitor::ChannelMonitor::get_outputs_to_watch
        /// [`block_connected`]: channelmonitor::ChannelMonitor::block_connected
        /// [`block_disconnected`]: channelmonitor::ChannelMonitor::block_disconnected
        #[must_use]
-       pub watch_channel: extern "C" fn (this_arg: *const c_void, funding_txo: crate::lightning::chain::transaction::OutPoint, monitor: crate::lightning::chain::channelmonitor::ChannelMonitor) -> crate::c_types::derived::CResult_NoneChannelMonitorUpdateErrZ,
+       pub watch_channel: extern "C" fn (this_arg: *const c_void, funding_txo: crate::lightning::chain::transaction::OutPoint, monitor: crate::lightning::chain::channelmonitor::ChannelMonitor) -> crate::lightning::chain::ChannelMonitorUpdateStatus,
        /// 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.
+       /// [`ChannelMonitorUpdateStatus`] for invariants around returning an error.
        ///
        /// [`update_monitor`]: channelmonitor::ChannelMonitor::update_monitor
        #[must_use]
-       pub update_channel: extern "C" fn (this_arg: *const c_void, funding_txo: crate::lightning::chain::transaction::OutPoint, update: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> crate::c_types::derived::CResult_NoneChannelMonitorUpdateErrZ,
+       pub update_channel: extern "C" fn (this_arg: *const c_void, funding_txo: crate::lightning::chain::transaction::OutPoint, update: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> crate::lightning::chain::ChannelMonitorUpdateStatus,
        /// Returns any monitor events since the last call. Subsequent calls must only return new
        /// events.
        ///
@@ -636,7 +672,7 @@ pub struct Watch {
        /// to disk.
        ///
        /// For details on asynchronous [`ChannelMonitor`] updating and returning
-       /// [`MonitorEvent::UpdateCompleted`] here, see [`ChannelMonitorUpdateErr::TemporaryFailure`].
+       /// [`MonitorEvent::Completed`] here, see [`ChannelMonitorUpdateStatus::InProgress`].
        #[must_use]
        pub release_pending_monitor_events: extern "C" fn (this_arg: *const c_void) -> crate::c_types::derived::CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ,
        /// Frees any resources associated with this object given its this_arg pointer.
@@ -658,15 +694,13 @@ pub(crate) extern "C" fn Watch_clone_fields(orig: &Watch) -> Watch {
 
 use lightning::chain::Watch as rustWatch;
 impl rustWatch<crate::lightning::chain::keysinterface::Sign> for Watch {
-       fn watch_channel(&self, mut funding_txo: lightning::chain::transaction::OutPoint, mut monitor: lightning::chain::channelmonitor::ChannelMonitor<crate::lightning::chain::keysinterface::Sign>) -> Result<(), lightning::chain::ChannelMonitorUpdateErr> {
+       fn watch_channel(&self, mut funding_txo: lightning::chain::transaction::OutPoint, mut monitor: lightning::chain::channelmonitor::ChannelMonitor<crate::lightning::chain::keysinterface::Sign>) -> lightning::chain::ChannelMonitorUpdateStatus {
                let mut ret = (self.watch_channel)(self.this_arg, crate::lightning::chain::transaction::OutPoint { inner: ObjOps::heap_alloc(funding_txo), is_owned: true }, crate::lightning::chain::channelmonitor::ChannelMonitor { inner: ObjOps::heap_alloc(monitor), is_owned: true });
-               let mut local_ret = match ret.result_ok { true => Ok( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) })*/ }), false => Err( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).into_native() })};
-               local_ret
+               ret.into_native()
        }
-       fn update_channel(&self, mut funding_txo: lightning::chain::transaction::OutPoint, mut update: lightning::chain::channelmonitor::ChannelMonitorUpdate) -> Result<(), lightning::chain::ChannelMonitorUpdateErr> {
+       fn update_channel(&self, mut funding_txo: lightning::chain::transaction::OutPoint, mut update: lightning::chain::channelmonitor::ChannelMonitorUpdate) -> lightning::chain::ChannelMonitorUpdateStatus {
                let mut ret = (self.update_channel)(self.this_arg, crate::lightning::chain::transaction::OutPoint { inner: ObjOps::heap_alloc(funding_txo), is_owned: true }, crate::lightning::chain::channelmonitor::ChannelMonitorUpdate { inner: ObjOps::heap_alloc(update), is_owned: true });
-               let mut local_ret = match ret.result_ok { true => Ok( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) })*/ }), false => Err( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).into_native() })};
-               local_ret
+               ret.into_native()
        }
        fn release_pending_monitor_events(&self) -> Vec<(lightning::chain::transaction::OutPoint, Vec<lightning::chain::channelmonitor::MonitorEvent>, Option<bitcoin::secp256k1::PublicKey>)> {
                let mut ret = (self.release_pending_monitor_events)(self.this_arg);
@@ -708,9 +742,9 @@ impl Drop for Watch {
 /// 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`].
+/// invocation that has called the `Filter` must return [`InProgress`].
 ///
-/// [`TemporaryFailure`]: ChannelMonitorUpdateErr::TemporaryFailure
+/// [`InProgress`]: ChannelMonitorUpdateStatus::InProgress
 /// [BIP 157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki
 /// [BIP 158]: https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki
 #[repr(C)]
@@ -903,6 +937,15 @@ pub extern "C" fn WatchedOutput_clone(orig: &WatchedOutput) -> WatchedOutput {
        orig.clone()
 }
 /// Checks if two WatchedOutputs contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn WatchedOutput_eq(a: &WatchedOutput, b: &WatchedOutput) -> bool {
+       if a.inner == b.inner { return true; }
+       if a.inner.is_null() || b.inner.is_null() { return false; }
+       if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
+/// Checks if two WatchedOutputs contain equal inner contents.
 #[no_mangle]
 pub extern "C" fn WatchedOutput_hash(o: &WatchedOutput) -> u64 {
        if o.inner.is_null() { return 0; }
index 7430c5a0f3fc73f82d625a3cf4f56aedb3631b6e..f425bcb68f19bc1930a1202555cd19c9140c96bb 100644 (file)
@@ -160,6 +160,6 @@ pub(crate) extern "C" fn OutPoint_write_void(obj: *const c_void) -> crate::c_typ
 /// Read a OutPoint from a byte array, created by OutPoint_write
 pub extern "C" fn OutPoint_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_OutPointDecodeErrorZ {
        let res: Result<lightning::chain::transaction::OutPoint, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::chain::transaction::OutPoint { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::chain::transaction::OutPoint { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
index bf9caa673a0b1f2887815376ee76653db6ace839..08abca5907f033d09dd6022ee917225c0fd4f1ff 100644 (file)
@@ -171,7 +171,7 @@ pub(crate) extern "C" fn CounterpartyCommitmentSecrets_write_void(obj: *const c_
 /// Read a CounterpartyCommitmentSecrets from a byte array, created by CounterpartyCommitmentSecrets_write
 pub extern "C" fn CounterpartyCommitmentSecrets_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
        let res: Result<lightning::ln::chan_utils::CounterpartyCommitmentSecrets, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 /// Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key)
@@ -201,7 +201,7 @@ pub extern "C" fn derive_public_key(mut per_commitment_point: crate::c_types::Pu
 
 /// Derives a per-commitment-transaction revocation key from its constituent parts.
 ///
-/// Only the cheating participant owns a valid witness to propagate a revoked 
+/// 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.
@@ -219,7 +219,7 @@ pub extern "C" fn derive_private_revocation_key(per_commitment_secret: *const [u
 /// 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 
+/// 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.
@@ -365,6 +365,15 @@ pub extern "C" fn TxCreationKeys_new(mut per_commitment_point_arg: crate::c_type
                broadcaster_delayed_payment_key: broadcaster_delayed_payment_key_arg.into_rust(),
        }), is_owned: true }
 }
+/// Checks if two TxCreationKeyss contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn TxCreationKeys_eq(a: &TxCreationKeys, b: &TxCreationKeys) -> bool {
+       if a.inner == b.inner { return true; }
+       if a.inner.is_null() || b.inner.is_null() { return false; }
+       if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
 impl Clone for TxCreationKeys {
        fn clone(&self) -> Self {
                Self {
@@ -397,7 +406,7 @@ pub(crate) extern "C" fn TxCreationKeys_write_void(obj: *const c_void) -> crate:
 /// Read a TxCreationKeys from a byte array, created by TxCreationKeys_write
 pub extern "C" fn TxCreationKeys_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_TxCreationKeysDecodeErrorZ {
        let res: Result<lightning::ln::chan_utils::TxCreationKeys, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::chan_utils::TxCreationKeys { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::chan_utils::TxCreationKeys { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 
@@ -555,6 +564,15 @@ pub(crate) extern "C" fn ChannelPublicKeys_clone_void(this_ptr: *const c_void) -
 pub extern "C" fn ChannelPublicKeys_clone(orig: &ChannelPublicKeys) -> ChannelPublicKeys {
        orig.clone()
 }
+/// Checks if two ChannelPublicKeyss contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn ChannelPublicKeys_eq(a: &ChannelPublicKeys, b: &ChannelPublicKeys) -> bool {
+       if a.inner == b.inner { return true; }
+       if a.inner.is_null() || b.inner.is_null() { return false; }
+       if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
 #[no_mangle]
 /// Serialize the ChannelPublicKeys object into a byte array which can be read by ChannelPublicKeys_read
 pub extern "C" fn ChannelPublicKeys_write(obj: &crate::lightning::ln::chan_utils::ChannelPublicKeys) -> crate::c_types::derived::CVec_u8Z {
@@ -568,7 +586,7 @@ pub(crate) extern "C" fn ChannelPublicKeys_write_void(obj: *const c_void) -> cra
 /// Read a ChannelPublicKeys from a byte array, created by ChannelPublicKeys_write
 pub extern "C" fn ChannelPublicKeys_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelPublicKeysDecodeErrorZ {
        let res: Result<lightning::ln::chan_utils::ChannelPublicKeys, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::chan_utils::ChannelPublicKeys { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::chan_utils::ChannelPublicKeys { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 /// Create per-state keys from channel base points and the per-commitment point.
@@ -756,6 +774,15 @@ pub(crate) extern "C" fn HTLCOutputInCommitment_clone_void(this_ptr: *const c_vo
 pub extern "C" fn HTLCOutputInCommitment_clone(orig: &HTLCOutputInCommitment) -> HTLCOutputInCommitment {
        orig.clone()
 }
+/// Checks if two HTLCOutputInCommitments contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn HTLCOutputInCommitment_eq(a: &HTLCOutputInCommitment, b: &HTLCOutputInCommitment) -> bool {
+       if a.inner == b.inner { return true; }
+       if a.inner.is_null() || b.inner.is_null() { return false; }
+       if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
 #[no_mangle]
 /// Serialize the HTLCOutputInCommitment object into a byte array which can be read by HTLCOutputInCommitment_read
 pub extern "C" fn HTLCOutputInCommitment_write(obj: &crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> crate::c_types::derived::CVec_u8Z {
@@ -769,7 +796,7 @@ pub(crate) extern "C" fn HTLCOutputInCommitment_write_void(obj: *const c_void) -
 /// Read a HTLCOutputInCommitment from a byte array, created by HTLCOutputInCommitment_write
 pub extern "C" fn HTLCOutputInCommitment_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_HTLCOutputInCommitmentDecodeErrorZ {
        let res: Result<lightning::ln::chan_utils::HTLCOutputInCommitment, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::chan_utils::HTLCOutputInCommitment { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::chan_utils::HTLCOutputInCommitment { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 /// Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc
@@ -939,14 +966,16 @@ pub extern "C" fn ChannelTransactionParameters_set_funding_outpoint(this_ptr: &m
        let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_inner()) } }) };
        unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.funding_outpoint = local_val;
 }
-/// Are anchors used for this channel.  Boolean is serialization backwards-compatible
+/// Are anchors (zero fee HTLC transaction variant) used for this channel. Boolean is
+/// serialization backwards-compatible.
 #[no_mangle]
 pub extern "C" fn ChannelTransactionParameters_get_opt_anchors(this_ptr: &ChannelTransactionParameters) -> crate::c_types::derived::COption_NoneZ {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().opt_anchors;
        let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_NoneZ::None } else { crate::c_types::derived::COption_NoneZ::Some /*  { () /**/ } */ };
        local_inner_val
 }
-/// Are anchors used for this channel.  Boolean is serialization backwards-compatible
+/// Are anchors (zero fee HTLC transaction variant) used for this channel. Boolean is
+/// serialization backwards-compatible.
 #[no_mangle]
 pub extern "C" fn ChannelTransactionParameters_set_opt_anchors(this_ptr: &mut ChannelTransactionParameters, mut val: crate::c_types::derived::COption_NoneZ) {
        let mut local_val = if val.is_some() { Some( { () /*val.take()*/ }) } else { None };
@@ -1131,7 +1160,7 @@ pub(crate) extern "C" fn CounterpartyChannelTransactionParameters_write_void(obj
 /// Read a CounterpartyChannelTransactionParameters from a byte array, created by CounterpartyChannelTransactionParameters_write
 pub extern "C" fn CounterpartyChannelTransactionParameters_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
        let res: Result<lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 #[no_mangle]
@@ -1147,7 +1176,7 @@ pub(crate) extern "C" fn ChannelTransactionParameters_write_void(obj: *const c_v
 /// Read a ChannelTransactionParameters from a byte array, created by ChannelTransactionParameters_write
 pub extern "C" fn ChannelTransactionParameters_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelTransactionParametersDecodeErrorZ {
        let res: Result<lightning::ln::chan_utils::ChannelTransactionParameters, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::chan_utils::ChannelTransactionParameters { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::chan_utils::ChannelTransactionParameters { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 
@@ -1368,7 +1397,7 @@ pub(crate) extern "C" fn HolderCommitmentTransaction_write_void(obj: *const c_vo
 /// Read a HolderCommitmentTransaction from a byte array, created by HolderCommitmentTransaction_write
 pub extern "C" fn HolderCommitmentTransaction_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_HolderCommitmentTransactionDecodeErrorZ {
        let res: Result<lightning::ln::chan_utils::HolderCommitmentTransaction, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::chan_utils::HolderCommitmentTransaction { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::chan_utils::HolderCommitmentTransaction { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 /// Create a new holder transaction with the given counterparty signatures.
@@ -1501,7 +1530,7 @@ pub(crate) extern "C" fn BuiltCommitmentTransaction_write_void(obj: *const c_voi
 /// Read a BuiltCommitmentTransaction from a byte array, created by BuiltCommitmentTransaction_write
 pub extern "C" fn BuiltCommitmentTransaction_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_BuiltCommitmentTransactionDecodeErrorZ {
        let res: Result<lightning::ln::chan_utils::BuiltCommitmentTransaction, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::chan_utils::BuiltCommitmentTransaction { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::chan_utils::BuiltCommitmentTransaction { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 /// Get the SIGHASH_ALL sighash value of the transaction.
@@ -1607,6 +1636,15 @@ pub extern "C" fn ClosingTransaction_hash(o: &ClosingTransaction) -> u64 {
        core::hash::Hash::hash(o.get_native_ref(), &mut hasher);
        core::hash::Hasher::finish(&hasher)
 }
+/// Checks if two ClosingTransactions contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn ClosingTransaction_eq(a: &ClosingTransaction, b: &ClosingTransaction) -> bool {
+       if a.inner == b.inner { return true; }
+       if a.inner.is_null() || b.inner.is_null() { return false; }
+       if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
 /// Construct an object of the class
 #[must_use]
 #[no_mangle]
@@ -1845,7 +1883,7 @@ pub(crate) extern "C" fn CommitmentTransaction_write_void(obj: *const c_void) ->
 /// Read a CommitmentTransaction from a byte array, created by CommitmentTransaction_write
 pub extern "C" fn CommitmentTransaction_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_CommitmentTransactionDecodeErrorZ {
        let res: Result<lightning::ln::chan_utils::CommitmentTransaction, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::chan_utils::CommitmentTransaction { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::chan_utils::CommitmentTransaction { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 /// The backwards-counting commitment number
index b58e8f86cfd767927daf0a315e02ce7136b49f5f..2c04328845a8f1d74677e4655279e20e66e3cb64 100644 (file)
@@ -1214,13 +1214,13 @@ pub enum PaymentSendFailure {
        /// in over-/re-payment.
        ///
        /// The results here are ordered the same as the paths in the route object which was passed to
-       /// send_payment, and any Errs which are not APIError::MonitorUpdateFailed can be safely
-       /// retried (though there is currently no API with which to do so).
+       /// send_payment, and any `Err`s which are not [`APIError::MonitorUpdateInProgress`] can be
+       /// safely retried via [`ChannelManager::retry_payment`].
        ///
-       /// Any entries which contain Err(APIError::MonitorUpdateFailed) or Ok(()) MUST NOT be retried
-       /// as they will result in over-/re-payment. These HTLCs all either successfully sent (in the
-       /// case of Ok(())) or will send once channel_monitor_updated is called on the next-hop channel
-       /// with the latest update_id.
+       /// Any entries which contain `Err(APIError::MonitorUpdateInprogress)` or `Ok(())` MUST NOT be
+       /// retried as they will result in over-/re-payment. These HTLCs all either successfully sent
+       /// (in the case of `Ok(())`) or will send once a [`MonitorEvent::Completed`] is provided for
+       /// the next-hop channel with the latest update_id.
        PartialFailure {
                /// The errors themselves, in the same order as the route hops.
                results: crate::c_types::derived::CVec_CResult_NoneAPIErrorZZ,
@@ -1726,12 +1726,12 @@ pub extern "C" fn ChannelManager_force_close_all_channels_without_broadcasting_t
 /// PaymentSendFailure for more info.
 ///
 /// In general, a path may raise:
-///  * APIError::RouteError when an invalid route or forwarding parameter (cltv_delta, fee,
+///  * [`APIError::RouteError`] when an invalid route or forwarding parameter (cltv_delta, fee,
 ///    node public key) is specified.
-///  * APIError::ChannelUnavailable if the next-hop channel is not available for updates
+///  * [`APIError::ChannelUnavailable`] if the next-hop channel is not available for updates
 ///    (including due to previous monitor update failure or new permanent monitor update
 ///    failure).
-///  * APIError::MonitorUpdateFailed if a new monitor update failure prevented sending the
+///  * [`APIError::MonitorUpdateInProgress`] if a new monitor update failure prevented sending the
 ///    relevant updates.
 ///
 /// Note that depending on the type of the PaymentSendFailure the HTLC may have been
@@ -2444,8 +2444,11 @@ extern "C" fn ChannelManager_ChannelMessageHandler_handle_announcement_signature
 extern "C" fn ChannelManager_ChannelMessageHandler_peer_disconnected(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, mut no_connection_possible: bool) {
        <nativeChannelManager as lightning::ln::msgs::ChannelMessageHandler<>>::peer_disconnected(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &their_node_id.into_rust(), no_connection_possible)
 }
-extern "C" fn ChannelManager_ChannelMessageHandler_peer_connected(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::Init) {
-       <nativeChannelManager as lightning::ln::msgs::ChannelMessageHandler<>>::peer_connected(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &their_node_id.into_rust(), msg.get_native_ref())
+#[must_use]
+extern "C" fn ChannelManager_ChannelMessageHandler_peer_connected(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::Init) -> crate::c_types::derived::CResult_NoneNoneZ {
+       let mut ret = <nativeChannelManager as lightning::ln::msgs::ChannelMessageHandler<>>::peer_connected(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &their_node_id.into_rust(), msg.get_native_ref());
+       let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() };
+       local_ret
 }
 extern "C" fn ChannelManager_ChannelMessageHandler_handle_channel_reestablish(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::ChannelReestablish) {
        <nativeChannelManager as lightning::ln::msgs::ChannelMessageHandler<>>::handle_channel_reestablish(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &their_node_id.into_rust(), msg.get_native_ref())
@@ -2467,6 +2470,30 @@ extern "C" fn ChannelManager_ChannelMessageHandler_provided_init_features(this_a
        crate::lightning::ln::features::InitFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true }
 }
 
+/// Fetches the set of [`NodeFeatures`] flags which are provided by or required by
+/// [`ChannelManager`].
+#[no_mangle]
+pub extern "C" fn provided_node_features() -> crate::lightning::ln::features::NodeFeatures {
+       let mut ret = lightning::ln::channelmanager::provided_node_features();
+       crate::lightning::ln::features::NodeFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true }
+}
+
+/// Fetches the set of [`ChannelFeatures`] flags which are provided by or required by
+/// [`ChannelManager`].
+#[no_mangle]
+pub extern "C" fn provided_channel_features() -> crate::lightning::ln::features::ChannelFeatures {
+       let mut ret = lightning::ln::channelmanager::provided_channel_features();
+       crate::lightning::ln::features::ChannelFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true }
+}
+
+/// Fetches the set of [`InitFeatures`] flags which are provided by or required by
+/// [`ChannelManager`].
+#[no_mangle]
+pub extern "C" fn provided_init_features() -> crate::lightning::ln::features::InitFeatures {
+       let mut ret = lightning::ln::channelmanager::provided_init_features();
+       crate::lightning::ln::features::InitFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true }
+}
+
 #[no_mangle]
 /// Serialize the CounterpartyForwardingInfo object into a byte array which can be read by CounterpartyForwardingInfo_read
 pub extern "C" fn CounterpartyForwardingInfo_write(obj: &crate::lightning::ln::channelmanager::CounterpartyForwardingInfo) -> crate::c_types::derived::CVec_u8Z {
@@ -2480,7 +2507,7 @@ pub(crate) extern "C" fn CounterpartyForwardingInfo_write_void(obj: *const c_voi
 /// Read a CounterpartyForwardingInfo from a byte array, created by CounterpartyForwardingInfo_write
 pub extern "C" fn CounterpartyForwardingInfo_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_CounterpartyForwardingInfoDecodeErrorZ {
        let res: Result<lightning::ln::channelmanager::CounterpartyForwardingInfo, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::channelmanager::CounterpartyForwardingInfo { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::channelmanager::CounterpartyForwardingInfo { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 #[no_mangle]
@@ -2496,7 +2523,7 @@ pub(crate) extern "C" fn ChannelCounterparty_write_void(obj: *const c_void) -> c
 /// Read a ChannelCounterparty from a byte array, created by ChannelCounterparty_write
 pub extern "C" fn ChannelCounterparty_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelCounterpartyDecodeErrorZ {
        let res: Result<lightning::ln::channelmanager::ChannelCounterparty, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::channelmanager::ChannelCounterparty { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::channelmanager::ChannelCounterparty { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 #[no_mangle]
@@ -2512,7 +2539,7 @@ pub(crate) extern "C" fn ChannelDetails_write_void(obj: *const c_void) -> crate:
 /// Read a ChannelDetails from a byte array, created by ChannelDetails_write
 pub extern "C" fn ChannelDetails_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelDetailsDecodeErrorZ {
        let res: Result<lightning::ln::channelmanager::ChannelDetails, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::channelmanager::ChannelDetails { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::channelmanager::ChannelDetails { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 #[no_mangle]
@@ -2528,7 +2555,7 @@ pub(crate) extern "C" fn PhantomRouteHints_write_void(obj: *const c_void) -> cra
 /// Read a PhantomRouteHints from a byte array, created by PhantomRouteHints_write
 pub extern "C" fn PhantomRouteHints_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_PhantomRouteHintsDecodeErrorZ {
        let res: Result<lightning::ln::channelmanager::PhantomRouteHints, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::channelmanager::PhantomRouteHints { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::channelmanager::PhantomRouteHints { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 #[no_mangle]
@@ -2728,6 +2755,6 @@ pub extern "C" fn ChannelManagerReadArgs_new(mut keys_manager: crate::lightning:
 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_read(ser: crate::c_types::u8slice, arg: crate::lightning::ln::channelmanager::ChannelManagerReadArgs) -> crate::c_types::derived::CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
        let arg_conv = *unsafe { Box::from_raw(arg.take_inner()) };
        let res: Result<(bitcoin::hash_types::BlockHash, lightning::ln::channelmanager::ChannelManager<crate::lightning::chain::keysinterface::Sign, crate::lightning::chain::Watch, crate::lightning::chain::chaininterface::BroadcasterInterface, crate::lightning::chain::keysinterface::KeysInterface, crate::lightning::chain::chaininterface::FeeEstimator, crate::lightning::util::logger::Logger>), lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj_arg(ser, arg_conv);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { let (mut orig_res_0_0, mut orig_res_0_1) = o; let mut local_res_0 = (crate::c_types::ThirtyTwoBytes { data: orig_res_0_0.into_inner() }, crate::lightning::ln::channelmanager::ChannelManager { inner: ObjOps::heap_alloc(orig_res_0_1), is_owned: true }).into(); local_res_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { let (mut orig_res_0_0, mut orig_res_0_1) = o; let mut local_res_0 = (crate::c_types::ThirtyTwoBytes { data: orig_res_0_0.into_inner() }, crate::lightning::ln::channelmanager::ChannelManager { inner: ObjOps::heap_alloc(orig_res_0_1), is_owned: true }).into(); local_res_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
index 2c4e1f35da6e5841987f810d1fab26707b414c96..4b41c11d1ea6c6cefa619d4ac5b4183b8327b992 100644 (file)
@@ -1422,23 +1422,6 @@ impl ChannelTypeFeatures {
                ret
        }
 }
-/// Returns the set of known init features that are related to channels. At least some of
-/// these features are likely required for peers to talk to us.
-#[must_use]
-#[no_mangle]
-pub extern "C" fn InitFeatures_known_channel_features() -> crate::lightning::ln::features::InitFeatures {
-       let mut ret = lightning::ln::features::InitFeatures::known_channel_features();
-       crate::lightning::ln::features::InitFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true }
-}
-
-/// Returns the set of known node features that are related to channels.
-#[must_use]
-#[no_mangle]
-pub extern "C" fn NodeFeatures_known_channel_features() -> crate::lightning::ln::features::NodeFeatures {
-       let mut ret = lightning::ln::features::NodeFeatures::known_channel_features();
-       crate::lightning::ln::features::NodeFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true }
-}
-
 /// Create a blank Features with no features set
 #[must_use]
 #[no_mangle]
@@ -1447,14 +1430,6 @@ pub extern "C" fn InitFeatures_empty() -> crate::lightning::ln::features::InitFe
        crate::lightning::ln::features::InitFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true }
 }
 
-/// Creates a Features with the bits set which are known by the implementation
-#[must_use]
-#[no_mangle]
-pub extern "C" fn InitFeatures_known() -> crate::lightning::ln::features::InitFeatures {
-       let mut ret = lightning::ln::features::InitFeatures::known();
-       crate::lightning::ln::features::InitFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true }
-}
-
 /// Returns true if this `Features` object contains unknown feature flags which are set as
 /// \"required\".
 #[must_use]
@@ -1472,14 +1447,6 @@ pub extern "C" fn NodeFeatures_empty() -> crate::lightning::ln::features::NodeFe
        crate::lightning::ln::features::NodeFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true }
 }
 
-/// Creates a Features with the bits set which are known by the implementation
-#[must_use]
-#[no_mangle]
-pub extern "C" fn NodeFeatures_known() -> crate::lightning::ln::features::NodeFeatures {
-       let mut ret = lightning::ln::features::NodeFeatures::known();
-       crate::lightning::ln::features::NodeFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true }
-}
-
 /// Returns true if this `Features` object contains unknown feature flags which are set as
 /// \"required\".
 #[must_use]
@@ -1497,14 +1464,6 @@ pub extern "C" fn ChannelFeatures_empty() -> crate::lightning::ln::features::Cha
        crate::lightning::ln::features::ChannelFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true }
 }
 
-/// Creates a Features with the bits set which are known by the implementation
-#[must_use]
-#[no_mangle]
-pub extern "C" fn ChannelFeatures_known() -> crate::lightning::ln::features::ChannelFeatures {
-       let mut ret = lightning::ln::features::ChannelFeatures::known();
-       crate::lightning::ln::features::ChannelFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true }
-}
-
 /// Returns true if this `Features` object contains unknown feature flags which are set as
 /// \"required\".
 #[must_use]
@@ -1522,14 +1481,6 @@ pub extern "C" fn InvoiceFeatures_empty() -> crate::lightning::ln::features::Inv
        crate::lightning::ln::features::InvoiceFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true }
 }
 
-/// Creates a Features with the bits set which are known by the implementation
-#[must_use]
-#[no_mangle]
-pub extern "C" fn InvoiceFeatures_known() -> crate::lightning::ln::features::InvoiceFeatures {
-       let mut ret = lightning::ln::features::InvoiceFeatures::known();
-       crate::lightning::ln::features::InvoiceFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true }
-}
-
 /// Returns true if this `Features` object contains unknown feature flags which are set as
 /// \"required\".
 #[must_use]
@@ -1547,14 +1498,6 @@ pub extern "C" fn ChannelTypeFeatures_empty() -> crate::lightning::ln::features:
        crate::lightning::ln::features::ChannelTypeFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true }
 }
 
-/// Creates a Features with the bits set which are known by the implementation
-#[must_use]
-#[no_mangle]
-pub extern "C" fn ChannelTypeFeatures_known() -> crate::lightning::ln::features::ChannelTypeFeatures {
-       let mut ret = lightning::ln::features::ChannelTypeFeatures::known();
-       crate::lightning::ln::features::ChannelTypeFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true }
-}
-
 /// Returns true if this `Features` object contains unknown feature flags which are set as
 /// \"required\".
 #[must_use]
@@ -1577,7 +1520,7 @@ pub(crate) extern "C" fn InitFeatures_write_void(obj: *const c_void) -> crate::c
 /// Read a InitFeatures from a byte array, created by InitFeatures_write
 pub extern "C" fn InitFeatures_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_InitFeaturesDecodeErrorZ {
        let res: Result<lightning::ln::features::InitFeatures, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::features::InitFeatures { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::features::InitFeatures { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 #[no_mangle]
@@ -1593,7 +1536,7 @@ pub(crate) extern "C" fn ChannelFeatures_write_void(obj: *const c_void) -> crate
 /// Read a ChannelFeatures from a byte array, created by ChannelFeatures_write
 pub extern "C" fn ChannelFeatures_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelFeaturesDecodeErrorZ {
        let res: Result<lightning::ln::features::ChannelFeatures, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::features::ChannelFeatures { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::features::ChannelFeatures { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 #[no_mangle]
@@ -1609,7 +1552,7 @@ pub(crate) extern "C" fn NodeFeatures_write_void(obj: *const c_void) -> crate::c
 /// Read a NodeFeatures from a byte array, created by NodeFeatures_write
 pub extern "C" fn NodeFeatures_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_NodeFeaturesDecodeErrorZ {
        let res: Result<lightning::ln::features::NodeFeatures, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::features::NodeFeatures { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::features::NodeFeatures { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 #[no_mangle]
@@ -1625,7 +1568,7 @@ pub(crate) extern "C" fn InvoiceFeatures_write_void(obj: *const c_void) -> crate
 /// Read a InvoiceFeatures from a byte array, created by InvoiceFeatures_write
 pub extern "C" fn InvoiceFeatures_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_InvoiceFeaturesDecodeErrorZ {
        let res: Result<lightning::ln::features::InvoiceFeatures, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::features::InvoiceFeatures { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::features::InvoiceFeatures { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 #[no_mangle]
@@ -1641,6 +1584,6 @@ pub(crate) extern "C" fn ChannelTypeFeatures_write_void(obj: *const c_void) -> c
 /// Read a ChannelTypeFeatures from a byte array, created by ChannelTypeFeatures_write
 pub extern "C" fn ChannelTypeFeatures_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelTypeFeaturesDecodeErrorZ {
        let res: Result<lightning::ln::features::ChannelTypeFeatures, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::features::ChannelTypeFeatures { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::features::ChannelTypeFeatures { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
index b1f4ddfb5f2adc4b9938def9f2074019187db7ac..efe7b9200e227f73717344f4c7c4db197fcf70ba 100644 (file)
@@ -31,76 +31,144 @@ use crate::c_types::*;
 #[cfg(feature="no-std")]
 use alloc::{vec::Vec, boxed::Box};
 
-
-use lightning::ln::msgs::DecodeError as nativeDecodeErrorImport;
-pub(crate) type nativeDecodeError = nativeDecodeErrorImport;
-
 /// An error in decoding a message or struct.
+#[derive(Clone)]
 #[must_use]
 #[repr(C)]
-pub struct DecodeError {
-       /// A pointer to the opaque Rust object.
-
-       /// Nearly everywhere, inner must be non-null, however in places where
-       /// the Rust equivalent takes an Option, it may be set to null to indicate None.
-       pub inner: *mut nativeDecodeError,
-       /// Indicates that this is the only struct which contains the same pointer.
-
-       /// Rust functions which take ownership of an object provided via an argument require
-       /// this to be true and invalidate the object pointed to by inner.
-       pub is_owned: bool,
-}
+pub enum DecodeError {
+       /// A version byte specified something we don't know how to handle.
+       /// Includes unknown realm byte in an OnionHopData packet
+       UnknownVersion,
+       /// Unknown feature mandating we fail to parse message (eg TLV with an even, unknown type)
+       UnknownRequiredFeature,
+       /// Value was invalid, eg a byte which was supposed to be a bool was something other than a 0
+       /// or 1, a public key/private key/signature was invalid, text wasn't UTF-8, TLV was
+       /// syntactically incorrect, etc
+       InvalidValue,
+       /// Buffer too short
+       ShortRead,
+       /// A length descriptor in the packet didn't describe the later data correctly
+       BadLengthDescriptor,
+       /// Error from std::io
+       Io(
+               crate::c_types::IOError),
+       /// The message included zlib-compressed values, which we don't support.
+       UnsupportedCompression,
+}
+use lightning::ln::msgs::DecodeError as DecodeErrorImport;
+pub(crate) type nativeDecodeError = DecodeErrorImport;
 
-impl Drop for DecodeError {
-       fn drop(&mut self) {
-               if self.is_owned && !<*mut nativeDecodeError>::is_null(self.inner) {
-                       let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
-               }
-       }
-}
-/// Frees any resources used by the DecodeError, if is_owned is set and inner is non-NULL.
-#[no_mangle]
-pub extern "C" fn DecodeError_free(this_obj: DecodeError) { }
-#[allow(unused)]
-/// Used only if an object of this type is returned as a trait impl by a method
-pub(crate) extern "C" fn DecodeError_free_void(this_ptr: *mut c_void) {
-       unsafe { let _ = Box::from_raw(this_ptr as *mut nativeDecodeError); }
-}
-#[allow(unused)]
 impl DecodeError {
-       pub(crate) fn get_native_ref(&self) -> &'static nativeDecodeError {
-               unsafe { &*ObjOps::untweak_ptr(self.inner) }
+       #[allow(unused)]
+       pub(crate) fn to_native(&self) -> nativeDecodeError {
+               match self {
+                       DecodeError::UnknownVersion => nativeDecodeError::UnknownVersion,
+                       DecodeError::UnknownRequiredFeature => nativeDecodeError::UnknownRequiredFeature,
+                       DecodeError::InvalidValue => nativeDecodeError::InvalidValue,
+                       DecodeError::ShortRead => nativeDecodeError::ShortRead,
+                       DecodeError::BadLengthDescriptor => nativeDecodeError::BadLengthDescriptor,
+                       DecodeError::Io (ref a, ) => {
+                               let mut a_nonref = (*a).clone();
+                               nativeDecodeError::Io (
+                                       a_nonref.to_rust_kind(),
+                               )
+                       },
+                       DecodeError::UnsupportedCompression => nativeDecodeError::UnsupportedCompression,
+               }
        }
-       pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeDecodeError {
-               unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
+       #[allow(unused)]
+       pub(crate) fn into_native(self) -> nativeDecodeError {
+               match self {
+                       DecodeError::UnknownVersion => nativeDecodeError::UnknownVersion,
+                       DecodeError::UnknownRequiredFeature => nativeDecodeError::UnknownRequiredFeature,
+                       DecodeError::InvalidValue => nativeDecodeError::InvalidValue,
+                       DecodeError::ShortRead => nativeDecodeError::ShortRead,
+                       DecodeError::BadLengthDescriptor => nativeDecodeError::BadLengthDescriptor,
+                       DecodeError::Io (mut a, ) => {
+                               nativeDecodeError::Io (
+                                       a.to_rust_kind(),
+                               )
+                       },
+                       DecodeError::UnsupportedCompression => nativeDecodeError::UnsupportedCompression,
+               }
        }
-       /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
-       pub(crate) fn take_inner(mut self) -> *mut nativeDecodeError {
-               assert!(self.is_owned);
-               let ret = ObjOps::untweak_ptr(self.inner);
-               self.inner = core::ptr::null_mut();
-               ret
+       #[allow(unused)]
+       pub(crate) fn from_native(native: &nativeDecodeError) -> Self {
+               match native {
+                       nativeDecodeError::UnknownVersion => DecodeError::UnknownVersion,
+                       nativeDecodeError::UnknownRequiredFeature => DecodeError::UnknownRequiredFeature,
+                       nativeDecodeError::InvalidValue => DecodeError::InvalidValue,
+                       nativeDecodeError::ShortRead => DecodeError::ShortRead,
+                       nativeDecodeError::BadLengthDescriptor => DecodeError::BadLengthDescriptor,
+                       nativeDecodeError::Io (ref a, ) => {
+                               let mut a_nonref = (*a).clone();
+                               DecodeError::Io (
+                                       crate::c_types::IOError::from_rust_kind(a_nonref),
+                               )
+                       },
+                       nativeDecodeError::UnsupportedCompression => DecodeError::UnsupportedCompression,
+               }
        }
-}
-impl Clone for DecodeError {
-       fn clone(&self) -> Self {
-               Self {
-                       inner: if <*mut nativeDecodeError>::is_null(self.inner) { core::ptr::null_mut() } else {
-                               ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
-                       is_owned: true,
+       #[allow(unused)]
+       pub(crate) fn native_into(native: nativeDecodeError) -> Self {
+               match native {
+                       nativeDecodeError::UnknownVersion => DecodeError::UnknownVersion,
+                       nativeDecodeError::UnknownRequiredFeature => DecodeError::UnknownRequiredFeature,
+                       nativeDecodeError::InvalidValue => DecodeError::InvalidValue,
+                       nativeDecodeError::ShortRead => DecodeError::ShortRead,
+                       nativeDecodeError::BadLengthDescriptor => DecodeError::BadLengthDescriptor,
+                       nativeDecodeError::Io (mut a, ) => {
+                               DecodeError::Io (
+                                       crate::c_types::IOError::from_rust_kind(a),
+                               )
+                       },
+                       nativeDecodeError::UnsupportedCompression => DecodeError::UnsupportedCompression,
                }
        }
 }
-#[allow(unused)]
-/// Used only if an object of this type is returned as a trait impl by a method
-pub(crate) extern "C" fn DecodeError_clone_void(this_ptr: *const c_void) -> *mut c_void {
-       Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeDecodeError)).clone() })) as *mut c_void
-}
+/// Frees any resources used by the DecodeError
 #[no_mangle]
+pub extern "C" fn DecodeError_free(this_ptr: DecodeError) { }
 /// Creates a copy of the DecodeError
+#[no_mangle]
 pub extern "C" fn DecodeError_clone(orig: &DecodeError) -> DecodeError {
        orig.clone()
 }
+#[no_mangle]
+/// Utility method to constructs a new UnknownVersion-variant DecodeError
+pub extern "C" fn DecodeError_unknown_version() -> DecodeError {
+       DecodeError::UnknownVersion}
+#[no_mangle]
+/// Utility method to constructs a new UnknownRequiredFeature-variant DecodeError
+pub extern "C" fn DecodeError_unknown_required_feature() -> DecodeError {
+       DecodeError::UnknownRequiredFeature}
+#[no_mangle]
+/// Utility method to constructs a new InvalidValue-variant DecodeError
+pub extern "C" fn DecodeError_invalid_value() -> DecodeError {
+       DecodeError::InvalidValue}
+#[no_mangle]
+/// Utility method to constructs a new ShortRead-variant DecodeError
+pub extern "C" fn DecodeError_short_read() -> DecodeError {
+       DecodeError::ShortRead}
+#[no_mangle]
+/// Utility method to constructs a new BadLengthDescriptor-variant DecodeError
+pub extern "C" fn DecodeError_bad_length_descriptor() -> DecodeError {
+       DecodeError::BadLengthDescriptor}
+#[no_mangle]
+/// Utility method to constructs a new Io-variant DecodeError
+pub extern "C" fn DecodeError_io(a: crate::c_types::IOError) -> DecodeError {
+       DecodeError::Io(a, )
+}
+#[no_mangle]
+/// Utility method to constructs a new UnsupportedCompression-variant DecodeError
+pub extern "C" fn DecodeError_unsupported_compression() -> DecodeError {
+       DecodeError::UnsupportedCompression}
+/// Checks if two DecodeErrors contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+#[no_mangle]
+pub extern "C" fn DecodeError_eq(a: &DecodeError, b: &DecodeError) -> bool {
+       if &a.to_native() == &b.to_native() { true } else { false }
+}
 
 use lightning::ln::msgs::Init as nativeInitImport;
 pub(crate) type nativeInit = nativeInitImport;
@@ -211,6 +279,15 @@ pub(crate) extern "C" fn Init_clone_void(this_ptr: *const c_void) -> *mut c_void
 pub extern "C" fn Init_clone(orig: &Init) -> Init {
        orig.clone()
 }
+/// Checks if two Inits contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn Init_eq(a: &Init, b: &Init) -> bool {
+       if a.inner == b.inner { return true; }
+       if a.inner.is_null() || b.inner.is_null() { return false; }
+       if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
 
 use lightning::ln::msgs::ErrorMessage as nativeErrorMessageImport;
 pub(crate) type nativeErrorMessage = nativeErrorMessageImport;
@@ -324,6 +401,15 @@ pub(crate) extern "C" fn ErrorMessage_clone_void(this_ptr: *const c_void) -> *mu
 pub extern "C" fn ErrorMessage_clone(orig: &ErrorMessage) -> ErrorMessage {
        orig.clone()
 }
+/// Checks if two ErrorMessages contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn ErrorMessage_eq(a: &ErrorMessage, b: &ErrorMessage) -> bool {
+       if a.inner == b.inner { return true; }
+       if a.inner.is_null() || b.inner.is_null() { return false; }
+       if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
 
 use lightning::ln::msgs::WarningMessage as nativeWarningMessageImport;
 pub(crate) type nativeWarningMessage = nativeWarningMessageImport;
@@ -435,6 +521,15 @@ pub(crate) extern "C" fn WarningMessage_clone_void(this_ptr: *const c_void) -> *
 pub extern "C" fn WarningMessage_clone(orig: &WarningMessage) -> WarningMessage {
        orig.clone()
 }
+/// Checks if two WarningMessages contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn WarningMessage_eq(a: &WarningMessage, b: &WarningMessage) -> bool {
+       if a.inner == b.inner { return true; }
+       if a.inner.is_null() || b.inner.is_null() { return false; }
+       if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
 
 use lightning::ln::msgs::Ping as nativePingImport;
 pub(crate) type nativePing = nativePingImport;
@@ -538,6 +633,15 @@ pub(crate) extern "C" fn Ping_clone_void(this_ptr: *const c_void) -> *mut c_void
 pub extern "C" fn Ping_clone(orig: &Ping) -> Ping {
        orig.clone()
 }
+/// Checks if two Pings contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn Ping_eq(a: &Ping, b: &Ping) -> bool {
+       if a.inner == b.inner { return true; }
+       if a.inner.is_null() || b.inner.is_null() { return false; }
+       if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
 
 use lightning::ln::msgs::Pong as nativePongImport;
 pub(crate) type nativePong = nativePongImport;
@@ -629,6 +733,15 @@ pub(crate) extern "C" fn Pong_clone_void(this_ptr: *const c_void) -> *mut c_void
 pub extern "C" fn Pong_clone(orig: &Pong) -> Pong {
        orig.clone()
 }
+/// Checks if two Pongs contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn Pong_eq(a: &Pong, b: &Pong) -> bool {
+       if a.inner == b.inner { return true; }
+       if a.inner.is_null() || b.inner.is_null() { return false; }
+       if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
 
 use lightning::ln::msgs::OpenChannel as nativeOpenChannelImport;
 pub(crate) type nativeOpenChannel = nativeOpenChannelImport;
@@ -918,6 +1031,15 @@ pub(crate) extern "C" fn OpenChannel_clone_void(this_ptr: *const c_void) -> *mut
 pub extern "C" fn OpenChannel_clone(orig: &OpenChannel) -> OpenChannel {
        orig.clone()
 }
+/// Checks if two OpenChannels contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn OpenChannel_eq(a: &OpenChannel, b: &OpenChannel) -> bool {
+       if a.inner == b.inner { return true; }
+       if a.inner.is_null() || b.inner.is_null() { return false; }
+       if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
 
 use lightning::ln::msgs::AcceptChannel as nativeAcceptChannelImport;
 pub(crate) type nativeAcceptChannel = nativeAcceptChannelImport;
@@ -1167,6 +1289,15 @@ pub(crate) extern "C" fn AcceptChannel_clone_void(this_ptr: *const c_void) -> *m
 pub extern "C" fn AcceptChannel_clone(orig: &AcceptChannel) -> AcceptChannel {
        orig.clone()
 }
+/// Checks if two AcceptChannels contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn AcceptChannel_eq(a: &AcceptChannel, b: &AcceptChannel) -> bool {
+       if a.inner == b.inner { return true; }
+       if a.inner.is_null() || b.inner.is_null() { return false; }
+       if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
 
 use lightning::ln::msgs::FundingCreated as nativeFundingCreatedImport;
 pub(crate) type nativeFundingCreated = nativeFundingCreatedImport;
@@ -1292,6 +1423,15 @@ pub(crate) extern "C" fn FundingCreated_clone_void(this_ptr: *const c_void) -> *
 pub extern "C" fn FundingCreated_clone(orig: &FundingCreated) -> FundingCreated {
        orig.clone()
 }
+/// Checks if two FundingCreateds contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn FundingCreated_eq(a: &FundingCreated, b: &FundingCreated) -> bool {
+       if a.inner == b.inner { return true; }
+       if a.inner.is_null() || b.inner.is_null() { return false; }
+       if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
 
 use lightning::ln::msgs::FundingSigned as nativeFundingSignedImport;
 pub(crate) type nativeFundingSigned = nativeFundingSignedImport;
@@ -1393,6 +1533,15 @@ pub(crate) extern "C" fn FundingSigned_clone_void(this_ptr: *const c_void) -> *m
 pub extern "C" fn FundingSigned_clone(orig: &FundingSigned) -> FundingSigned {
        orig.clone()
 }
+/// Checks if two FundingSigneds contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn FundingSigned_eq(a: &FundingSigned, b: &FundingSigned) -> bool {
+       if a.inner == b.inner { return true; }
+       if a.inner.is_null() || b.inner.is_null() { return false; }
+       if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
 
 use lightning::ln::msgs::ChannelReady as nativeChannelReadyImport;
 pub(crate) type nativeChannelReady = nativeChannelReadyImport;
@@ -1511,6 +1660,15 @@ pub(crate) extern "C" fn ChannelReady_clone_void(this_ptr: *const c_void) -> *mu
 pub extern "C" fn ChannelReady_clone(orig: &ChannelReady) -> ChannelReady {
        orig.clone()
 }
+/// Checks if two ChannelReadys contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn ChannelReady_eq(a: &ChannelReady, b: &ChannelReady) -> bool {
+       if a.inner == b.inner { return true; }
+       if a.inner.is_null() || b.inner.is_null() { return false; }
+       if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
 
 use lightning::ln::msgs::Shutdown as nativeShutdownImport;
 pub(crate) type nativeShutdown = nativeShutdownImport;
@@ -1614,6 +1772,15 @@ pub(crate) extern "C" fn Shutdown_clone_void(this_ptr: *const c_void) -> *mut c_
 pub extern "C" fn Shutdown_clone(orig: &Shutdown) -> Shutdown {
        orig.clone()
 }
+/// Checks if two Shutdowns contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn Shutdown_eq(a: &Shutdown, b: &Shutdown) -> bool {
+       if a.inner == b.inner { return true; }
+       if a.inner.is_null() || b.inner.is_null() { return false; }
+       if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
 
 use lightning::ln::msgs::ClosingSignedFeeRange as nativeClosingSignedFeeRangeImport;
 pub(crate) type nativeClosingSignedFeeRange = nativeClosingSignedFeeRangeImport;
@@ -1721,6 +1888,15 @@ pub(crate) extern "C" fn ClosingSignedFeeRange_clone_void(this_ptr: *const c_voi
 pub extern "C" fn ClosingSignedFeeRange_clone(orig: &ClosingSignedFeeRange) -> ClosingSignedFeeRange {
        orig.clone()
 }
+/// Checks if two ClosingSignedFeeRanges contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn ClosingSignedFeeRange_eq(a: &ClosingSignedFeeRange, b: &ClosingSignedFeeRange) -> bool {
+       if a.inner == b.inner { return true; }
+       if a.inner.is_null() || b.inner.is_null() { return false; }
+       if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
 
 use lightning::ln::msgs::ClosingSigned as nativeClosingSignedImport;
 pub(crate) type nativeClosingSigned = nativeClosingSignedImport;
@@ -1855,6 +2031,15 @@ pub(crate) extern "C" fn ClosingSigned_clone_void(this_ptr: *const c_void) -> *m
 pub extern "C" fn ClosingSigned_clone(orig: &ClosingSigned) -> ClosingSigned {
        orig.clone()
 }
+/// Checks if two ClosingSigneds contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn ClosingSigned_eq(a: &ClosingSigned, b: &ClosingSigned) -> bool {
+       if a.inner == b.inner { return true; }
+       if a.inner.is_null() || b.inner.is_null() { return false; }
+       if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
 
 use lightning::ln::msgs::UpdateAddHTLC as nativeUpdateAddHTLCImport;
 pub(crate) type nativeUpdateAddHTLC = nativeUpdateAddHTLCImport;
@@ -1980,6 +2165,15 @@ pub(crate) extern "C" fn UpdateAddHTLC_clone_void(this_ptr: *const c_void) -> *m
 pub extern "C" fn UpdateAddHTLC_clone(orig: &UpdateAddHTLC) -> UpdateAddHTLC {
        orig.clone()
 }
+/// Checks if two UpdateAddHTLCs contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn UpdateAddHTLC_eq(a: &UpdateAddHTLC, b: &UpdateAddHTLC) -> bool {
+       if a.inner == b.inner { return true; }
+       if a.inner.is_null() || b.inner.is_null() { return false; }
+       if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
 
 use lightning::ln::msgs::OnionMessage as nativeOnionMessageImport;
 pub(crate) type nativeOnionMessage = nativeOnionMessageImport;
@@ -2061,6 +2255,15 @@ pub(crate) extern "C" fn OnionMessage_clone_void(this_ptr: *const c_void) -> *mu
 pub extern "C" fn OnionMessage_clone(orig: &OnionMessage) -> OnionMessage {
        orig.clone()
 }
+/// Checks if two OnionMessages contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn OnionMessage_eq(a: &OnionMessage, b: &OnionMessage) -> bool {
+       if a.inner == b.inner { return true; }
+       if a.inner.is_null() || b.inner.is_null() { return false; }
+       if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
 
 use lightning::ln::msgs::UpdateFulfillHTLC as nativeUpdateFulfillHTLCImport;
 pub(crate) type nativeUpdateFulfillHTLC = nativeUpdateFulfillHTLCImport;
@@ -2174,6 +2377,15 @@ pub(crate) extern "C" fn UpdateFulfillHTLC_clone_void(this_ptr: *const c_void) -
 pub extern "C" fn UpdateFulfillHTLC_clone(orig: &UpdateFulfillHTLC) -> UpdateFulfillHTLC {
        orig.clone()
 }
+/// Checks if two UpdateFulfillHTLCs contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn UpdateFulfillHTLC_eq(a: &UpdateFulfillHTLC, b: &UpdateFulfillHTLC) -> bool {
+       if a.inner == b.inner { return true; }
+       if a.inner.is_null() || b.inner.is_null() { return false; }
+       if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
 
 use lightning::ln::msgs::UpdateFailHTLC as nativeUpdateFailHTLCImport;
 pub(crate) type nativeUpdateFailHTLC = nativeUpdateFailHTLCImport;
@@ -2266,6 +2478,15 @@ pub(crate) extern "C" fn UpdateFailHTLC_clone_void(this_ptr: *const c_void) -> *
 pub extern "C" fn UpdateFailHTLC_clone(orig: &UpdateFailHTLC) -> UpdateFailHTLC {
        orig.clone()
 }
+/// Checks if two UpdateFailHTLCs contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn UpdateFailHTLC_eq(a: &UpdateFailHTLC, b: &UpdateFailHTLC) -> bool {
+       if a.inner == b.inner { return true; }
+       if a.inner.is_null() || b.inner.is_null() { return false; }
+       if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
 
 use lightning::ln::msgs::UpdateFailMalformedHTLC as nativeUpdateFailMalformedHTLCImport;
 pub(crate) type nativeUpdateFailMalformedHTLC = nativeUpdateFailMalformedHTLCImport;
@@ -2369,6 +2590,15 @@ pub(crate) extern "C" fn UpdateFailMalformedHTLC_clone_void(this_ptr: *const c_v
 pub extern "C" fn UpdateFailMalformedHTLC_clone(orig: &UpdateFailMalformedHTLC) -> UpdateFailMalformedHTLC {
        orig.clone()
 }
+/// Checks if two UpdateFailMalformedHTLCs contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn UpdateFailMalformedHTLC_eq(a: &UpdateFailMalformedHTLC, b: &UpdateFailMalformedHTLC) -> bool {
+       if a.inner == b.inner { return true; }
+       if a.inner.is_null() || b.inner.is_null() { return false; }
+       if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
 
 use lightning::ln::msgs::CommitmentSigned as nativeCommitmentSignedImport;
 pub(crate) type nativeCommitmentSigned = nativeCommitmentSignedImport;
@@ -2487,6 +2717,15 @@ pub(crate) extern "C" fn CommitmentSigned_clone_void(this_ptr: *const c_void) ->
 pub extern "C" fn CommitmentSigned_clone(orig: &CommitmentSigned) -> CommitmentSigned {
        orig.clone()
 }
+/// Checks if two CommitmentSigneds contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn CommitmentSigned_eq(a: &CommitmentSigned, b: &CommitmentSigned) -> bool {
+       if a.inner == b.inner { return true; }
+       if a.inner.is_null() || b.inner.is_null() { return false; }
+       if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
 
 use lightning::ln::msgs::RevokeAndACK as nativeRevokeAndACKImport;
 pub(crate) type nativeRevokeAndACK = nativeRevokeAndACKImport;
@@ -2600,6 +2839,15 @@ pub(crate) extern "C" fn RevokeAndACK_clone_void(this_ptr: *const c_void) -> *mu
 pub extern "C" fn RevokeAndACK_clone(orig: &RevokeAndACK) -> RevokeAndACK {
        orig.clone()
 }
+/// Checks if two RevokeAndACKs contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn RevokeAndACK_eq(a: &RevokeAndACK, b: &RevokeAndACK) -> bool {
+       if a.inner == b.inner { return true; }
+       if a.inner.is_null() || b.inner.is_null() { return false; }
+       if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
 
 use lightning::ln::msgs::UpdateFee as nativeUpdateFeeImport;
 pub(crate) type nativeUpdateFee = nativeUpdateFeeImport;
@@ -2701,6 +2949,15 @@ pub(crate) extern "C" fn UpdateFee_clone_void(this_ptr: *const c_void) -> *mut c
 pub extern "C" fn UpdateFee_clone(orig: &UpdateFee) -> UpdateFee {
        orig.clone()
 }
+/// Checks if two UpdateFees contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn UpdateFee_eq(a: &UpdateFee, b: &UpdateFee) -> bool {
+       if a.inner == b.inner { return true; }
+       if a.inner.is_null() || b.inner.is_null() { return false; }
+       if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
 
 use lightning::ln::msgs::DataLossProtect as nativeDataLossProtectImport;
 pub(crate) type nativeDataLossProtect = nativeDataLossProtectImport;
@@ -2807,6 +3064,15 @@ pub(crate) extern "C" fn DataLossProtect_clone_void(this_ptr: *const c_void) ->
 pub extern "C" fn DataLossProtect_clone(orig: &DataLossProtect) -> DataLossProtect {
        orig.clone()
 }
+/// Checks if two DataLossProtects contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn DataLossProtect_eq(a: &DataLossProtect, b: &DataLossProtect) -> bool {
+       if a.inner == b.inner { return true; }
+       if a.inner.is_null() || b.inner.is_null() { return false; }
+       if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
 
 use lightning::ln::msgs::ChannelReestablish as nativeChannelReestablishImport;
 pub(crate) type nativeChannelReestablish = nativeChannelReestablishImport;
@@ -2910,6 +3176,15 @@ pub(crate) extern "C" fn ChannelReestablish_clone_void(this_ptr: *const c_void)
 pub extern "C" fn ChannelReestablish_clone(orig: &ChannelReestablish) -> ChannelReestablish {
        orig.clone()
 }
+/// Checks if two ChannelReestablishs contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn ChannelReestablish_eq(a: &ChannelReestablish, b: &ChannelReestablish) -> bool {
+       if a.inner == b.inner { return true; }
+       if a.inner.is_null() || b.inner.is_null() { return false; }
+       if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
 
 use lightning::ln::msgs::AnnouncementSignatures as nativeAnnouncementSignaturesImport;
 pub(crate) type nativeAnnouncementSignatures = nativeAnnouncementSignaturesImport;
@@ -3035,6 +3310,15 @@ pub(crate) extern "C" fn AnnouncementSignatures_clone_void(this_ptr: *const c_vo
 pub extern "C" fn AnnouncementSignatures_clone(orig: &AnnouncementSignatures) -> AnnouncementSignatures {
        orig.clone()
 }
+/// Checks if two AnnouncementSignaturess contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn AnnouncementSignatures_eq(a: &AnnouncementSignatures, b: &AnnouncementSignatures) -> bool {
+       if a.inner == b.inner { return true; }
+       if a.inner.is_null() || b.inner.is_null() { return false; }
+       if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
 /// An address which can be used to connect to a remote peer
 #[derive(Clone)]
 #[must_use]
@@ -3299,6 +3583,12 @@ pub extern "C" fn NetAddress_hostname(hostname: crate::lightning::util::ser::Hos
                port,
        }
 }
+/// Checks if two NetAddresss contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+#[no_mangle]
+pub extern "C" fn NetAddress_eq(a: &NetAddress, b: &NetAddress) -> bool {
+       if &a.to_native() == &b.to_native() { true } else { false }
+}
 #[no_mangle]
 /// Serialize the NetAddress object into a byte array which can be read by NetAddress_read
 pub extern "C" fn NetAddress_write(obj: &crate::lightning::ln::msgs::NetAddress) -> crate::c_types::derived::CVec_u8Z {
@@ -3308,7 +3598,7 @@ pub extern "C" fn NetAddress_write(obj: &crate::lightning::ln::msgs::NetAddress)
 /// Read a NetAddress from a byte array, created by NetAddress_write
 pub extern "C" fn NetAddress_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_NetAddressDecodeErrorZ {
        let res: Result<lightning::ln::msgs::NetAddress, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::NetAddress::native_into(o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::NetAddress::native_into(o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 
@@ -3455,6 +3745,15 @@ pub(crate) extern "C" fn UnsignedNodeAnnouncement_clone_void(this_ptr: *const c_
 pub extern "C" fn UnsignedNodeAnnouncement_clone(orig: &UnsignedNodeAnnouncement) -> UnsignedNodeAnnouncement {
        orig.clone()
 }
+/// Checks if two UnsignedNodeAnnouncements contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn UnsignedNodeAnnouncement_eq(a: &UnsignedNodeAnnouncement, b: &UnsignedNodeAnnouncement) -> bool {
+       if a.inner == b.inner { return true; }
+       if a.inner.is_null() || b.inner.is_null() { return false; }
+       if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
 
 use lightning::ln::msgs::NodeAnnouncement as nativeNodeAnnouncementImport;
 pub(crate) type nativeNodeAnnouncement = nativeNodeAnnouncementImport;
@@ -3556,6 +3855,15 @@ pub(crate) extern "C" fn NodeAnnouncement_clone_void(this_ptr: *const c_void) ->
 pub extern "C" fn NodeAnnouncement_clone(orig: &NodeAnnouncement) -> NodeAnnouncement {
        orig.clone()
 }
+/// Checks if two NodeAnnouncements contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn NodeAnnouncement_eq(a: &NodeAnnouncement, b: &NodeAnnouncement) -> bool {
+       if a.inner == b.inner { return true; }
+       if a.inner.is_null() || b.inner.is_null() { return false; }
+       if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
 
 use lightning::ln::msgs::UnsignedChannelAnnouncement as nativeUnsignedChannelAnnouncementImport;
 pub(crate) type nativeUnsignedChannelAnnouncement = nativeUnsignedChannelAnnouncementImport;
@@ -3703,6 +4011,15 @@ pub(crate) extern "C" fn UnsignedChannelAnnouncement_clone_void(this_ptr: *const
 pub extern "C" fn UnsignedChannelAnnouncement_clone(orig: &UnsignedChannelAnnouncement) -> UnsignedChannelAnnouncement {
        orig.clone()
 }
+/// Checks if two UnsignedChannelAnnouncements contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn UnsignedChannelAnnouncement_eq(a: &UnsignedChannelAnnouncement, b: &UnsignedChannelAnnouncement) -> bool {
+       if a.inner == b.inner { return true; }
+       if a.inner.is_null() || b.inner.is_null() { return false; }
+       if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
 
 use lightning::ln::msgs::ChannelAnnouncement as nativeChannelAnnouncementImport;
 pub(crate) type nativeChannelAnnouncement = nativeChannelAnnouncementImport;
@@ -3840,6 +4157,15 @@ pub(crate) extern "C" fn ChannelAnnouncement_clone_void(this_ptr: *const c_void)
 pub extern "C" fn ChannelAnnouncement_clone(orig: &ChannelAnnouncement) -> ChannelAnnouncement {
        orig.clone()
 }
+/// Checks if two ChannelAnnouncements contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn ChannelAnnouncement_eq(a: &ChannelAnnouncement, b: &ChannelAnnouncement) -> bool {
+       if a.inner == b.inner { return true; }
+       if a.inner.is_null() || b.inner.is_null() { return false; }
+       if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
 
 use lightning::ln::msgs::UnsignedChannelUpdate as nativeUnsignedChannelUpdateImport;
 pub(crate) type nativeUnsignedChannelUpdate = nativeUnsignedChannelUpdateImport;
@@ -4060,6 +4386,15 @@ pub(crate) extern "C" fn UnsignedChannelUpdate_clone_void(this_ptr: *const c_voi
 pub extern "C" fn UnsignedChannelUpdate_clone(orig: &UnsignedChannelUpdate) -> UnsignedChannelUpdate {
        orig.clone()
 }
+/// Checks if two UnsignedChannelUpdates contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn UnsignedChannelUpdate_eq(a: &UnsignedChannelUpdate, b: &UnsignedChannelUpdate) -> bool {
+       if a.inner == b.inner { return true; }
+       if a.inner.is_null() || b.inner.is_null() { return false; }
+       if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
 
 use lightning::ln::msgs::ChannelUpdate as nativeChannelUpdateImport;
 pub(crate) type nativeChannelUpdate = nativeChannelUpdateImport;
@@ -4161,6 +4496,15 @@ pub(crate) extern "C" fn ChannelUpdate_clone_void(this_ptr: *const c_void) -> *m
 pub extern "C" fn ChannelUpdate_clone(orig: &ChannelUpdate) -> ChannelUpdate {
        orig.clone()
 }
+/// Checks if two ChannelUpdates contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn ChannelUpdate_eq(a: &ChannelUpdate, b: &ChannelUpdate) -> bool {
+       if a.inner == b.inner { return true; }
+       if a.inner.is_null() || b.inner.is_null() { return false; }
+       if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
 
 use lightning::ln::msgs::QueryChannelRange as nativeQueryChannelRangeImport;
 pub(crate) type nativeQueryChannelRange = nativeQueryChannelRangeImport;
@@ -4277,6 +4621,15 @@ pub(crate) extern "C" fn QueryChannelRange_clone_void(this_ptr: *const c_void) -
 pub extern "C" fn QueryChannelRange_clone(orig: &QueryChannelRange) -> QueryChannelRange {
        orig.clone()
 }
+/// Checks if two QueryChannelRanges contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn QueryChannelRange_eq(a: &QueryChannelRange, b: &QueryChannelRange) -> bool {
+       if a.inner == b.inner { return true; }
+       if a.inner.is_null() || b.inner.is_null() { return false; }
+       if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
 
 use lightning::ln::msgs::ReplyChannelRange as nativeReplyChannelRangeImport;
 pub(crate) type nativeReplyChannelRange = nativeReplyChannelRangeImport;
@@ -4425,6 +4778,15 @@ pub(crate) extern "C" fn ReplyChannelRange_clone_void(this_ptr: *const c_void) -
 pub extern "C" fn ReplyChannelRange_clone(orig: &ReplyChannelRange) -> ReplyChannelRange {
        orig.clone()
 }
+/// Checks if two ReplyChannelRanges contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn ReplyChannelRange_eq(a: &ReplyChannelRange, b: &ReplyChannelRange) -> bool {
+       if a.inner == b.inner { return true; }
+       if a.inner.is_null() || b.inner.is_null() { return false; }
+       if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
 
 use lightning::ln::msgs::QueryShortChannelIds as nativeQueryShortChannelIdsImport;
 pub(crate) type nativeQueryShortChannelIds = nativeQueryShortChannelIdsImport;
@@ -4538,6 +4900,15 @@ pub(crate) extern "C" fn QueryShortChannelIds_clone_void(this_ptr: *const c_void
 pub extern "C" fn QueryShortChannelIds_clone(orig: &QueryShortChannelIds) -> QueryShortChannelIds {
        orig.clone()
 }
+/// Checks if two QueryShortChannelIdss contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn QueryShortChannelIds_eq(a: &QueryShortChannelIds, b: &QueryShortChannelIds) -> bool {
+       if a.inner == b.inner { return true; }
+       if a.inner.is_null() || b.inner.is_null() { return false; }
+       if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
 
 use lightning::ln::msgs::ReplyShortChannelIdsEnd as nativeReplyShortChannelIdsEndImport;
 pub(crate) type nativeReplyShortChannelIdsEnd = nativeReplyShortChannelIdsEndImport;
@@ -4644,6 +5015,15 @@ pub(crate) extern "C" fn ReplyShortChannelIdsEnd_clone_void(this_ptr: *const c_v
 pub extern "C" fn ReplyShortChannelIdsEnd_clone(orig: &ReplyShortChannelIdsEnd) -> ReplyShortChannelIdsEnd {
        orig.clone()
 }
+/// Checks if two ReplyShortChannelIdsEnds contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn ReplyShortChannelIdsEnd_eq(a: &ReplyShortChannelIdsEnd, b: &ReplyShortChannelIdsEnd) -> bool {
+       if a.inner == b.inner { return true; }
+       if a.inner.is_null() || b.inner.is_null() { return false; }
+       if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
 
 use lightning::ln::msgs::GossipTimestampFilter as nativeGossipTimestampFilterImport;
 pub(crate) type nativeGossipTimestampFilter = nativeGossipTimestampFilterImport;
@@ -4759,6 +5139,15 @@ pub(crate) extern "C" fn GossipTimestampFilter_clone_void(this_ptr: *const c_voi
 pub extern "C" fn GossipTimestampFilter_clone(orig: &GossipTimestampFilter) -> GossipTimestampFilter {
        orig.clone()
 }
+/// Checks if two GossipTimestampFilters contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn GossipTimestampFilter_eq(a: &GossipTimestampFilter, b: &GossipTimestampFilter) -> bool {
+       if a.inner == b.inner { return true; }
+       if a.inner.is_null() || b.inner.is_null() { return false; }
+       if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
 /// Used to put an error message in a LightningError
 #[derive(Clone)]
 #[must_use]
@@ -5240,6 +5629,15 @@ pub(crate) extern "C" fn CommitmentUpdate_clone_void(this_ptr: *const c_void) ->
 pub extern "C" fn CommitmentUpdate_clone(orig: &CommitmentUpdate) -> CommitmentUpdate {
        orig.clone()
 }
+/// Checks if two CommitmentUpdates contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn CommitmentUpdate_eq(a: &CommitmentUpdate, b: &CommitmentUpdate) -> bool {
+       if a.inner == b.inner { return true; }
+       if a.inner.is_null() || b.inner.is_null() { return false; }
+       if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
 /// A trait to describe an object which can receive channel messages.
 ///
 /// Messages MAY be called in parallel when they originate from different their_node_ids, however
@@ -5283,9 +5681,17 @@ pub struct ChannelMessageHandler {
        /// is believed to be possible in the future (eg they're sending us messages we don't
        /// understand or indicate they require unknown feature bits), no_connection_possible is set
        /// and any outstanding channels should be failed.
+       ///
+       /// Note that in some rare cases this may be called without a corresponding
+       /// [`Self::peer_connected`].
        pub peer_disconnected: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, no_connection_possible: bool),
        /// Handle a peer reconnecting, possibly generating channel_reestablish message(s).
-       pub peer_connected: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::Init),
+       ///
+       /// May return an `Err(())` if the features the peer supports are not sufficient to communicate
+       /// with us. Implementors should be somewhat conservative about doing so, however, as other
+       /// message handlers may still wish to communicate with this peer.
+       #[must_use]
+       pub peer_connected: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::Init) -> crate::c_types::derived::CResult_NoneNoneZ,
        /// Handle an incoming channel_reestablish message from the given peer.
        pub handle_channel_reestablish: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::ChannelReestablish),
        /// Handle an incoming channel update from the given peer.
@@ -5400,8 +5806,10 @@ impl rustChannelMessageHandler for ChannelMessageHandler {
        fn peer_disconnected(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut no_connection_possible: bool) {
                (self.peer_disconnected)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), no_connection_possible)
        }
-       fn peer_connected(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::Init) {
-               (self.peer_connected)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::Init { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::Init<>) as *mut _) }, is_owned: false })
+       fn peer_connected(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::Init) -> Result<(), ()> {
+               let mut ret = (self.peer_connected)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::Init { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::Init<>) as *mut _) }, is_owned: false });
+               let mut local_ret = match ret.result_ok { true => Ok( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) })*/ }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })};
+               local_ret
        }
        fn handle_channel_reestablish(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::ChannelReestablish) {
                (self.handle_channel_reestablish)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::ChannelReestablish { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::ChannelReestablish<>) as *mut _) }, is_owned: false })
@@ -5481,7 +5889,12 @@ pub struct RoutingMessageHandler {
        /// Called when a connection is established with a peer. This can be used to
        /// perform routing table synchronization using a strategy defined by the
        /// implementor.
-       pub peer_connected: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, init: &crate::lightning::ln::msgs::Init),
+       ///
+       /// May return an `Err(())` if the features the peer supports are not sufficient to communicate
+       /// with us. Implementors should be somewhat conservative about doing so, however, as other
+       /// message handlers may still wish to communicate with this peer.
+       #[must_use]
+       pub peer_connected: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, init: &crate::lightning::ln::msgs::Init) -> crate::c_types::derived::CResult_NoneNoneZ,
        /// Handles the reply of a query we initiated to learn about channels
        /// for a given range of blocks. We can expect to receive one or more
        /// replies to a single query.
@@ -5577,8 +5990,10 @@ impl rustRoutingMessageHandler for RoutingMessageHandler {
                let mut local_ret = if ret.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(ret.take_inner()) } }) };
                local_ret
        }
-       fn peer_connected(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut init: &lightning::ln::msgs::Init) {
-               (self.peer_connected)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::Init { inner: unsafe { ObjOps::nonnull_ptr_to_inner((init as *const lightning::ln::msgs::Init<>) as *mut _) }, is_owned: false })
+       fn peer_connected(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut init: &lightning::ln::msgs::Init) -> Result<(), ()> {
+               let mut ret = (self.peer_connected)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::Init { inner: unsafe { ObjOps::nonnull_ptr_to_inner((init as *const lightning::ln::msgs::Init<>) as *mut _) }, is_owned: false });
+               let mut local_ret = match ret.result_ok { true => Ok( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) })*/ }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })};
+               local_ret
        }
        fn handle_reply_channel_range(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: lightning::ln::msgs::ReplyChannelRange) -> Result<(), lightning::ln::msgs::LightningError> {
                let mut ret = (self.handle_reply_channel_range)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), crate::lightning::ln::msgs::ReplyChannelRange { inner: ObjOps::heap_alloc(msg), is_owned: true });
@@ -5638,9 +6053,17 @@ pub struct OnionMessageHandler {
        pub handle_onion_message: extern "C" fn (this_arg: *const c_void, peer_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::OnionMessage),
        /// Called when a connection is established with a peer. Can be used to track which peers
        /// advertise onion message support and are online.
-       pub peer_connected: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, init: &crate::lightning::ln::msgs::Init),
+       ///
+       /// May return an `Err(())` if the features the peer supports are not sufficient to communicate
+       /// with us. Implementors should be somewhat conservative about doing so, however, as other
+       /// message handlers may still wish to communicate with this peer.
+       #[must_use]
+       pub peer_connected: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, init: &crate::lightning::ln::msgs::Init) -> crate::c_types::derived::CResult_NoneNoneZ,
        /// Indicates a connection to the peer failed/an existing connection was lost. Allows handlers to
        /// drop and refuse to forward onion messages to this peer.
+       ///
+       /// Note that in some rare cases this may be called without a corresponding
+       /// [`Self::peer_connected`].
        pub peer_disconnected: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, no_connection_possible: bool),
        /// Gets the node feature flags which this handler itself supports. All available handlers are
        /// queried similarly and their feature flags are OR'd together to form the [`NodeFeatures`]
@@ -5688,8 +6111,10 @@ impl rustOnionMessageHandler for OnionMessageHandler {
        fn handle_onion_message(&self, mut peer_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::OnionMessage) {
                (self.handle_onion_message)(self.this_arg, crate::c_types::PublicKey::from_rust(&peer_node_id), &crate::lightning::ln::msgs::OnionMessage { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::OnionMessage<>) as *mut _) }, is_owned: false })
        }
-       fn peer_connected(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut init: &lightning::ln::msgs::Init) {
-               (self.peer_connected)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::Init { inner: unsafe { ObjOps::nonnull_ptr_to_inner((init as *const lightning::ln::msgs::Init<>) as *mut _) }, is_owned: false })
+       fn peer_connected(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut init: &lightning::ln::msgs::Init) -> Result<(), ()> {
+               let mut ret = (self.peer_connected)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::Init { inner: unsafe { ObjOps::nonnull_ptr_to_inner((init as *const lightning::ln::msgs::Init<>) as *mut _) }, is_owned: false });
+               let mut local_ret = match ret.result_ok { true => Ok( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) })*/ }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })};
+               local_ret
        }
        fn peer_disconnected(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut no_connection_possible: bool) {
                (self.peer_disconnected)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), no_connection_possible)
@@ -5746,7 +6171,7 @@ pub(crate) extern "C" fn AcceptChannel_write_void(obj: *const c_void) -> crate::
 /// Read a AcceptChannel from a byte array, created by AcceptChannel_write
 pub extern "C" fn AcceptChannel_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_AcceptChannelDecodeErrorZ {
        let res: Result<lightning::ln::msgs::AcceptChannel, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::AcceptChannel { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::AcceptChannel { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 #[no_mangle]
@@ -5762,7 +6187,7 @@ pub(crate) extern "C" fn AnnouncementSignatures_write_void(obj: *const c_void) -
 /// Read a AnnouncementSignatures from a byte array, created by AnnouncementSignatures_write
 pub extern "C" fn AnnouncementSignatures_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_AnnouncementSignaturesDecodeErrorZ {
        let res: Result<lightning::ln::msgs::AnnouncementSignatures, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::AnnouncementSignatures { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::AnnouncementSignatures { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 #[no_mangle]
@@ -5778,7 +6203,7 @@ pub(crate) extern "C" fn ChannelReestablish_write_void(obj: *const c_void) -> cr
 /// Read a ChannelReestablish from a byte array, created by ChannelReestablish_write
 pub extern "C" fn ChannelReestablish_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelReestablishDecodeErrorZ {
        let res: Result<lightning::ln::msgs::ChannelReestablish, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::ChannelReestablish { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::ChannelReestablish { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 #[no_mangle]
@@ -5794,7 +6219,7 @@ pub(crate) extern "C" fn ClosingSigned_write_void(obj: *const c_void) -> crate::
 /// Read a ClosingSigned from a byte array, created by ClosingSigned_write
 pub extern "C" fn ClosingSigned_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ClosingSignedDecodeErrorZ {
        let res: Result<lightning::ln::msgs::ClosingSigned, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::ClosingSigned { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::ClosingSigned { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 #[no_mangle]
@@ -5810,7 +6235,7 @@ pub(crate) extern "C" fn ClosingSignedFeeRange_write_void(obj: *const c_void) ->
 /// Read a ClosingSignedFeeRange from a byte array, created by ClosingSignedFeeRange_write
 pub extern "C" fn ClosingSignedFeeRange_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ClosingSignedFeeRangeDecodeErrorZ {
        let res: Result<lightning::ln::msgs::ClosingSignedFeeRange, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::ClosingSignedFeeRange { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::ClosingSignedFeeRange { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 #[no_mangle]
@@ -5826,7 +6251,7 @@ pub(crate) extern "C" fn CommitmentSigned_write_void(obj: *const c_void) -> crat
 /// Read a CommitmentSigned from a byte array, created by CommitmentSigned_write
 pub extern "C" fn CommitmentSigned_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_CommitmentSignedDecodeErrorZ {
        let res: Result<lightning::ln::msgs::CommitmentSigned, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::CommitmentSigned { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::CommitmentSigned { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 #[no_mangle]
@@ -5842,7 +6267,7 @@ pub(crate) extern "C" fn FundingCreated_write_void(obj: *const c_void) -> crate:
 /// Read a FundingCreated from a byte array, created by FundingCreated_write
 pub extern "C" fn FundingCreated_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_FundingCreatedDecodeErrorZ {
        let res: Result<lightning::ln::msgs::FundingCreated, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::FundingCreated { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::FundingCreated { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 #[no_mangle]
@@ -5858,7 +6283,7 @@ pub(crate) extern "C" fn FundingSigned_write_void(obj: *const c_void) -> crate::
 /// Read a FundingSigned from a byte array, created by FundingSigned_write
 pub extern "C" fn FundingSigned_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_FundingSignedDecodeErrorZ {
        let res: Result<lightning::ln::msgs::FundingSigned, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::FundingSigned { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::FundingSigned { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 #[no_mangle]
@@ -5874,7 +6299,7 @@ pub(crate) extern "C" fn ChannelReady_write_void(obj: *const c_void) -> crate::c
 /// Read a ChannelReady from a byte array, created by ChannelReady_write
 pub extern "C" fn ChannelReady_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelReadyDecodeErrorZ {
        let res: Result<lightning::ln::msgs::ChannelReady, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::ChannelReady { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::ChannelReady { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 #[no_mangle]
@@ -5890,7 +6315,7 @@ pub(crate) extern "C" fn Init_write_void(obj: *const c_void) -> crate::c_types::
 /// Read a Init from a byte array, created by Init_write
 pub extern "C" fn Init_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_InitDecodeErrorZ {
        let res: Result<lightning::ln::msgs::Init, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::Init { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::Init { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 #[no_mangle]
@@ -5906,7 +6331,7 @@ pub(crate) extern "C" fn OpenChannel_write_void(obj: *const c_void) -> crate::c_
 /// Read a OpenChannel from a byte array, created by OpenChannel_write
 pub extern "C" fn OpenChannel_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_OpenChannelDecodeErrorZ {
        let res: Result<lightning::ln::msgs::OpenChannel, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::OpenChannel { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::OpenChannel { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 #[no_mangle]
@@ -5922,7 +6347,7 @@ pub(crate) extern "C" fn RevokeAndACK_write_void(obj: *const c_void) -> crate::c
 /// Read a RevokeAndACK from a byte array, created by RevokeAndACK_write
 pub extern "C" fn RevokeAndACK_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_RevokeAndACKDecodeErrorZ {
        let res: Result<lightning::ln::msgs::RevokeAndACK, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::RevokeAndACK { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::RevokeAndACK { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 #[no_mangle]
@@ -5938,7 +6363,7 @@ pub(crate) extern "C" fn Shutdown_write_void(obj: *const c_void) -> crate::c_typ
 /// Read a Shutdown from a byte array, created by Shutdown_write
 pub extern "C" fn Shutdown_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ShutdownDecodeErrorZ {
        let res: Result<lightning::ln::msgs::Shutdown, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::Shutdown { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::Shutdown { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 #[no_mangle]
@@ -5954,7 +6379,7 @@ pub(crate) extern "C" fn UpdateFailHTLC_write_void(obj: *const c_void) -> crate:
 /// Read a UpdateFailHTLC from a byte array, created by UpdateFailHTLC_write
 pub extern "C" fn UpdateFailHTLC_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_UpdateFailHTLCDecodeErrorZ {
        let res: Result<lightning::ln::msgs::UpdateFailHTLC, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::UpdateFailHTLC { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::UpdateFailHTLC { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 #[no_mangle]
@@ -5970,7 +6395,7 @@ pub(crate) extern "C" fn UpdateFailMalformedHTLC_write_void(obj: *const c_void)
 /// Read a UpdateFailMalformedHTLC from a byte array, created by UpdateFailMalformedHTLC_write
 pub extern "C" fn UpdateFailMalformedHTLC_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_UpdateFailMalformedHTLCDecodeErrorZ {
        let res: Result<lightning::ln::msgs::UpdateFailMalformedHTLC, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::UpdateFailMalformedHTLC { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::UpdateFailMalformedHTLC { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 #[no_mangle]
@@ -5986,7 +6411,7 @@ pub(crate) extern "C" fn UpdateFee_write_void(obj: *const c_void) -> crate::c_ty
 /// Read a UpdateFee from a byte array, created by UpdateFee_write
 pub extern "C" fn UpdateFee_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_UpdateFeeDecodeErrorZ {
        let res: Result<lightning::ln::msgs::UpdateFee, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::UpdateFee { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::UpdateFee { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 #[no_mangle]
@@ -6002,7 +6427,7 @@ pub(crate) extern "C" fn UpdateFulfillHTLC_write_void(obj: *const c_void) -> cra
 /// Read a UpdateFulfillHTLC from a byte array, created by UpdateFulfillHTLC_write
 pub extern "C" fn UpdateFulfillHTLC_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_UpdateFulfillHTLCDecodeErrorZ {
        let res: Result<lightning::ln::msgs::UpdateFulfillHTLC, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::UpdateFulfillHTLC { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::UpdateFulfillHTLC { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 #[no_mangle]
@@ -6018,14 +6443,14 @@ pub(crate) extern "C" fn UpdateAddHTLC_write_void(obj: *const c_void) -> crate::
 /// Read a UpdateAddHTLC from a byte array, created by UpdateAddHTLC_write
 pub extern "C" fn UpdateAddHTLC_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_UpdateAddHTLCDecodeErrorZ {
        let res: Result<lightning::ln::msgs::UpdateAddHTLC, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::UpdateAddHTLC { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::UpdateAddHTLC { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 #[no_mangle]
 /// Read a OnionMessage from a byte array, created by OnionMessage_write
 pub extern "C" fn OnionMessage_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_OnionMessageDecodeErrorZ {
        let res: Result<lightning::ln::msgs::OnionMessage, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::OnionMessage { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::OnionMessage { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 #[no_mangle]
@@ -6050,7 +6475,7 @@ pub(crate) extern "C" fn Ping_write_void(obj: *const c_void) -> crate::c_types::
 /// Read a Ping from a byte array, created by Ping_write
 pub extern "C" fn Ping_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_PingDecodeErrorZ {
        let res: Result<lightning::ln::msgs::Ping, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::Ping { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::Ping { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 #[no_mangle]
@@ -6066,7 +6491,7 @@ pub(crate) extern "C" fn Pong_write_void(obj: *const c_void) -> crate::c_types::
 /// Read a Pong from a byte array, created by Pong_write
 pub extern "C" fn Pong_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_PongDecodeErrorZ {
        let res: Result<lightning::ln::msgs::Pong, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::Pong { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::Pong { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 #[no_mangle]
@@ -6082,7 +6507,7 @@ pub(crate) extern "C" fn UnsignedChannelAnnouncement_write_void(obj: *const c_vo
 /// Read a UnsignedChannelAnnouncement from a byte array, created by UnsignedChannelAnnouncement_write
 pub extern "C" fn UnsignedChannelAnnouncement_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_UnsignedChannelAnnouncementDecodeErrorZ {
        let res: Result<lightning::ln::msgs::UnsignedChannelAnnouncement, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::UnsignedChannelAnnouncement { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::UnsignedChannelAnnouncement { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 #[no_mangle]
@@ -6098,7 +6523,7 @@ pub(crate) extern "C" fn ChannelAnnouncement_write_void(obj: *const c_void) -> c
 /// Read a ChannelAnnouncement from a byte array, created by ChannelAnnouncement_write
 pub extern "C" fn ChannelAnnouncement_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelAnnouncementDecodeErrorZ {
        let res: Result<lightning::ln::msgs::ChannelAnnouncement, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::ChannelAnnouncement { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::ChannelAnnouncement { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 #[no_mangle]
@@ -6114,7 +6539,7 @@ pub(crate) extern "C" fn UnsignedChannelUpdate_write_void(obj: *const c_void) ->
 /// Read a UnsignedChannelUpdate from a byte array, created by UnsignedChannelUpdate_write
 pub extern "C" fn UnsignedChannelUpdate_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_UnsignedChannelUpdateDecodeErrorZ {
        let res: Result<lightning::ln::msgs::UnsignedChannelUpdate, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::UnsignedChannelUpdate { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::UnsignedChannelUpdate { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 #[no_mangle]
@@ -6130,7 +6555,7 @@ pub(crate) extern "C" fn ChannelUpdate_write_void(obj: *const c_void) -> crate::
 /// Read a ChannelUpdate from a byte array, created by ChannelUpdate_write
 pub extern "C" fn ChannelUpdate_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelUpdateDecodeErrorZ {
        let res: Result<lightning::ln::msgs::ChannelUpdate, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::ChannelUpdate { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::ChannelUpdate { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 #[no_mangle]
@@ -6146,7 +6571,7 @@ pub(crate) extern "C" fn ErrorMessage_write_void(obj: *const c_void) -> crate::c
 /// Read a ErrorMessage from a byte array, created by ErrorMessage_write
 pub extern "C" fn ErrorMessage_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ErrorMessageDecodeErrorZ {
        let res: Result<lightning::ln::msgs::ErrorMessage, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::ErrorMessage { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::ErrorMessage { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 #[no_mangle]
@@ -6162,7 +6587,7 @@ pub(crate) extern "C" fn WarningMessage_write_void(obj: *const c_void) -> crate:
 /// Read a WarningMessage from a byte array, created by WarningMessage_write
 pub extern "C" fn WarningMessage_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_WarningMessageDecodeErrorZ {
        let res: Result<lightning::ln::msgs::WarningMessage, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::WarningMessage { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::WarningMessage { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 #[no_mangle]
@@ -6178,7 +6603,7 @@ pub(crate) extern "C" fn UnsignedNodeAnnouncement_write_void(obj: *const c_void)
 /// Read a UnsignedNodeAnnouncement from a byte array, created by UnsignedNodeAnnouncement_write
 pub extern "C" fn UnsignedNodeAnnouncement_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_UnsignedNodeAnnouncementDecodeErrorZ {
        let res: Result<lightning::ln::msgs::UnsignedNodeAnnouncement, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::UnsignedNodeAnnouncement { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::UnsignedNodeAnnouncement { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 #[no_mangle]
@@ -6194,14 +6619,14 @@ pub(crate) extern "C" fn NodeAnnouncement_write_void(obj: *const c_void) -> crat
 /// Read a NodeAnnouncement from a byte array, created by NodeAnnouncement_write
 pub extern "C" fn NodeAnnouncement_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_NodeAnnouncementDecodeErrorZ {
        let res: Result<lightning::ln::msgs::NodeAnnouncement, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::NodeAnnouncement { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::NodeAnnouncement { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 #[no_mangle]
 /// Read a QueryShortChannelIds from a byte array, created by QueryShortChannelIds_write
 pub extern "C" fn QueryShortChannelIds_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_QueryShortChannelIdsDecodeErrorZ {
        let res: Result<lightning::ln::msgs::QueryShortChannelIds, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::QueryShortChannelIds { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::QueryShortChannelIds { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 #[no_mangle]
@@ -6226,7 +6651,7 @@ pub(crate) extern "C" fn ReplyShortChannelIdsEnd_write_void(obj: *const c_void)
 /// Read a ReplyShortChannelIdsEnd from a byte array, created by ReplyShortChannelIdsEnd_write
 pub extern "C" fn ReplyShortChannelIdsEnd_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ReplyShortChannelIdsEndDecodeErrorZ {
        let res: Result<lightning::ln::msgs::ReplyShortChannelIdsEnd, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::ReplyShortChannelIdsEnd { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::ReplyShortChannelIdsEnd { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 ///\n\t * Calculates the overflow safe ending block height for the query.\n\t * Overflow returns `0xffffffff`, otherwise returns `first_blocknum + number_of_blocks`\n\t 
@@ -6250,14 +6675,14 @@ pub(crate) extern "C" fn QueryChannelRange_write_void(obj: *const c_void) -> cra
 /// Read a QueryChannelRange from a byte array, created by QueryChannelRange_write
 pub extern "C" fn QueryChannelRange_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_QueryChannelRangeDecodeErrorZ {
        let res: Result<lightning::ln::msgs::QueryChannelRange, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::QueryChannelRange { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::QueryChannelRange { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 #[no_mangle]
 /// Read a ReplyChannelRange from a byte array, created by ReplyChannelRange_write
 pub extern "C" fn ReplyChannelRange_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ReplyChannelRangeDecodeErrorZ {
        let res: Result<lightning::ln::msgs::ReplyChannelRange, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::ReplyChannelRange { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::ReplyChannelRange { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 #[no_mangle]
@@ -6282,6 +6707,6 @@ pub(crate) extern "C" fn GossipTimestampFilter_write_void(obj: *const c_void) ->
 /// Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write
 pub extern "C" fn GossipTimestampFilter_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_GossipTimestampFilterDecodeErrorZ {
        let res: Result<lightning::ln::msgs::GossipTimestampFilter, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::GossipTimestampFilter { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::GossipTimestampFilter { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
index 7a7701979f813a19fc5cbfc1731b00489c42a5c6..5a877e2d82269537069c022d34902e2c18300ba2 100644 (file)
@@ -60,7 +60,7 @@ impl lightning::ln::wire::CustomMessageReader for CustomMessageHandler {
        type CustomMessage = crate::lightning::ln::wire::Type;
        fn read<R:crate::c_types::io::Read>(&self, mut message_type: u16, mut buffer: &mut R) -> Result<Option<crate::lightning::ln::wire::Type>, lightning::ln::msgs::DecodeError> {
                let mut ret = (self.CustomMessageReader.read)(self.CustomMessageReader.this_arg, message_type, crate::c_types::u8slice::from_vec(&crate::c_types::reader_to_vec(buffer)));
-               let mut local_ret = match ret.result_ok { true => Ok( { let mut local_ret_0 = { /* (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) })*/ let ret_0_opt = (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }); { } if ret_0_opt.is_none() { None } else { Some({ ret_0_opt.take() }) } }; local_ret_0 }), false => Err( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).take_inner()) } })};
+               let mut local_ret = match ret.result_ok { true => Ok( { let mut local_ret_0 = { /* (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) })*/ let ret_0_opt = (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }); { } if ret_0_opt.is_none() { None } else { Some({ ret_0_opt.take() }) } }; local_ret_0 }), false => Err( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).into_native() })};
                local_ret
        }
 }
@@ -252,8 +252,11 @@ extern "C" fn IgnoringMessageHandler_RoutingMessageHandler_get_next_node_announc
        let mut local_ret = crate::lightning::ln::msgs::NodeAnnouncement { inner: if ret.is_none() { core::ptr::null_mut() } else {  { ObjOps::heap_alloc((ret.unwrap())) } }, is_owned: true };
        local_ret
 }
-extern "C" fn IgnoringMessageHandler_RoutingMessageHandler_peer_connected(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, init: &crate::lightning::ln::msgs::Init) {
-       <nativeIgnoringMessageHandler as lightning::ln::msgs::RoutingMessageHandler<>>::peer_connected(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, &their_node_id.into_rust(), init.get_native_ref())
+#[must_use]
+extern "C" fn IgnoringMessageHandler_RoutingMessageHandler_peer_connected(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, init: &crate::lightning::ln::msgs::Init) -> crate::c_types::derived::CResult_NoneNoneZ {
+       let mut ret = <nativeIgnoringMessageHandler as lightning::ln::msgs::RoutingMessageHandler<>>::peer_connected(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, &their_node_id.into_rust(), init.get_native_ref());
+       let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() };
+       local_ret
 }
 #[must_use]
 extern "C" fn IgnoringMessageHandler_RoutingMessageHandler_handle_reply_channel_range(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, mut msg: crate::lightning::ln::msgs::ReplyChannelRange) -> crate::c_types::derived::CResult_NoneLightningErrorZ {
@@ -351,8 +354,11 @@ pub extern "C" fn IgnoringMessageHandler_as_OnionMessageHandler(this_arg: &Ignor
 extern "C" fn IgnoringMessageHandler_OnionMessageHandler_handle_onion_message(this_arg: *const c_void, mut peer_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::OnionMessage) {
        <nativeIgnoringMessageHandler as lightning::ln::msgs::OnionMessageHandler<>>::handle_onion_message(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, &peer_node_id.into_rust(), msg.get_native_ref())
 }
-extern "C" fn IgnoringMessageHandler_OnionMessageHandler_peer_connected(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, init: &crate::lightning::ln::msgs::Init) {
-       <nativeIgnoringMessageHandler as lightning::ln::msgs::OnionMessageHandler<>>::peer_connected(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, &their_node_id.into_rust(), init.get_native_ref())
+#[must_use]
+extern "C" fn IgnoringMessageHandler_OnionMessageHandler_peer_connected(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, init: &crate::lightning::ln::msgs::Init) -> crate::c_types::derived::CResult_NoneNoneZ {
+       let mut ret = <nativeIgnoringMessageHandler as lightning::ln::msgs::OnionMessageHandler<>>::peer_connected(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, &their_node_id.into_rust(), init.get_native_ref());
+       let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() };
+       local_ret
 }
 extern "C" fn IgnoringMessageHandler_OnionMessageHandler_peer_disconnected(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, mut no_connection_possible: bool) {
        <nativeIgnoringMessageHandler as lightning::ln::msgs::OnionMessageHandler<>>::peer_disconnected(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, &their_node_id.into_rust(), no_connection_possible)
@@ -368,7 +374,43 @@ extern "C" fn IgnoringMessageHandler_OnionMessageHandler_provided_init_features(
        crate::lightning::ln::features::InitFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true }
 }
 
-use core::convert::Infallible as nativeInfallible;
+impl From<nativeIgnoringMessageHandler> for crate::lightning::onion_message::messenger::CustomOnionMessageHandler {
+       fn from(obj: nativeIgnoringMessageHandler) -> Self {
+               let mut rust_obj = IgnoringMessageHandler { inner: ObjOps::heap_alloc(obj), is_owned: true };
+               let mut ret = IgnoringMessageHandler_as_CustomOnionMessageHandler(&rust_obj);
+               // We want to free rust_obj when ret gets drop()'d, not rust_obj, so wipe rust_obj's pointer and set ret's free() fn
+               rust_obj.inner = core::ptr::null_mut();
+               ret.free = Some(IgnoringMessageHandler_free_void);
+               ret
+       }
+}
+/// Constructs a new CustomOnionMessageHandler which calls the relevant methods on this_arg.
+/// This copies the `inner` pointer in this_arg and thus the returned CustomOnionMessageHandler must be freed before this_arg is
+#[no_mangle]
+pub extern "C" fn IgnoringMessageHandler_as_CustomOnionMessageHandler(this_arg: &IgnoringMessageHandler) -> crate::lightning::onion_message::messenger::CustomOnionMessageHandler {
+       crate::lightning::onion_message::messenger::CustomOnionMessageHandler {
+               this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void },
+               free: None,
+               handle_custom_message: IgnoringMessageHandler_CustomOnionMessageHandler_handle_custom_message,
+               read_custom_message: IgnoringMessageHandler_CustomOnionMessageHandler_read_custom_message,
+       }
+}
+
+extern "C" fn IgnoringMessageHandler_CustomOnionMessageHandler_handle_custom_message(this_arg: *const c_void, mut msg: crate::lightning::onion_message::packet::CustomOnionMessageContents) {
+       unreachable!();
+}
+#[must_use]
+extern "C" fn IgnoringMessageHandler_CustomOnionMessageHandler_read_custom_message(this_arg: *const c_void, mut message_type: u64, mut buffer: crate::c_types::u8slice) -> crate::c_types::derived::CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
+       let mut ret = <nativeIgnoringMessageHandler as lightning::onion_message::messenger::CustomOnionMessageHandler<>>::read_custom_message(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, message_type, &mut buffer.to_reader());
+       let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { let mut local_ret_0 = if o.is_none() { crate::c_types::derived::COption_CustomOnionMessageContentsZ::None } else { crate::c_types::derived::COption_CustomOnionMessageContentsZ::Some( { Into::into(o.unwrap()) }) }; local_ret_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
+       local_ret
+}
+
+impl From<nativeInfallible> for crate::lightning::onion_message::packet::CustomOnionMessageContents {
+       fn from(obj: nativeInfallible) -> Self {
+               unreachable!();
+       }
+}
 impl From<nativeInfallible> for crate::lightning::ln::wire::Type {
        fn from(obj: nativeInfallible) -> Self {
                unreachable!();
@@ -398,7 +440,7 @@ pub extern "C" fn IgnoringMessageHandler_as_CustomMessageReader(this_arg: &Ignor
 #[must_use]
 extern "C" fn IgnoringMessageHandler_CustomMessageReader_read(this_arg: *const c_void, mut message_type: u16, mut buffer: crate::c_types::u8slice) -> crate::c_types::derived::CResult_COption_TypeZDecodeErrorZ {
        let mut ret = <nativeIgnoringMessageHandler as lightning::ln::wire::CustomMessageReader<>>::read(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, message_type, &mut buffer.to_reader());
-       let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { let mut local_ret_0 = if o.is_none() { crate::c_types::derived::COption_TypeZ::None } else { crate::c_types::derived::COption_TypeZ::Some( { Into::into(o.unwrap()) }) }; local_ret_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { let mut local_ret_0 = if o.is_none() { crate::c_types::derived::COption_TypeZ::None } else { crate::c_types::derived::COption_TypeZ::Some( { Into::into(o.unwrap()) }) }; local_ret_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_ret
 }
 
@@ -623,8 +665,11 @@ extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_announcement_s
 extern "C" fn ErroringMessageHandler_ChannelMessageHandler_peer_disconnected(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, mut no_connection_possible: bool) {
        <nativeErroringMessageHandler as lightning::ln::msgs::ChannelMessageHandler<>>::peer_disconnected(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), no_connection_possible)
 }
-extern "C" fn ErroringMessageHandler_ChannelMessageHandler_peer_connected(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::Init) {
-       <nativeErroringMessageHandler as lightning::ln::msgs::ChannelMessageHandler<>>::peer_connected(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), msg.get_native_ref())
+#[must_use]
+extern "C" fn ErroringMessageHandler_ChannelMessageHandler_peer_connected(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::Init) -> crate::c_types::derived::CResult_NoneNoneZ {
+       let mut ret = <nativeErroringMessageHandler as lightning::ln::msgs::ChannelMessageHandler<>>::peer_connected(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), msg.get_native_ref());
+       let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() };
+       local_ret
 }
 extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_channel_reestablish(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::ChannelReestablish) {
        <nativeErroringMessageHandler as lightning::ln::msgs::ChannelMessageHandler<>>::handle_channel_reestablish(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), msg.get_native_ref())
@@ -1054,7 +1099,7 @@ impl PeerManager {
 /// minute should suffice.
 #[must_use]
 #[no_mangle]
-pub extern "C" fn PeerManager_new(mut message_handler: crate::lightning::ln::peer_handler::MessageHandler, mut our_node_secret: crate::c_types::SecretKey, mut current_time: u64, ephemeral_random_data: *const [u8; 32], mut logger: crate::lightning::util::logger::Logger, mut custom_message_handler: crate::lightning::ln::peer_handler::CustomMessageHandler) -> crate::lightning::ln::peer_handler::PeerManager {
+pub extern "C" fn PeerManager_new(mut message_handler: crate::lightning::ln::peer_handler::MessageHandler, mut our_node_secret: crate::c_types::SecretKey, mut current_time: u32, ephemeral_random_data: *const [u8; 32], mut logger: crate::lightning::util::logger::Logger, mut custom_message_handler: crate::lightning::ln::peer_handler::CustomMessageHandler) -> crate::lightning::ln::peer_handler::PeerManager {
        let mut ret = lightning::ln::peer_handler::PeerManager::new(*unsafe { Box::from_raw(message_handler.take_inner()) }, our_node_secret.into_rust(), current_time, unsafe { &*ephemeral_random_data}, logger, custom_message_handler);
        crate::lightning::ln::peer_handler::PeerManager { inner: ObjOps::heap_alloc(ret), is_owned: true }
 }
@@ -1249,3 +1294,4 @@ pub extern "C" fn PeerManager_broadcast_node_announcement(this_arg: &crate::ligh
        unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.broadcast_node_announcement(rgb.data, alias.data, local_addresses)
 }
 
+use core::convert::Infallible as nativeInfallible;
index c91d04fd71c3f03f896fa5d9358a0d98e373ebaa..e808b169bc1856d4241600fa3d33172b67b2decf 100644 (file)
@@ -88,6 +88,15 @@ pub(crate) extern "C" fn ShutdownScript_clone_void(this_ptr: *const c_void) -> *
 pub extern "C" fn ShutdownScript_clone(orig: &ShutdownScript) -> ShutdownScript {
        orig.clone()
 }
+/// Checks if two ShutdownScripts contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn ShutdownScript_eq(a: &ShutdownScript, b: &ShutdownScript) -> bool {
+       if a.inner == b.inner { return true; }
+       if a.inner.is_null() || b.inner.is_null() { return false; }
+       if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
 
 use lightning::ln::script::InvalidShutdownScript as nativeInvalidShutdownScriptImport;
 pub(crate) type nativeInvalidShutdownScript = nativeInvalidShutdownScriptImport;
@@ -194,7 +203,7 @@ pub(crate) extern "C" fn ShutdownScript_write_void(obj: *const c_void) -> crate:
 /// Read a ShutdownScript from a byte array, created by ShutdownScript_write
 pub extern "C" fn ShutdownScript_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ShutdownScriptDecodeErrorZ {
        let res: Result<lightning::ln::script::ShutdownScript, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::script::ShutdownScript { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::script::ShutdownScript { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 /// Generates a P2WPKH script pubkey from the given [`WPubkeyHash`].
index a9f1c3d622d6e6fa4705d548f99ea9788837e6f3..ac2efb15bcd70033f9324f0c30656c5bee92c026 100644 (file)
@@ -52,7 +52,7 @@ impl rustCustomMessageReader for CustomMessageReader {
        type CustomMessage = crate::lightning::ln::wire::Type;
        fn read<R:crate::c_types::io::Read>(&self, mut message_type: u16, mut buffer: &mut R) -> Result<Option<crate::lightning::ln::wire::Type>, lightning::ln::msgs::DecodeError> {
                let mut ret = (self.read)(self.this_arg, message_type, crate::c_types::u8slice::from_vec(&crate::c_types::reader_to_vec(buffer)));
-               let mut local_ret = match ret.result_ok { true => Ok( { let mut local_ret_0 = { /* (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) })*/ let ret_0_opt = (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }); { } if ret_0_opt.is_none() { None } else { Some({ ret_0_opt.take() }) } }; local_ret_0 }), false => Err( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).take_inner()) } })};
+               let mut local_ret = match ret.result_ok { true => Ok( { let mut local_ret_0 = { /* (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) })*/ let ret_0_opt = (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }); { } if ret_0_opt.is_none() { None } else { Some({ ret_0_opt.take() }) } }; local_ret_0 }), false => Err( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).into_native() })};
                local_ret
        }
 }
index 2fd7649dd42ca1436fceb04b4ae863a49364f5d0..701dad8bc056a1f9f75abc02b9790a4412ca5cfd 100644 (file)
@@ -146,7 +146,7 @@ pub(crate) extern "C" fn BlindedRoute_write_void(obj: *const c_void) -> crate::c
 /// Read a BlindedRoute from a byte array, created by BlindedRoute_write
 pub extern "C" fn BlindedRoute_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_BlindedRouteDecodeErrorZ {
        let res: Result<lightning::onion_message::blinded_route::BlindedRoute, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::onion_message::blinded_route::BlindedRoute { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::onion_message::blinded_route::BlindedRoute { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 #[no_mangle]
@@ -162,6 +162,6 @@ pub(crate) extern "C" fn BlindedHop_write_void(obj: *const c_void) -> crate::c_t
 /// Read a BlindedHop from a byte array, created by BlindedHop_write
 pub extern "C" fn BlindedHop_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_BlindedHopDecodeErrorZ {
        let res: Result<lightning::onion_message::blinded_route::BlindedHop, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::onion_message::blinded_route::BlindedHop { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::onion_message::blinded_route::BlindedHop { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
index b3a696c586879dd808cb42d465df368ddcdca8e3..66555a3d023c6d8d7c3eee77c9b666a8bebf77d7 100644 (file)
@@ -19,11 +19,11 @@ use alloc::{vec::Vec, boxed::Box};
 
 
 use lightning::onion_message::messenger::OnionMessenger as nativeOnionMessengerImport;
-pub(crate) type nativeOnionMessenger = nativeOnionMessengerImport<crate::lightning::chain::keysinterface::Sign, crate::lightning::chain::keysinterface::KeysInterface, crate::lightning::util::logger::Logger>;
+pub(crate) type nativeOnionMessenger = nativeOnionMessengerImport<crate::lightning::chain::keysinterface::Sign, crate::lightning::chain::keysinterface::KeysInterface, crate::lightning::util::logger::Logger, crate::lightning::onion_message::messenger::CustomOnionMessageHandler>;
 
 /// A sender, receiver and forwarder of onion messages. In upcoming releases, this object will be
 /// used to retrieve invoices and fulfill invoice requests from [offers]. Currently, only sending
-/// and receiving empty onion messages is supported.
+/// and receiving custom onion messages is supported.
 ///
 /// # Example
 ///
@@ -32,9 +32,14 @@ pub(crate) type nativeOnionMessenger = nativeOnionMessengerImport<crate::lightni
 /// # use bitcoin::hashes::_export::_core::time::Duration;
 /// # use bitcoin::secp256k1::{PublicKey, Secp256k1, SecretKey};
 /// # use lightning::chain::keysinterface::{InMemorySigner, KeysManager, KeysInterface};
+/// # use lightning::ln::msgs::DecodeError;
+/// # use lightning::ln::peer_handler::IgnoringMessageHandler;
 /// # use lightning::onion_message::messenger::{Destination, OnionMessenger};
+/// # use lightning::onion_message::packet::CustomOnionMessageContents;
 /// # use lightning::onion_message::blinded_route::BlindedRoute;
 /// # use lightning::util::logger::{Logger, Record};
+/// # use lightning::util::ser::{Writeable, Writer};
+/// # use lightning::io;
 /// # use std::sync::Arc;
 /// # struct FakeLogger {};
 /// # impl Logger for FakeLogger {
@@ -47,28 +52,42 @@ pub(crate) type nativeOnionMessenger = nativeOnionMessengerImport<crate::lightni
 /// # let node_secret = SecretKey::from_slice(&hex::decode(\"0101010101010101010101010101010101010101010101010101010101010101\").unwrap()[..]).unwrap();
 /// # let secp_ctx = Secp256k1::new();
 /// # let hop_node_id1 = PublicKey::from_secret_key(&secp_ctx, &node_secret);
-/// # let (hop_node_id2, hop_node_id3, hop_node_id4) = (hop_node_id1, hop_node_id1,
-/// hop_node_id1);
+/// # let (hop_node_id2, hop_node_id3, hop_node_id4) = (hop_node_id1, hop_node_id1, hop_node_id1);
 /// # let destination_node_id = hop_node_id1;
-/// #
+/// # let your_custom_message_handler = IgnoringMessageHandler {};
 /// // Create the onion messenger. This must use the same `keys_manager` as is passed to your
 /// // ChannelManager.
-/// let onion_messenger = OnionMessenger::new(&keys_manager, logger);
+/// let onion_messenger = OnionMessenger::new(&keys_manager, logger, your_custom_message_handler);
 ///
-/// // Send an empty onion message to a node id.
+/// # struct YourCustomMessage {}
+/// impl Writeable for YourCustomMessage {
+/// \tfn write<W: Writer>(&self, w: &mut W) -> Result<(), io::Error> {
+/// \t\t# Ok(())
+/// \t\t// Write your custom onion message to `w`
+/// \t}
+/// }
+/// impl CustomOnionMessageContents for YourCustomMessage {
+/// \tfn tlv_type(&self) -> u64 {
+/// \t\t# let your_custom_message_type = 42;
+/// \t\tyour_custom_message_type
+/// \t}
+/// }
+/// // Send a custom onion message to a node id.
 /// let intermediate_hops = [hop_node_id1, hop_node_id2];
 /// let reply_path = None;
-/// onion_messenger.send_onion_message(&intermediate_hops, Destination::Node(destination_node_id), reply_path);
+/// # let your_custom_message = YourCustomMessage {};
+/// onion_messenger.send_custom_onion_message(&intermediate_hops, Destination::Node(destination_node_id), your_custom_message, reply_path);
 ///
 /// // Create a blinded route to yourself, for someone to send an onion message to.
 /// # let your_node_id = hop_node_id1;
 /// let hops = [hop_node_id3, hop_node_id4, your_node_id];
 /// let blinded_route = BlindedRoute::new(&hops, &keys_manager, &secp_ctx).unwrap();
 ///
-/// // Send an empty onion message to a blinded route.
+/// // Send a custom onion message to a blinded route.
 /// # let intermediate_hops = [hop_node_id1, hop_node_id2];
 /// let reply_path = None;
-/// onion_messenger.send_onion_message(&intermediate_hops, Destination::BlindedRoute(blinded_route), reply_path);
+/// # let your_custom_message = YourCustomMessage {};
+/// onion_messenger.send_custom_onion_message(&intermediate_hops, Destination::BlindedRoute(blinded_route), your_custom_message, reply_path);
 /// ```
 ///
 /// [offers]: <https://github.com/lightning/bolts/pull/798>
@@ -180,7 +199,7 @@ pub extern "C" fn Destination_blinded_route(a: crate::lightning::onion_message::
 }
 /// Errors that may occur when [sending an onion message].
 ///
-/// [sending an onion message]: OnionMessenger::send_onion_message
+/// [sending an onion message]: OnionMessenger::send_custom_onion_message
 #[derive(Clone)]
 #[must_use]
 #[repr(C)]
@@ -196,6 +215,8 @@ pub enum SendError {
        TooFewBlindedHops,
        /// Our next-hop peer was offline or does not support onion message forwarding.
        InvalidFirstHop,
+       /// Onion message contents must have a TLV type >= 64.
+       InvalidMessage,
        /// Our next-hop peer's buffer was full or our total outbound buffer was full.
        BufferFull,
 }
@@ -215,6 +236,7 @@ impl SendError {
                        SendError::TooBigPacket => nativeSendError::TooBigPacket,
                        SendError::TooFewBlindedHops => nativeSendError::TooFewBlindedHops,
                        SendError::InvalidFirstHop => nativeSendError::InvalidFirstHop,
+                       SendError::InvalidMessage => nativeSendError::InvalidMessage,
                        SendError::BufferFull => nativeSendError::BufferFull,
                }
        }
@@ -229,6 +251,7 @@ impl SendError {
                        SendError::TooBigPacket => nativeSendError::TooBigPacket,
                        SendError::TooFewBlindedHops => nativeSendError::TooFewBlindedHops,
                        SendError::InvalidFirstHop => nativeSendError::InvalidFirstHop,
+                       SendError::InvalidMessage => nativeSendError::InvalidMessage,
                        SendError::BufferFull => nativeSendError::BufferFull,
                }
        }
@@ -244,6 +267,7 @@ impl SendError {
                        nativeSendError::TooBigPacket => SendError::TooBigPacket,
                        nativeSendError::TooFewBlindedHops => SendError::TooFewBlindedHops,
                        nativeSendError::InvalidFirstHop => SendError::InvalidFirstHop,
+                       nativeSendError::InvalidMessage => SendError::InvalidMessage,
                        nativeSendError::BufferFull => SendError::BufferFull,
                }
        }
@@ -258,6 +282,7 @@ impl SendError {
                        nativeSendError::TooBigPacket => SendError::TooBigPacket,
                        nativeSendError::TooFewBlindedHops => SendError::TooFewBlindedHops,
                        nativeSendError::InvalidFirstHop => SendError::InvalidFirstHop,
+                       nativeSendError::InvalidMessage => SendError::InvalidMessage,
                        nativeSendError::BufferFull => SendError::BufferFull,
                }
        }
@@ -288,28 +313,106 @@ pub extern "C" fn SendError_too_few_blinded_hops() -> SendError {
 pub extern "C" fn SendError_invalid_first_hop() -> SendError {
        SendError::InvalidFirstHop}
 #[no_mangle]
+/// Utility method to constructs a new InvalidMessage-variant SendError
+pub extern "C" fn SendError_invalid_message() -> SendError {
+       SendError::InvalidMessage}
+#[no_mangle]
 /// Utility method to constructs a new BufferFull-variant SendError
 pub extern "C" fn SendError_buffer_full() -> SendError {
        SendError::BufferFull}
+/// Checks if two SendErrors contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+#[no_mangle]
+pub extern "C" fn SendError_eq(a: &SendError, b: &SendError) -> bool {
+       if &a.to_native() == &b.to_native() { true } else { false }
+}
+/// Handler for custom onion messages. If you are using [`SimpleArcOnionMessenger`],
+/// [`SimpleRefOnionMessenger`], or prefer to ignore inbound custom onion messages,
+/// [`IgnoringMessageHandler`] must be provided to [`OnionMessenger::new`]. Otherwise, a custom
+/// implementation of this trait must be provided, with [`CustomMessage`] specifying the supported
+/// message types.
+///
+/// See [`OnionMessenger`] for example usage.
+///
+/// [`IgnoringMessageHandler`]: crate::ln::peer_handler::IgnoringMessageHandler
+/// [`CustomMessage`]: Self::CustomMessage
+#[repr(C)]
+pub struct CustomOnionMessageHandler {
+       /// An opaque pointer which is passed to your function implementations as an argument.
+       /// This has no meaning in the LDK, and can be NULL or any other value.
+       pub this_arg: *mut c_void,
+       /// Called with the custom message that was received.
+       pub handle_custom_message: extern "C" fn (this_arg: *const c_void, msg: crate::lightning::onion_message::packet::CustomOnionMessageContents),
+       /// Read a custom message of type `message_type` from `buffer`, returning `Ok(None)` if the
+       /// message type is unknown.
+       #[must_use]
+       pub read_custom_message: extern "C" fn (this_arg: *const c_void, message_type: u64, buffer: crate::c_types::u8slice) -> crate::c_types::derived::CResult_COption_CustomOnionMessageContentsZDecodeErrorZ,
+       /// Frees any resources associated with this object given its this_arg pointer.
+       /// Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+       pub free: Option<extern "C" fn(this_arg: *mut c_void)>,
+}
+unsafe impl Send for CustomOnionMessageHandler {}
+unsafe impl Sync for CustomOnionMessageHandler {}
+#[no_mangle]
+pub(crate) extern "C" fn CustomOnionMessageHandler_clone_fields(orig: &CustomOnionMessageHandler) -> CustomOnionMessageHandler {
+       CustomOnionMessageHandler {
+               this_arg: orig.this_arg,
+               handle_custom_message: Clone::clone(&orig.handle_custom_message),
+               read_custom_message: Clone::clone(&orig.read_custom_message),
+               free: Clone::clone(&orig.free),
+       }
+}
+
+use lightning::onion_message::messenger::CustomOnionMessageHandler as rustCustomOnionMessageHandler;
+impl rustCustomOnionMessageHandler for CustomOnionMessageHandler {
+       type CustomMessage = crate::lightning::onion_message::packet::CustomOnionMessageContents;
+       fn handle_custom_message(&self, mut msg: crate::lightning::onion_message::packet::CustomOnionMessageContents) {
+               (self.handle_custom_message)(self.this_arg, Into::into(msg))
+       }
+       fn read_custom_message<R:crate::c_types::io::Read>(&self, mut message_type: u64, mut buffer: &mut R) -> Result<Option<crate::lightning::onion_message::packet::CustomOnionMessageContents>, lightning::ln::msgs::DecodeError> {
+               let mut ret = (self.read_custom_message)(self.this_arg, message_type, crate::c_types::u8slice::from_vec(&crate::c_types::reader_to_vec(buffer)));
+               let mut local_ret = match ret.result_ok { true => Ok( { let mut local_ret_0 = { /* (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) })*/ let ret_0_opt = (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }); { } if ret_0_opt.is_none() { None } else { Some({ ret_0_opt.take() }) } }; local_ret_0 }), false => Err( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).into_native() })};
+               local_ret
+       }
+}
+
+// We're essentially a pointer already, or at least a set of pointers, so allow us to be used
+// directly as a Deref trait in higher-level structs:
+impl core::ops::Deref for CustomOnionMessageHandler {
+       type Target = Self;
+       fn deref(&self) -> &Self {
+               self
+       }
+}
+/// Calls the free function if one is set
+#[no_mangle]
+pub extern "C" fn CustomOnionMessageHandler_free(this_ptr: CustomOnionMessageHandler) { }
+impl Drop for CustomOnionMessageHandler {
+       fn drop(&mut self) {
+               if let Some(f) = self.free {
+                       f(self.this_arg);
+               }
+       }
+}
 /// Constructs a new `OnionMessenger` to send, forward, and delegate received onion messages to
 /// their respective handlers.
 #[must_use]
 #[no_mangle]
-pub extern "C" fn OnionMessenger_new(mut keys_manager: crate::lightning::chain::keysinterface::KeysInterface, mut logger: crate::lightning::util::logger::Logger) -> crate::lightning::onion_message::messenger::OnionMessenger {
-       let mut ret = lightning::onion_message::messenger::OnionMessenger::new(keys_manager, logger);
+pub extern "C" fn OnionMessenger_new(mut keys_manager: crate::lightning::chain::keysinterface::KeysInterface, mut logger: crate::lightning::util::logger::Logger, mut custom_handler: crate::lightning::onion_message::messenger::CustomOnionMessageHandler) -> crate::lightning::onion_message::messenger::OnionMessenger {
+       let mut ret = lightning::onion_message::messenger::OnionMessenger::new(keys_manager, logger, custom_handler);
        crate::lightning::onion_message::messenger::OnionMessenger { inner: ObjOps::heap_alloc(ret), is_owned: true }
 }
 
-/// Send an empty onion message to `destination`, routing it through `intermediate_nodes`.
+/// Send an onion message with contents `message` to `destination`, routing it through `intermediate_nodes`.
 /// See [`OnionMessenger`] for example usage.
 ///
 /// Note that reply_path (or a relevant inner pointer) may be NULL or all-0s to represent None
 #[must_use]
 #[no_mangle]
-pub extern "C" fn OnionMessenger_send_onion_message(this_arg: &crate::lightning::onion_message::messenger::OnionMessenger, mut intermediate_nodes: crate::c_types::derived::CVec_PublicKeyZ, mut destination: crate::lightning::onion_message::messenger::Destination, mut reply_path: crate::lightning::onion_message::blinded_route::BlindedRoute) -> crate::c_types::derived::CResult_NoneSendErrorZ {
+pub extern "C" fn OnionMessenger_send_custom_onion_message(this_arg: &crate::lightning::onion_message::messenger::OnionMessenger, mut intermediate_nodes: crate::c_types::derived::CVec_PublicKeyZ, mut destination: crate::lightning::onion_message::messenger::Destination, mut msg: crate::lightning::onion_message::packet::CustomOnionMessageContents, mut reply_path: crate::lightning::onion_message::blinded_route::BlindedRoute) -> crate::c_types::derived::CResult_NoneSendErrorZ {
        let mut local_intermediate_nodes = Vec::new(); for mut item in intermediate_nodes.into_rust().drain(..) { local_intermediate_nodes.push( { item.into_rust() }); };
        let mut local_reply_path = if reply_path.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(reply_path.take_inner()) } }) };
-       let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.send_onion_message(&local_intermediate_nodes[..], destination.into_native(), local_reply_path);
+       let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.send_custom_onion_message(&local_intermediate_nodes[..], destination.into_native(), msg, local_reply_path);
        let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::onion_message::messenger::SendError::native_into(e) }).into() };
        local_ret
 }
@@ -347,8 +450,11 @@ pub extern "C" fn OnionMessenger_as_OnionMessageHandler(this_arg: &OnionMessenge
 extern "C" fn OnionMessenger_OnionMessageHandler_handle_onion_message(this_arg: *const c_void, mut peer_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::OnionMessage) {
        <nativeOnionMessenger as lightning::ln::msgs::OnionMessageHandler<>>::handle_onion_message(unsafe { &mut *(this_arg as *mut nativeOnionMessenger) }, &peer_node_id.into_rust(), msg.get_native_ref())
 }
-extern "C" fn OnionMessenger_OnionMessageHandler_peer_connected(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, init: &crate::lightning::ln::msgs::Init) {
-       <nativeOnionMessenger as lightning::ln::msgs::OnionMessageHandler<>>::peer_connected(unsafe { &mut *(this_arg as *mut nativeOnionMessenger) }, &their_node_id.into_rust(), init.get_native_ref())
+#[must_use]
+extern "C" fn OnionMessenger_OnionMessageHandler_peer_connected(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, init: &crate::lightning::ln::msgs::Init) -> crate::c_types::derived::CResult_NoneNoneZ {
+       let mut ret = <nativeOnionMessenger as lightning::ln::msgs::OnionMessageHandler<>>::peer_connected(unsafe { &mut *(this_arg as *mut nativeOnionMessenger) }, &their_node_id.into_rust(), init.get_native_ref());
+       let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() };
+       local_ret
 }
 extern "C" fn OnionMessenger_OnionMessageHandler_peer_disconnected(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, mut no_connection_possible: bool) {
        <nativeOnionMessenger as lightning::ln::msgs::OnionMessageHandler<>>::peer_disconnected(unsafe { &mut *(this_arg as *mut nativeOnionMessenger) }, &their_node_id.into_rust(), no_connection_possible)
index 7def568ad1ea0c3d115ed0172d82726d6828d4e1..90c0238577a3f86ca8d6215f963fb8a2b33b97ba 100644 (file)
@@ -16,3 +16,62 @@ use crate::c_types::*;
 #[cfg(feature="no-std")]
 use alloc::{vec::Vec, boxed::Box};
 
+/// The contents of a custom onion message.
+#[repr(C)]
+pub struct CustomOnionMessageContents {
+       /// An opaque pointer which is passed to your function implementations as an argument.
+       /// This has no meaning in the LDK, and can be NULL or any other value.
+       pub this_arg: *mut c_void,
+       /// Returns the TLV type identifying the message contents. MUST be >= 64.
+       #[must_use]
+       pub tlv_type: extern "C" fn (this_arg: *const c_void) -> u64,
+       /// Serialize the object into a byte array
+       pub write: extern "C" fn (this_arg: *const c_void) -> crate::c_types::derived::CVec_u8Z,
+       /// Frees any resources associated with this object given its this_arg pointer.
+       /// Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+       pub free: Option<extern "C" fn(this_arg: *mut c_void)>,
+}
+unsafe impl Send for CustomOnionMessageContents {}
+unsafe impl Sync for CustomOnionMessageContents {}
+#[no_mangle]
+pub(crate) extern "C" fn CustomOnionMessageContents_clone_fields(orig: &CustomOnionMessageContents) -> CustomOnionMessageContents {
+       CustomOnionMessageContents {
+               this_arg: orig.this_arg,
+               tlv_type: Clone::clone(&orig.tlv_type),
+               write: Clone::clone(&orig.write),
+               free: Clone::clone(&orig.free),
+       }
+}
+impl lightning::util::ser::Writeable for CustomOnionMessageContents {
+       fn write<W: lightning::util::ser::Writer>(&self, w: &mut W) -> Result<(), crate::c_types::io::Error> {
+               let vec = (self.write)(self.this_arg);
+               w.write_all(vec.as_slice())
+       }
+}
+
+use lightning::onion_message::packet::CustomOnionMessageContents as rustCustomOnionMessageContents;
+impl rustCustomOnionMessageContents for CustomOnionMessageContents {
+       fn tlv_type(&self) -> u64 {
+               let mut ret = (self.tlv_type)(self.this_arg);
+               ret
+       }
+}
+
+// We're essentially a pointer already, or at least a set of pointers, so allow us to be used
+// directly as a Deref trait in higher-level structs:
+impl core::ops::Deref for CustomOnionMessageContents {
+       type Target = Self;
+       fn deref(&self) -> &Self {
+               self
+       }
+}
+/// Calls the free function if one is set
+#[no_mangle]
+pub extern "C" fn CustomOnionMessageContents_free(this_ptr: CustomOnionMessageContents) { }
+impl Drop for CustomOnionMessageContents {
+       fn drop(&mut self) {
+               if let Some(f) = self.free {
+                       f(self.this_arg);
+               }
+       }
+}
index 7587e8e066007d6dec613d8924454ce3460e4fd6..3a7943bd28aa0041f20b3b71f4264146bf52e08d 100644 (file)
@@ -126,7 +126,7 @@ pub(crate) extern "C" fn NodeId_write_void(obj: *const c_void) -> crate::c_types
 /// Read a NodeId from a byte array, created by NodeId_write
 pub extern "C" fn NodeId_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_NodeIdDecodeErrorZ {
        let res: Result<lightning::routing::gossip::NodeId, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::gossip::NodeId { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::gossip::NodeId { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 
@@ -255,7 +255,7 @@ pub enum NetworkUpdate {
                is_permanent: bool,
        },
        /// An error indicating that a node failed to route a payment, which should be applied via
-       /// [`NetworkGraph::node_failed`].
+       /// [`NetworkGraph::node_failed_permanent`] if permanent.
        NodeFailure {
                /// The node id of the failed node.
                node_id: crate::c_types::PublicKey,
@@ -398,6 +398,12 @@ pub extern "C" fn NetworkUpdate_node_failure(node_id: crate::c_types::PublicKey,
                is_permanent,
        }
 }
+/// Checks if two NetworkUpdates contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+#[no_mangle]
+pub extern "C" fn NetworkUpdate_eq(a: &NetworkUpdate, b: &NetworkUpdate) -> bool {
+       if &a.to_native() == &b.to_native() { true } else { false }
+}
 #[no_mangle]
 /// Serialize the NetworkUpdate object into a byte array which can be read by NetworkUpdate_read
 pub extern "C" fn NetworkUpdate_write(obj: &crate::lightning::routing::gossip::NetworkUpdate) -> crate::c_types::derived::CVec_u8Z {
@@ -407,7 +413,7 @@ pub extern "C" fn NetworkUpdate_write(obj: &crate::lightning::routing::gossip::N
 /// Read a NetworkUpdate from a byte array, created by NetworkUpdate_write
 pub extern "C" fn NetworkUpdate_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_COption_NetworkUpdateZDecodeErrorZ {
        let res: Result<Option<lightning::routing::gossip::NetworkUpdate>, lightning::ln::msgs::DecodeError> = crate::c_types::maybe_deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { let mut local_res_0 = if o.is_none() { crate::c_types::derived::COption_NetworkUpdateZ::None } else { crate::c_types::derived::COption_NetworkUpdateZ::Some( { crate::lightning::routing::gossip::NetworkUpdate::native_into(o.unwrap()) }) }; local_res_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { let mut local_res_0 = if o.is_none() { crate::c_types::derived::COption_NetworkUpdateZ::None } else { crate::c_types::derived::COption_NetworkUpdateZ::Some( { crate::lightning::routing::gossip::NetworkUpdate::native_into(o.unwrap()) }) }; local_res_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 
@@ -583,8 +589,11 @@ extern "C" fn P2PGossipSync_RoutingMessageHandler_get_next_node_announcement(thi
        let mut local_ret = crate::lightning::ln::msgs::NodeAnnouncement { inner: if ret.is_none() { core::ptr::null_mut() } else {  { ObjOps::heap_alloc((ret.unwrap())) } }, is_owned: true };
        local_ret
 }
-extern "C" fn P2PGossipSync_RoutingMessageHandler_peer_connected(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, init: &crate::lightning::ln::msgs::Init) {
-       <nativeP2PGossipSync as lightning::ln::msgs::RoutingMessageHandler<>>::peer_connected(unsafe { &mut *(this_arg as *mut nativeP2PGossipSync) }, &their_node_id.into_rust(), init.get_native_ref())
+#[must_use]
+extern "C" fn P2PGossipSync_RoutingMessageHandler_peer_connected(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, init: &crate::lightning::ln::msgs::Init) -> crate::c_types::derived::CResult_NoneNoneZ {
+       let mut ret = <nativeP2PGossipSync as lightning::ln::msgs::RoutingMessageHandler<>>::peer_connected(unsafe { &mut *(this_arg as *mut nativeP2PGossipSync) }, &their_node_id.into_rust(), init.get_native_ref());
+       let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() };
+       local_ret
 }
 #[must_use]
 extern "C" fn P2PGossipSync_RoutingMessageHandler_handle_reply_channel_range(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, mut msg: crate::lightning::ln::msgs::ReplyChannelRange) -> crate::c_types::derived::CResult_NoneLightningErrorZ {
@@ -825,6 +834,15 @@ pub(crate) extern "C" fn ChannelUpdateInfo_clone_void(this_ptr: *const c_void) -
 pub extern "C" fn ChannelUpdateInfo_clone(orig: &ChannelUpdateInfo) -> ChannelUpdateInfo {
        orig.clone()
 }
+/// Checks if two ChannelUpdateInfos contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn ChannelUpdateInfo_eq(a: &ChannelUpdateInfo, b: &ChannelUpdateInfo) -> bool {
+       if a.inner == b.inner { return true; }
+       if a.inner.is_null() || b.inner.is_null() { return false; }
+       if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
 #[no_mangle]
 /// Serialize the ChannelUpdateInfo object into a byte array which can be read by ChannelUpdateInfo_read
 pub extern "C" fn ChannelUpdateInfo_write(obj: &crate::lightning::routing::gossip::ChannelUpdateInfo) -> crate::c_types::derived::CVec_u8Z {
@@ -838,7 +856,7 @@ pub(crate) extern "C" fn ChannelUpdateInfo_write_void(obj: *const c_void) -> cra
 /// Read a ChannelUpdateInfo from a byte array, created by ChannelUpdateInfo_write
 pub extern "C" fn ChannelUpdateInfo_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelUpdateInfoDecodeErrorZ {
        let res: Result<lightning::routing::gossip::ChannelUpdateInfo, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::gossip::ChannelUpdateInfo { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::gossip::ChannelUpdateInfo { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 
@@ -1015,6 +1033,15 @@ pub(crate) extern "C" fn ChannelInfo_clone_void(this_ptr: *const c_void) -> *mut
 pub extern "C" fn ChannelInfo_clone(orig: &ChannelInfo) -> ChannelInfo {
        orig.clone()
 }
+/// Checks if two ChannelInfos contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn ChannelInfo_eq(a: &ChannelInfo, b: &ChannelInfo) -> bool {
+       if a.inner == b.inner { return true; }
+       if a.inner.is_null() || b.inner.is_null() { return false; }
+       if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
 /// Returns a [`ChannelUpdateInfo`] based on the direction implied by the channel_flag.
 ///
 /// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
@@ -1039,7 +1066,7 @@ pub(crate) extern "C" fn ChannelInfo_write_void(obj: *const c_void) -> crate::c_
 /// Read a ChannelInfo from a byte array, created by ChannelInfo_write
 pub extern "C" fn ChannelInfo_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelInfoDecodeErrorZ {
        let res: Result<lightning::routing::gossip::ChannelInfo, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::gossip::ChannelInfo { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::gossip::ChannelInfo { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 
@@ -1481,7 +1508,7 @@ pub(crate) extern "C" fn RoutingFees_write_void(obj: *const c_void) -> crate::c_
 /// Read a RoutingFees from a byte array, created by RoutingFees_write
 pub extern "C" fn RoutingFees_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_RoutingFeesDecodeErrorZ {
        let res: Result<lightning::routing::gossip::RoutingFees, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::gossip::RoutingFees { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::gossip::RoutingFees { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 
@@ -1657,6 +1684,15 @@ pub(crate) extern "C" fn NodeAnnouncementInfo_clone_void(this_ptr: *const c_void
 pub extern "C" fn NodeAnnouncementInfo_clone(orig: &NodeAnnouncementInfo) -> NodeAnnouncementInfo {
        orig.clone()
 }
+/// Checks if two NodeAnnouncementInfos contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn NodeAnnouncementInfo_eq(a: &NodeAnnouncementInfo, b: &NodeAnnouncementInfo) -> bool {
+       if a.inner == b.inner { return true; }
+       if a.inner.is_null() || b.inner.is_null() { return false; }
+       if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
 #[no_mangle]
 /// Serialize the NodeAnnouncementInfo object into a byte array which can be read by NodeAnnouncementInfo_read
 pub extern "C" fn NodeAnnouncementInfo_write(obj: &crate::lightning::routing::gossip::NodeAnnouncementInfo) -> crate::c_types::derived::CVec_u8Z {
@@ -1670,7 +1706,7 @@ pub(crate) extern "C" fn NodeAnnouncementInfo_write_void(obj: *const c_void) ->
 /// Read a NodeAnnouncementInfo from a byte array, created by NodeAnnouncementInfo_write
 pub extern "C" fn NodeAnnouncementInfo_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_NodeAnnouncementInfoDecodeErrorZ {
        let res: Result<lightning::routing::gossip::NodeAnnouncementInfo, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::gossip::NodeAnnouncementInfo { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::gossip::NodeAnnouncementInfo { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 
@@ -1763,6 +1799,15 @@ pub(crate) extern "C" fn NodeAlias_clone_void(this_ptr: *const c_void) -> *mut c
 pub extern "C" fn NodeAlias_clone(orig: &NodeAlias) -> NodeAlias {
        orig.clone()
 }
+/// Checks if two NodeAliass contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn NodeAlias_eq(a: &NodeAlias, b: &NodeAlias) -> bool {
+       if a.inner == b.inner { return true; }
+       if a.inner.is_null() || b.inner.is_null() { return false; }
+       if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
 #[no_mangle]
 /// Serialize the NodeAlias object into a byte array which can be read by NodeAlias_read
 pub extern "C" fn NodeAlias_write(obj: &crate::lightning::routing::gossip::NodeAlias) -> crate::c_types::derived::CVec_u8Z {
@@ -1776,7 +1821,7 @@ pub(crate) extern "C" fn NodeAlias_write_void(obj: *const c_void) -> crate::c_ty
 /// Read a NodeAlias from a byte array, created by NodeAlias_write
 pub extern "C" fn NodeAlias_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_NodeAliasDecodeErrorZ {
        let res: Result<lightning::routing::gossip::NodeAlias, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::gossip::NodeAlias { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::gossip::NodeAlias { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 
@@ -1919,6 +1964,15 @@ pub(crate) extern "C" fn NodeInfo_clone_void(this_ptr: *const c_void) -> *mut c_
 pub extern "C" fn NodeInfo_clone(orig: &NodeInfo) -> NodeInfo {
        orig.clone()
 }
+/// Checks if two NodeInfos contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn NodeInfo_eq(a: &NodeInfo, b: &NodeInfo) -> bool {
+       if a.inner == b.inner { return true; }
+       if a.inner.is_null() || b.inner.is_null() { return false; }
+       if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
 #[no_mangle]
 /// Serialize the NodeInfo object into a byte array which can be read by NodeInfo_read
 pub extern "C" fn NodeInfo_write(obj: &crate::lightning::routing::gossip::NodeInfo) -> crate::c_types::derived::CVec_u8Z {
@@ -1932,7 +1986,7 @@ pub(crate) extern "C" fn NodeInfo_write_void(obj: *const c_void) -> crate::c_typ
 /// Read a NodeInfo from a byte array, created by NodeInfo_write
 pub extern "C" fn NodeInfo_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_NodeInfoDecodeErrorZ {
        let res: Result<lightning::routing::gossip::NodeInfo, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::gossip::NodeInfo { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::gossip::NodeInfo { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 #[no_mangle]
@@ -1949,7 +2003,7 @@ pub(crate) extern "C" fn NetworkGraph_write_void(obj: *const c_void) -> crate::c
 pub extern "C" fn NetworkGraph_read(ser: crate::c_types::u8slice, arg: crate::lightning::util::logger::Logger) -> crate::c_types::derived::CResult_NetworkGraphDecodeErrorZ {
        let arg_conv = arg;
        let res: Result<lightning::routing::gossip::NetworkGraph<crate::lightning::util::logger::Logger>, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj_arg(ser, arg_conv);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::gossip::NetworkGraph { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::gossip::NetworkGraph { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 /// Creates a new, empty, network graph.
@@ -2066,10 +2120,11 @@ pub extern "C" fn NetworkGraph_channel_failed(this_arg: &crate::lightning::routi
        unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.channel_failed(short_channel_id, is_permanent)
 }
 
-/// Marks a node in the graph as failed.
+/// Marks a node in the graph as permanently failed, effectively removing it and its channels
+/// from local storage.
 #[no_mangle]
-pub extern "C" fn NetworkGraph_node_failed(this_arg: &crate::lightning::routing::gossip::NetworkGraph, mut _node_id: crate::c_types::PublicKey, mut is_permanent: bool) {
-       unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.node_failed(&_node_id.into_rust(), is_permanent)
+pub extern "C" fn NetworkGraph_node_failed_permanent(this_arg: &crate::lightning::routing::gossip::NetworkGraph, mut node_id: crate::c_types::PublicKey) {
+       unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.node_failed_permanent(&node_id.into_rust())
 }
 
 /// Removes information about channels that we haven't heard any updates about in some time.
@@ -2083,11 +2138,14 @@ pub extern "C" fn NetworkGraph_node_failed(this_arg: &crate::lightning::routing:
 /// Note that for users of the `lightning-background-processor` crate this method may be
 /// automatically called regularly for you.
 ///
+/// This method will also cause us to stop tracking removed nodes and channels if they have been
+/// in the map for a while so that these can be resynced from gossip in the future.
+///
 /// This method is only available with the `std` feature. See
-/// [`NetworkGraph::remove_stale_channels_with_time`] for `no-std` use.
+/// [`NetworkGraph::remove_stale_channels_and_tracking_with_time`] for `no-std` use.
 #[no_mangle]
-pub extern "C" fn NetworkGraph_remove_stale_channels(this_arg: &crate::lightning::routing::gossip::NetworkGraph) {
-       unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.remove_stale_channels()
+pub extern "C" fn NetworkGraph_remove_stale_channels_and_tracking(this_arg: &crate::lightning::routing::gossip::NetworkGraph) {
+       unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.remove_stale_channels_and_tracking()
 }
 
 /// Removes information about channels that we haven't heard any updates about in some time.
@@ -2098,11 +2156,14 @@ pub extern "C" fn NetworkGraph_remove_stale_channels(this_arg: &crate::lightning
 /// updates every two weeks, the non-normative section of BOLT 7 currently suggests that
 /// pruning occur for updates which are at least two weeks old, which we implement here.
 ///
+/// This method will also cause us to stop tracking removed nodes and channels if they have been
+/// in the map for a while so that these can be resynced from gossip in the future.
+///
 /// This function takes the current unix time as an argument. For users with the `std` feature
-/// enabled, [`NetworkGraph::remove_stale_channels`] may be preferable.
+/// enabled, [`NetworkGraph::remove_stale_channels_and_tracking`] may be preferable.
 #[no_mangle]
-pub extern "C" fn NetworkGraph_remove_stale_channels_with_time(this_arg: &crate::lightning::routing::gossip::NetworkGraph, mut current_time_unix: u64) {
-       unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.remove_stale_channels_with_time(current_time_unix)
+pub extern "C" fn NetworkGraph_remove_stale_channels_and_tracking_with_time(this_arg: &crate::lightning::routing::gossip::NetworkGraph, mut current_time_unix: u64) {
+       unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.remove_stale_channels_and_tracking_with_time(current_time_unix)
 }
 
 /// For an already known (from announcement) channel, update info about one of the directions
index 8c129955aefcb81df3438189bfb38fc03a8b95db..afab2a071710e04c00e213162fdfda24639ce54c 100644 (file)
@@ -210,7 +210,7 @@ pub(crate) extern "C" fn RouteHop_write_void(obj: *const c_void) -> crate::c_typ
 /// Read a RouteHop from a byte array, created by RouteHop_write
 pub extern "C" fn RouteHop_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_RouteHopDecodeErrorZ {
        let res: Result<lightning::routing::router::RouteHop, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::router::RouteHop { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::router::RouteHop { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 
@@ -392,7 +392,7 @@ pub(crate) extern "C" fn Route_write_void(obj: *const c_void) -> crate::c_types:
 /// Read a Route from a byte array, created by Route_write
 pub extern "C" fn Route_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_RouteDecodeErrorZ {
        let res: Result<lightning::routing::router::Route, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::router::Route { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::router::Route { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 
@@ -526,7 +526,7 @@ pub(crate) extern "C" fn RouteParameters_write_void(obj: *const c_void) -> crate
 /// Read a RouteParameters from a byte array, created by RouteParameters_write
 pub extern "C" fn RouteParameters_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_RouteParametersDecodeErrorZ {
        let res: Result<lightning::routing::router::RouteParameters, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::router::RouteParameters { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::router::RouteParameters { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 /// Maximum total CTLV difference we allow for a full payment path.
@@ -802,7 +802,7 @@ pub(crate) extern "C" fn PaymentParameters_write_void(obj: *const c_void) -> cra
 /// Read a PaymentParameters from a byte array, created by PaymentParameters_write
 pub extern "C" fn PaymentParameters_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_PaymentParametersDecodeErrorZ {
        let res: Result<lightning::routing::router::PaymentParameters, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::router::PaymentParameters { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::router::PaymentParameters { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 /// Creates a payee with the node id of the given `pubkey`.
@@ -943,7 +943,7 @@ pub(crate) extern "C" fn RouteHint_write_void(obj: *const c_void) -> crate::c_ty
 /// Read a RouteHint from a byte array, created by RouteHint_write
 pub extern "C" fn RouteHint_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_RouteHintDecodeErrorZ {
        let res: Result<lightning::routing::router::RouteHint, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::router::RouteHint { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::router::RouteHint { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 
@@ -1133,7 +1133,7 @@ pub(crate) extern "C" fn RouteHintHop_write_void(obj: *const c_void) -> crate::c
 /// Read a RouteHintHop from a byte array, created by RouteHintHop_write
 pub extern "C" fn RouteHintHop_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_RouteHintHopDecodeErrorZ {
        let res: Result<lightning::routing::router::RouteHintHop, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::router::RouteHintHop { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::router::RouteHintHop { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 /// Finds a route from us (payer) to the given target node (payee).
index 11db1982d834c4f7d8655ebbc9c4da4e2d0e3d44..3a3ad98848649fd512d4158970c08acb98eae1fb 100644 (file)
@@ -465,6 +465,42 @@ extern "C" fn MultiThreadedLockableScore_LockableScore_lock(this_arg: *const c_v
        Into::into(ret)
 }
 
+#[no_mangle]
+/// Serialize the MultiThreadedLockableScore object into a byte array which can be read by MultiThreadedLockableScore_read
+pub extern "C" fn MultiThreadedLockableScore_write(obj: &crate::lightning::routing::scoring::MultiThreadedLockableScore) -> crate::c_types::derived::CVec_u8Z {
+       crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
+}
+#[no_mangle]
+pub(crate) extern "C" fn MultiThreadedLockableScore_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
+       crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeMultiThreadedLockableScore) })
+}
+impl From<nativeMultiThreadedLockableScore> for crate::lightning::routing::scoring::WriteableScore {
+       fn from(obj: nativeMultiThreadedLockableScore) -> Self {
+               let mut rust_obj = MultiThreadedLockableScore { inner: ObjOps::heap_alloc(obj), is_owned: true };
+               let mut ret = MultiThreadedLockableScore_as_WriteableScore(&rust_obj);
+               // We want to free rust_obj when ret gets drop()'d, not rust_obj, so wipe rust_obj's pointer and set ret's free() fn
+               rust_obj.inner = core::ptr::null_mut();
+               ret.free = Some(MultiThreadedLockableScore_free_void);
+               ret
+       }
+}
+/// Constructs a new WriteableScore which calls the relevant methods on this_arg.
+/// This copies the `inner` pointer in this_arg and thus the returned WriteableScore must be freed before this_arg is
+#[no_mangle]
+pub extern "C" fn MultiThreadedLockableScore_as_WriteableScore(this_arg: &MultiThreadedLockableScore) -> crate::lightning::routing::scoring::WriteableScore {
+       crate::lightning::routing::scoring::WriteableScore {
+               this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void },
+               free: None,
+               LockableScore: crate::lightning::routing::scoring::LockableScore {
+                       this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void },
+                       free: None,
+                       lock: MultiThreadedLockableScore_LockableScore_lock,
+               },
+               write: MultiThreadedLockableScore_write_void,
+       }
+}
+
+
 /// Creates a new [`MultiThreadedLockableScore`] given an underlying [`Score`].
 #[must_use]
 #[no_mangle]
@@ -728,7 +764,7 @@ pub(crate) extern "C" fn FixedPenaltyScorer_write_void(obj: *const c_void) -> cr
 pub extern "C" fn FixedPenaltyScorer_read(ser: crate::c_types::u8slice, arg: u64) -> crate::c_types::derived::CResult_FixedPenaltyScorerDecodeErrorZ {
        let arg_conv = arg;
        let res: Result<lightning::routing::scoring::FixedPenaltyScorer, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj_arg(ser, arg_conv);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::scoring::FixedPenaltyScorer { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::scoring::FixedPenaltyScorer { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 
@@ -737,19 +773,28 @@ pub(crate) type nativeProbabilisticScorer = nativeProbabilisticScorerImport<&'st
 
 /// [`Score`] implementation using channel success probability distributions.
 ///
-/// Based on *Optimally Reliable & Cheap Payment Flows on the Lightning Network* by Rene Pickhardt
-/// and Stefan Richter [[1]]. Given the uncertainty of channel liquidity balances, probability
-/// distributions are defined based on knowledge learned from successful and unsuccessful attempts.
-/// Then the negative `log10` of the success probability is used to determine the cost of routing a
-/// specific HTLC amount through a channel.
+/// Channels are tracked with upper and lower liquidity bounds - when an HTLC fails at a channel,
+/// we learn that the upper-bound on the available liquidity is lower than the amount of the HTLC.
+/// When a payment is forwarded through a channel (but fails later in the route), we learn the
+/// lower-bound on the channel's available liquidity must be at least the value of the HTLC.
+///
+/// These bounds are then used to determine a success probability using the formula from
+/// *Optimally Reliable & Cheap Payment Flows on the Lightning Network* by Rene Pickhardt
+/// and Stefan Richter [[1]] (i.e. `(upper_bound - payment_amount) / (upper_bound - lower_bound)`).
 ///
-/// Knowledge about channel liquidity balances takes the form of upper and lower bounds on the
-/// possible liquidity. Certainty of the bounds is decreased over time using a decay function. See
-/// [`ProbabilisticScoringParameters`] for details.
+/// This probability is combined with the [`liquidity_penalty_multiplier_msat`] and
+/// [`liquidity_penalty_amount_multiplier_msat`] parameters to calculate a concrete penalty in
+/// milli-satoshis. The penalties, when added across all hops, have the property of being linear in
+/// terms of the entire path's success probability. This allows the router to directly compare
+/// penalties for different paths. See the documentation of those parameters for the exact formulas.
 ///
-/// Since the scorer aims to learn the current channel liquidity balances, it works best for nodes
-/// with high payment volume or that actively probe the [`NetworkGraph`]. Nodes with low payment
-/// volume are more likely to experience failed payment paths, which would need to be retried.
+/// The liquidity bounds are decayed by halving them every [`liquidity_offset_half_life`].
+///
+/// Further, we track the history of our upper and lower liquidity bounds for each channel,
+/// allowing us to assign a second penalty (using [`historical_liquidity_penalty_multiplier_msat`]
+/// and [`historical_liquidity_penalty_amount_multiplier_msat`]) based on the same probability
+/// formula, but using the history of a channel rather than our latest estimates for the liquidity
+/// bounds.
 ///
 /// # Note
 ///
@@ -757,6 +802,11 @@ pub(crate) type nativeProbabilisticScorer = nativeProbabilisticScorerImport<&'st
 /// behavior.
 ///
 /// [1]: https://arxiv.org/abs/2107.05322
+/// [`liquidity_penalty_multiplier_msat`]: ProbabilisticScoringParameters::liquidity_penalty_multiplier_msat
+/// [`liquidity_penalty_amount_multiplier_msat`]: ProbabilisticScoringParameters::liquidity_penalty_amount_multiplier_msat
+/// [`liquidity_offset_half_life`]: ProbabilisticScoringParameters::liquidity_offset_half_life
+/// [`historical_liquidity_penalty_multiplier_msat`]: ProbabilisticScoringParameters::historical_liquidity_penalty_multiplier_msat
+/// [`historical_liquidity_penalty_amount_multiplier_msat`]: ProbabilisticScoringParameters::historical_liquidity_penalty_amount_multiplier_msat
 #[must_use]
 #[repr(C)]
 pub struct ProbabilisticScorer {
@@ -909,7 +959,8 @@ pub extern "C" fn ProbabilisticScoringParameters_set_base_penalty_amount_multipl
        unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.base_penalty_amount_multiplier_msat = val;
 }
 /// A multiplier used in conjunction with the negative `log10` of the channel's success
-/// probability for a payment to determine the liquidity penalty.
+/// probability for a payment, as determined by our latest estimates of the channel's
+/// liquidity, to determine the liquidity penalty.
 ///
 /// The penalty is based in part on the knowledge learned from prior successful and unsuccessful
 /// payments. This knowledge is decayed over time based on [`liquidity_offset_half_life`]. The
@@ -918,7 +969,9 @@ pub extern "C" fn ProbabilisticScoringParameters_set_base_penalty_amount_multipl
 /// uncertainty bounds of the channel liquidity balance. Amounts above the upper bound will
 /// result in a `u64::max_value` penalty, however.
 ///
-/// Default value: 40,000 msat
+/// `-log10(success_probability) * liquidity_penalty_multiplier_msat`
+///
+/// Default value: 30,000 msat
 ///
 /// [`liquidity_offset_half_life`]: Self::liquidity_offset_half_life
 #[no_mangle]
@@ -927,7 +980,8 @@ pub extern "C" fn ProbabilisticScoringParameters_get_liquidity_penalty_multiplie
        *inner_val
 }
 /// A multiplier used in conjunction with the negative `log10` of the channel's success
-/// probability for a payment to determine the liquidity penalty.
+/// probability for a payment, as determined by our latest estimates of the channel's
+/// liquidity, to determine the liquidity penalty.
 ///
 /// The penalty is based in part on the knowledge learned from prior successful and unsuccessful
 /// payments. This knowledge is decayed over time based on [`liquidity_offset_half_life`]. The
@@ -936,21 +990,29 @@ pub extern "C" fn ProbabilisticScoringParameters_get_liquidity_penalty_multiplie
 /// uncertainty bounds of the channel liquidity balance. Amounts above the upper bound will
 /// result in a `u64::max_value` penalty, however.
 ///
-/// Default value: 40,000 msat
+/// `-log10(success_probability) * liquidity_penalty_multiplier_msat`
+///
+/// Default value: 30,000 msat
 ///
 /// [`liquidity_offset_half_life`]: Self::liquidity_offset_half_life
 #[no_mangle]
 pub extern "C" fn ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(this_ptr: &mut ProbabilisticScoringParameters, mut val: u64) {
        unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.liquidity_penalty_multiplier_msat = val;
 }
-/// The time required to elapse before any knowledge learned about channel liquidity balances is
-/// cut in half.
+/// Whenever this amount of time elapses since the last update to a channel's liquidity bounds,
+/// the distance from the bounds to \"zero\" is cut in half. In other words, the lower-bound on
+/// the available liquidity is halved and the upper-bound moves half-way to the channel's total
+/// capacity.
+///
+/// Because halving the liquidity bounds grows the uncertainty on the channel's liquidity,
+/// the penalty for an amount within the new bounds may change. See the [`ProbabilisticScorer`]
+/// struct documentation for more info on the way the liquidity bounds are used.
 ///
-/// The bounds are defined in terms of offsets and are initially zero. Increasing the offsets
-/// gives tighter bounds on the channel liquidity balance. Thus, halving the offsets decreases
-/// the certainty of the channel liquidity balance.
+/// For example, if the channel's capacity is 1 million sats, and the current upper and lower
+/// liquidity bounds are 200,000 sats and 600,000 sats, after this amount of time the upper
+/// and lower liquidity bounds will be decayed to 100,000 and 800,000 sats.
 ///
-/// Default value: 1 hour
+/// Default value: 6 hours
 ///
 /// # Note
 ///
@@ -961,14 +1023,20 @@ pub extern "C" fn ProbabilisticScoringParameters_get_liquidity_offset_half_life(
        let mut inner_val = &mut this_ptr.get_native_mut_ref().liquidity_offset_half_life;
        inner_val.as_secs()
 }
-/// The time required to elapse before any knowledge learned about channel liquidity balances is
-/// cut in half.
+/// Whenever this amount of time elapses since the last update to a channel's liquidity bounds,
+/// the distance from the bounds to \"zero\" is cut in half. In other words, the lower-bound on
+/// the available liquidity is halved and the upper-bound moves half-way to the channel's total
+/// capacity.
 ///
-/// The bounds are defined in terms of offsets and are initially zero. Increasing the offsets
-/// gives tighter bounds on the channel liquidity balance. Thus, halving the offsets decreases
-/// the certainty of the channel liquidity balance.
+/// Because halving the liquidity bounds grows the uncertainty on the channel's liquidity,
+/// the penalty for an amount within the new bounds may change. See the [`ProbabilisticScorer`]
+/// struct documentation for more info on the way the liquidity bounds are used.
 ///
-/// Default value: 1 hour
+/// For example, if the channel's capacity is 1 million sats, and the current upper and lower
+/// liquidity bounds are 200,000 sats and 600,000 sats, after this amount of time the upper
+/// and lower liquidity bounds will be decayed to 100,000 and 800,000 sats.
+///
+/// Default value: 6 hours
 ///
 /// # Note
 ///
@@ -979,7 +1047,8 @@ pub extern "C" fn ProbabilisticScoringParameters_set_liquidity_offset_half_life(
        unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.liquidity_offset_half_life = core::time::Duration::from_secs(val);
 }
 /// A multiplier used in conjunction with a payment amount and the negative `log10` of the
-/// channel's success probability for the payment to determine the amount penalty.
+/// channel's success probability for the payment, as determined by our latest estimates of the
+/// channel's liquidity, to determine the amount penalty.
 ///
 /// The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e.,
 /// fees plus penalty) for large payments. The penalty is computed as the product of this
@@ -994,14 +1063,15 @@ pub extern "C" fn ProbabilisticScoringParameters_set_liquidity_offset_half_life(
 /// probabilities, the multiplier will have a decreasing effect as the negative `log10` will
 /// fall below `1`.
 ///
-/// Default value: 256 msat
+/// Default value: 192 msat
 #[no_mangle]
 pub extern "C" fn ProbabilisticScoringParameters_get_liquidity_penalty_amount_multiplier_msat(this_ptr: &ProbabilisticScoringParameters) -> u64 {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().liquidity_penalty_amount_multiplier_msat;
        *inner_val
 }
 /// A multiplier used in conjunction with a payment amount and the negative `log10` of the
-/// channel's success probability for the payment to determine the amount penalty.
+/// channel's success probability for the payment, as determined by our latest estimates of the
+/// channel's liquidity, to determine the amount penalty.
 ///
 /// The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e.,
 /// fees plus penalty) for large payments. The penalty is computed as the product of this
@@ -1016,11 +1086,118 @@ pub extern "C" fn ProbabilisticScoringParameters_get_liquidity_penalty_amount_mu
 /// probabilities, the multiplier will have a decreasing effect as the negative `log10` will
 /// fall below `1`.
 ///
-/// Default value: 256 msat
+/// Default value: 192 msat
 #[no_mangle]
 pub extern "C" fn ProbabilisticScoringParameters_set_liquidity_penalty_amount_multiplier_msat(this_ptr: &mut ProbabilisticScoringParameters, mut val: u64) {
        unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.liquidity_penalty_amount_multiplier_msat = val;
 }
+/// A multiplier used in conjunction with the negative `log10` of the channel's success
+/// probability for the payment, as determined based on the history of our estimates of the
+/// channel's available liquidity, to determine a penalty.
+///
+/// This penalty is similar to [`liquidity_penalty_multiplier_msat`], however, instead of using
+/// only our latest estimate for the current liquidity available in the channel, it estimates
+/// success probability based on the estimated liquidity available in the channel through
+/// history. Specifically, every time we update our liquidity bounds on a given channel, we
+/// track which of several buckets those bounds fall into, exponentially decaying the
+/// probability of each bucket as new samples are added.
+///
+/// Default value: 10,000 msat
+///
+/// [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat
+#[no_mangle]
+pub extern "C" fn ProbabilisticScoringParameters_get_historical_liquidity_penalty_multiplier_msat(this_ptr: &ProbabilisticScoringParameters) -> u64 {
+       let mut inner_val = &mut this_ptr.get_native_mut_ref().historical_liquidity_penalty_multiplier_msat;
+       *inner_val
+}
+/// A multiplier used in conjunction with the negative `log10` of the channel's success
+/// probability for the payment, as determined based on the history of our estimates of the
+/// channel's available liquidity, to determine a penalty.
+///
+/// This penalty is similar to [`liquidity_penalty_multiplier_msat`], however, instead of using
+/// only our latest estimate for the current liquidity available in the channel, it estimates
+/// success probability based on the estimated liquidity available in the channel through
+/// history. Specifically, every time we update our liquidity bounds on a given channel, we
+/// track which of several buckets those bounds fall into, exponentially decaying the
+/// probability of each bucket as new samples are added.
+///
+/// Default value: 10,000 msat
+///
+/// [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat
+#[no_mangle]
+pub extern "C" fn ProbabilisticScoringParameters_set_historical_liquidity_penalty_multiplier_msat(this_ptr: &mut ProbabilisticScoringParameters, mut val: u64) {
+       unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.historical_liquidity_penalty_multiplier_msat = val;
+}
+/// A multiplier used in conjunction with the payment amount and the negative `log10` of the
+/// channel's success probability for the payment, as determined based on the history of our
+/// estimates of the channel's available liquidity, to determine a penalty.
+///
+/// The purpose of the amount penalty is to avoid having fees dominate the channel cost for
+/// large payments. The penalty is computed as the product of this multiplier and the `2^20`ths
+/// of the payment amount, weighted by the negative `log10` of the success probability.
+///
+/// This penalty is similar to [`liquidity_penalty_amount_multiplier_msat`], however, instead
+/// of using only our latest estimate for the current liquidity available in the channel, it
+/// estimates success probability based on the estimated liquidity available in the channel
+/// through history. Specifically, every time we update our liquidity bounds on a given
+/// channel, we track which of several buckets those bounds fall into, exponentially decaying
+/// the probability of each bucket as new samples are added.
+///
+/// Default value: 64 msat
+///
+/// [`liquidity_penalty_amount_multiplier_msat`]: Self::liquidity_penalty_amount_multiplier_msat
+#[no_mangle]
+pub extern "C" fn ProbabilisticScoringParameters_get_historical_liquidity_penalty_amount_multiplier_msat(this_ptr: &ProbabilisticScoringParameters) -> u64 {
+       let mut inner_val = &mut this_ptr.get_native_mut_ref().historical_liquidity_penalty_amount_multiplier_msat;
+       *inner_val
+}
+/// A multiplier used in conjunction with the payment amount and the negative `log10` of the
+/// channel's success probability for the payment, as determined based on the history of our
+/// estimates of the channel's available liquidity, to determine a penalty.
+///
+/// The purpose of the amount penalty is to avoid having fees dominate the channel cost for
+/// large payments. The penalty is computed as the product of this multiplier and the `2^20`ths
+/// of the payment amount, weighted by the negative `log10` of the success probability.
+///
+/// This penalty is similar to [`liquidity_penalty_amount_multiplier_msat`], however, instead
+/// of using only our latest estimate for the current liquidity available in the channel, it
+/// estimates success probability based on the estimated liquidity available in the channel
+/// through history. Specifically, every time we update our liquidity bounds on a given
+/// channel, we track which of several buckets those bounds fall into, exponentially decaying
+/// the probability of each bucket as new samples are added.
+///
+/// Default value: 64 msat
+///
+/// [`liquidity_penalty_amount_multiplier_msat`]: Self::liquidity_penalty_amount_multiplier_msat
+#[no_mangle]
+pub extern "C" fn ProbabilisticScoringParameters_set_historical_liquidity_penalty_amount_multiplier_msat(this_ptr: &mut ProbabilisticScoringParameters, mut val: u64) {
+       unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.historical_liquidity_penalty_amount_multiplier_msat = val;
+}
+/// If we aren't learning any new datapoints for a channel, the historical liquidity bounds
+/// tracking can simply live on with increasingly stale data. Instead, when a channel has not
+/// seen a liquidity estimate update for this amount of time, the historical datapoints are
+/// decayed by half.
+///
+/// Note that after 16 or more half lives all historical data will be completely gone.
+///
+/// Default value: 14 days
+#[no_mangle]
+pub extern "C" fn ProbabilisticScoringParameters_get_historical_no_updates_half_life(this_ptr: &ProbabilisticScoringParameters) -> u64 {
+       let mut inner_val = &mut this_ptr.get_native_mut_ref().historical_no_updates_half_life;
+       inner_val.as_secs()
+}
+/// If we aren't learning any new datapoints for a channel, the historical liquidity bounds
+/// tracking can simply live on with increasingly stale data. Instead, when a channel has not
+/// seen a liquidity estimate update for this amount of time, the historical datapoints are
+/// decayed by half.
+///
+/// Note that after 16 or more half lives all historical data will be completely gone.
+///
+/// Default value: 14 days
+#[no_mangle]
+pub extern "C" fn ProbabilisticScoringParameters_set_historical_no_updates_half_life(this_ptr: &mut ProbabilisticScoringParameters, mut val: u64) {
+       unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.historical_no_updates_half_life = core::time::Duration::from_secs(val);
+}
 /// This penalty is applied when `htlc_maximum_msat` is equal to or larger than half of the
 /// channel's capacity, which makes us prefer nodes with a smaller `htlc_maximum_msat`. We
 /// treat such nodes preferentially as this makes balance discovery attacks harder to execute,
@@ -1253,6 +1430,6 @@ pub extern "C" fn ProbabilisticScorer_read(ser: crate::c_types::u8slice, arg_a:
        let arg_c_conv = arg_c;
        let arg_conv = (arg_a_conv, arg_b_conv, arg_c_conv);
        let res: Result<lightning::routing::scoring::ProbabilisticScorer<&lightning::routing::gossip::NetworkGraph<crate::lightning::util::logger::Logger>, crate::lightning::util::logger::Logger>, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj_arg(ser, arg_conv);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::scoring::ProbabilisticScorer { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::scoring::ProbabilisticScorer { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
index b519a9ae4d3c66cc981d76648e8b1362ecdfc825..e99f7222a45f1dd7606a2b6c1b93ea97f9ad31df 100644 (file)
@@ -909,6 +909,12 @@ pub extern "C" fn ChannelConfig_set_cltv_expiry_delta(this_ptr: &mut ChannelConf
 /// to such payments may be sustantial if there are many dust HTLCs present when the
 /// channel is force-closed.
 ///
+/// The dust threshold for each HTLC is based on the `dust_limit_satoshis` for each party in a
+/// channel negotiated throughout the channel open process, along with the fees required to have
+/// a broadcastable HTLC spending transaction. When a channel supports anchor outputs
+/// (specifically the zero fee HTLC transaction variant), this threshold no longer takes into
+/// account the HTLC transaction fee as it is zero.
+///
 /// This limit is applied for sent, forwarded, and received HTLCs and limits the total
 /// exposure across all three types per-channel. Setting this too low may prevent the
 /// sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very
@@ -929,6 +935,12 @@ pub extern "C" fn ChannelConfig_get_max_dust_htlc_exposure_msat(this_ptr: &Chann
 /// to such payments may be sustantial if there are many dust HTLCs present when the
 /// channel is force-closed.
 ///
+/// The dust threshold for each HTLC is based on the `dust_limit_satoshis` for each party in a
+/// channel negotiated throughout the channel open process, along with the fees required to have
+/// a broadcastable HTLC spending transaction. When a channel supports anchor outputs
+/// (specifically the zero fee HTLC transaction variant), this threshold no longer takes into
+/// account the HTLC transaction fee as it is zero.
+///
 /// This limit is applied for sent, forwarded, and received HTLCs and limits the total
 /// exposure across all three types per-channel. Setting this too low may prevent the
 /// sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very
@@ -1023,6 +1035,15 @@ pub(crate) extern "C" fn ChannelConfig_clone_void(this_ptr: *const c_void) -> *m
 pub extern "C" fn ChannelConfig_clone(orig: &ChannelConfig) -> ChannelConfig {
        orig.clone()
 }
+/// Checks if two ChannelConfigs contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn ChannelConfig_eq(a: &ChannelConfig, b: &ChannelConfig) -> bool {
+       if a.inner == b.inner { return true; }
+       if a.inner.is_null() || b.inner.is_null() { return false; }
+       if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
 /// Creates a "default" ChannelConfig. See struct and individual field documentaiton for details on which values are used.
 #[must_use]
 #[no_mangle]
@@ -1042,7 +1063,7 @@ pub(crate) extern "C" fn ChannelConfig_write_void(obj: *const c_void) -> crate::
 /// Read a ChannelConfig from a byte array, created by ChannelConfig_write
 pub extern "C" fn ChannelConfig_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelConfigDecodeErrorZ {
        let res: Result<lightning::util::config::ChannelConfig, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::util::config::ChannelConfig { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::util::config::ChannelConfig { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 
index fffe44fe462440b66338c7ccab1273ac68b3294b..4c911a5f2ddd9ce3b6ddfde0e60886a0bbfe33a0 100644 (file)
@@ -50,9 +50,15 @@ pub enum APIError {
                /// A human-readable error message
                err: crate::c_types::Str,
        },
-       /// An attempt to call watch/update_channel returned an Err (ie you did this!), causing the
-       /// attempted action to fail.
-       MonitorUpdateFailed,
+       /// An attempt to call [`chain::Watch::watch_channel`]/[`chain::Watch::update_channel`]
+       /// returned a [`ChannelMonitorUpdateStatus::InProgress`] indicating the persistence of a
+       /// monitor update is awaiting async resolution. Once it resolves the attempted action should
+       /// complete automatically.
+       ///
+       /// [`chain::Watch::watch_channel`]: crate::chain::Watch::watch_channel
+       /// [`chain::Watch::update_channel`]: crate::chain::Watch::update_channel
+       /// [`ChannelMonitorUpdateStatus::InProgress`]: crate::chain::ChannelMonitorUpdateStatus::InProgress
+       MonitorUpdateInProgress,
        /// [`KeysInterface::get_shutdown_scriptpubkey`] returned a shutdown scriptpubkey incompatible
        /// with the channel counterparty as negotiated in [`InitFeatures`].
        ///
@@ -99,7 +105,7 @@ impl APIError {
                                        err: err_nonref.into_string(),
                                }
                        },
-                       APIError::MonitorUpdateFailed => nativeAPIError::MonitorUpdateFailed,
+                       APIError::MonitorUpdateInProgress => nativeAPIError::MonitorUpdateInProgress,
                        APIError::IncompatibleShutdownScript {ref script, } => {
                                let mut script_nonref = (*script).clone();
                                nativeAPIError::IncompatibleShutdownScript {
@@ -132,7 +138,7 @@ impl APIError {
                                        err: err.into_string(),
                                }
                        },
-                       APIError::MonitorUpdateFailed => nativeAPIError::MonitorUpdateFailed,
+                       APIError::MonitorUpdateInProgress => nativeAPIError::MonitorUpdateInProgress,
                        APIError::IncompatibleShutdownScript {mut script, } => {
                                nativeAPIError::IncompatibleShutdownScript {
                                        script: *unsafe { Box::from_raw(script.take_inner()) },
@@ -169,7 +175,7 @@ impl APIError {
                                        err: err_nonref.into(),
                                }
                        },
-                       nativeAPIError::MonitorUpdateFailed => APIError::MonitorUpdateFailed,
+                       nativeAPIError::MonitorUpdateInProgress => APIError::MonitorUpdateInProgress,
                        nativeAPIError::IncompatibleShutdownScript {ref script, } => {
                                let mut script_nonref = (*script).clone();
                                APIError::IncompatibleShutdownScript {
@@ -202,7 +208,7 @@ impl APIError {
                                        err: err.into(),
                                }
                        },
-                       nativeAPIError::MonitorUpdateFailed => APIError::MonitorUpdateFailed,
+                       nativeAPIError::MonitorUpdateInProgress => APIError::MonitorUpdateInProgress,
                        nativeAPIError::IncompatibleShutdownScript {mut script, } => {
                                APIError::IncompatibleShutdownScript {
                                        script: crate::lightning::ln::script::ShutdownScript { inner: ObjOps::heap_alloc(script), is_owned: true },
@@ -249,9 +255,9 @@ pub extern "C" fn APIError_channel_unavailable(err: crate::c_types::Str) -> APIE
        }
 }
 #[no_mangle]
-/// Utility method to constructs a new MonitorUpdateFailed-variant APIError
-pub extern "C" fn APIError_monitor_update_failed() -> APIError {
-       APIError::MonitorUpdateFailed}
+/// Utility method to constructs a new MonitorUpdateInProgress-variant APIError
+pub extern "C" fn APIError_monitor_update_in_progress() -> APIError {
+       APIError::MonitorUpdateInProgress}
 #[no_mangle]
 /// Utility method to constructs a new IncompatibleShutdownScript-variant APIError
 pub extern "C" fn APIError_incompatible_shutdown_script(script: crate::lightning::ln::script::ShutdownScript) -> APIError {
@@ -259,3 +265,9 @@ pub extern "C" fn APIError_incompatible_shutdown_script(script: crate::lightning
                script,
        }
 }
+/// Checks if two APIErrors contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+#[no_mangle]
+pub extern "C" fn APIError_eq(a: &APIError, b: &APIError) -> bool {
+       if &a.to_native() == &b.to_native() { true } else { false }
+}
index bb4fa57732e0c913e94066ee8fcfd122beec4732..33e3e24f0c5ef281b594f7c169f321e18dae148a 100644 (file)
@@ -164,7 +164,7 @@ pub extern "C" fn PaymentPurpose_write(obj: &crate::lightning::util::events::Pay
 /// Read a PaymentPurpose from a byte array, created by PaymentPurpose_write
 pub extern "C" fn PaymentPurpose_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_PaymentPurposeDecodeErrorZ {
        let res: Result<lightning::util::events::PaymentPurpose, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::util::events::PaymentPurpose::native_into(o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::util::events::PaymentPurpose::native_into(o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 /// The reason the channel was closed. See individual variants more details.
@@ -205,11 +205,19 @@ pub enum ClosureReason {
        /// The peer disconnected prior to funding completing. In this case the spec mandates that we
        /// forget the channel entirely - we can attempt again if the peer reconnects.
        ///
+       /// This includes cases where we restarted prior to funding completion, including prior to the
+       /// initial [`ChannelMonitor`] persistence completing.
+       ///
        /// In LDK versions prior to 0.0.107 this could also occur if we were unable to connect to the
        /// peer because of mutual incompatibility between us and our channel counterparty.
+       ///
+       /// [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
        DisconnectedPeer,
-       /// Closure generated from `ChannelManager::read` if the ChannelMonitor is newer than
-       /// the ChannelManager deserialized.
+       /// Closure generated from `ChannelManager::read` if the [`ChannelMonitor`] is newer than
+       /// the [`ChannelManager`] deserialized.
+       ///
+       /// [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
+       /// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
        OutdatedChannelManager,
 }
 use lightning::util::events::ClosureReason as ClosureReasonImport;
@@ -351,6 +359,12 @@ pub extern "C" fn ClosureReason_disconnected_peer() -> ClosureReason {
 /// Utility method to constructs a new OutdatedChannelManager-variant ClosureReason
 pub extern "C" fn ClosureReason_outdated_channel_manager() -> ClosureReason {
        ClosureReason::OutdatedChannelManager}
+/// Checks if two ClosureReasons contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+#[no_mangle]
+pub extern "C" fn ClosureReason_eq(a: &ClosureReason, b: &ClosureReason) -> bool {
+       if &a.to_native() == &b.to_native() { true } else { false }
+}
 #[no_mangle]
 /// Serialize the ClosureReason object into a byte array which can be read by ClosureReason_read
 pub extern "C" fn ClosureReason_write(obj: &crate::lightning::util::events::ClosureReason) -> crate::c_types::derived::CVec_u8Z {
@@ -360,7 +374,7 @@ pub extern "C" fn ClosureReason_write(obj: &crate::lightning::util::events::Clos
 /// Read a ClosureReason from a byte array, created by ClosureReason_write
 pub extern "C" fn ClosureReason_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_COption_ClosureReasonZDecodeErrorZ {
        let res: Result<Option<lightning::util::events::ClosureReason>, lightning::ln::msgs::DecodeError> = crate::c_types::maybe_deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { let mut local_res_0 = if o.is_none() { crate::c_types::derived::COption_ClosureReasonZ::None } else { crate::c_types::derived::COption_ClosureReasonZ::Some( { crate::lightning::util::events::ClosureReason::native_into(o.unwrap()) }) }; local_res_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { let mut local_res_0 = if o.is_none() { crate::c_types::derived::COption_ClosureReasonZ::None } else { crate::c_types::derived::COption_ClosureReasonZ::Some( { crate::lightning::util::events::ClosureReason::native_into(o.unwrap()) }) }; local_res_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 /// Intended destination of a failed HTLC as indicated in [`Event::HTLCHandlingFailed`].
@@ -528,6 +542,12 @@ pub extern "C" fn HTLCDestination_failed_payment(payment_hash: crate::c_types::T
                payment_hash,
        }
 }
+/// Checks if two HTLCDestinations contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+#[no_mangle]
+pub extern "C" fn HTLCDestination_eq(a: &HTLCDestination, b: &HTLCDestination) -> bool {
+       if &a.to_native() == &b.to_native() { true } else { false }
+}
 #[no_mangle]
 /// Serialize the HTLCDestination object into a byte array which can be read by HTLCDestination_read
 pub extern "C" fn HTLCDestination_write(obj: &crate::lightning::util::events::HTLCDestination) -> crate::c_types::derived::CVec_u8Z {
@@ -537,7 +557,7 @@ pub extern "C" fn HTLCDestination_write(obj: &crate::lightning::util::events::HT
 /// Read a HTLCDestination from a byte array, created by HTLCDestination_write
 pub extern "C" fn HTLCDestination_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_COption_HTLCDestinationZDecodeErrorZ {
        let res: Result<Option<lightning::util::events::HTLCDestination>, lightning::ln::msgs::DecodeError> = crate::c_types::maybe_deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { let mut local_res_0 = if o.is_none() { crate::c_types::derived::COption_HTLCDestinationZ::None } else { crate::c_types::derived::COption_HTLCDestinationZ::Some( { crate::lightning::util::events::HTLCDestination::native_into(o.unwrap()) }) }; local_res_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { let mut local_res_0 = if o.is_none() { crate::c_types::derived::COption_HTLCDestinationZ::None } else { crate::c_types::derived::COption_HTLCDestinationZ::Some( { crate::lightning::util::events::HTLCDestination::native_into(o.unwrap()) }) }; local_res_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 /// An Event which you should probably take some action in response to.
@@ -1786,7 +1806,7 @@ pub extern "C" fn Event_write(obj: &crate::lightning::util::events::Event) -> cr
 /// Read a Event from a byte array, created by Event_write
 pub extern "C" fn Event_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_COption_EventZDecodeErrorZ {
        let res: Result<Option<lightning::util::events::Event>, lightning::ln::msgs::DecodeError> = crate::c_types::maybe_deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { let mut local_res_0 = if o.is_none() { crate::c_types::derived::COption_EventZ::None } else { crate::c_types::derived::COption_EventZ::Some( { crate::lightning::util::events::Event::native_into(o.unwrap()) }) }; local_res_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { let mut local_res_0 = if o.is_none() { crate::c_types::derived::COption_EventZ::None } else { crate::c_types::derived::COption_EventZ::Some( { crate::lightning::util::events::Event::native_into(o.unwrap()) }) }; local_res_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 /// An event generated by ChannelManager which indicates a message should be sent to a peer (or
index 23890d863974dff8669b0e8c21b6ac3f0323eed7..be7c62636cf114978f0cdfd87869fade48a182e6 100644 (file)
@@ -169,6 +169,15 @@ pub(crate) extern "C" fn Hostname_clone_void(this_ptr: *const c_void) -> *mut c_
 pub extern "C" fn Hostname_clone(orig: &Hostname) -> Hostname {
        orig.clone()
 }
+/// Checks if two Hostnames contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn Hostname_eq(a: &Hostname, b: &Hostname) -> bool {
+       if a.inner == b.inner { return true; }
+       if a.inner.is_null() || b.inner.is_null() { return false; }
+       if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
 /// Returns the length of the hostname.
 #[must_use]
 #[no_mangle]
index 440aaad4603bbb7d5e60a9f87ed7e145dbac50f2..ffe1991922acf17e8b46945b29b0bcff442eaeda 100644 (file)
@@ -31,8 +31,8 @@ pub(crate) type nativeBackgroundProcessor = nativeBackgroundProcessorImport;
 ///   [`ChannelManager`] persistence should be done in the background.
 /// * Calling [`ChannelManager::timer_tick_occurred`] and [`PeerManager::timer_tick_occurred`]
 ///   at the appropriate intervals.
-/// * Calling [`NetworkGraph::remove_stale_channels`] (if a [`GossipSync`] with a [`NetworkGraph`]
-///   is provided to [`BackgroundProcessor::start`]).
+/// * Calling [`NetworkGraph::remove_stale_channels_and_tracking`] (if a [`GossipSync`] with a
+///   [`NetworkGraph`] is provided to [`BackgroundProcessor::start`]).
 ///
 /// It will also call [`PeerManager::process_events`] periodically though this shouldn't be relied
 /// upon as doing so may result in high latency.
index d04efd9aa63c1cd89308654b130cf2844f85eed3..f91c4a63482156f0421168116cc7460b2a9dbda7 100644 (file)
@@ -485,6 +485,12 @@ pub extern "C" fn ParseError_invalid_slice_length(a: crate::c_types::Str) -> Par
 /// Utility method to constructs a new Skip-variant ParseError
 pub extern "C" fn ParseError_skip() -> ParseError {
        ParseError::Skip}
+/// Checks if two ParseErrors contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+#[no_mangle]
+pub extern "C" fn ParseError_eq(a: &ParseError, b: &ParseError) -> bool {
+       if &a.to_native() == &b.to_native() { true } else { false }
+}
 /// Indicates that something went wrong while parsing or validating the invoice. Parsing errors
 /// should be mostly seen as opaque and are only there for debugging reasons. Semantic errors
 /// like wrong signatures, missing fields etc. could mean that someone tampered with the invoice.
@@ -586,6 +592,12 @@ pub extern "C" fn ParseOrSemanticError_parse_error(a: crate::lightning_invoice::
 pub extern "C" fn ParseOrSemanticError_semantic_error(a: crate::lightning_invoice::SemanticError) -> ParseOrSemanticError {
        ParseOrSemanticError::SemanticError(a, )
 }
+/// Checks if two ParseOrSemanticErrors contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+#[no_mangle]
+pub extern "C" fn ParseOrSemanticError_eq(a: &ParseOrSemanticError, b: &ParseOrSemanticError) -> bool {
+       if &a.to_native() == &b.to_native() { true } else { false }
+}
 /// The maximum timestamp as [`Duration::as_secs`] since the Unix epoch allowed by [`BOLT 11`].
 ///
 /// [BOLT 11]: https://github.com/lightning/bolts/blob/master/11-payment-encoding.md
@@ -2294,6 +2306,8 @@ pub extern "C" fn PositiveTimestamp_from_unix_timestamp(mut unix_seconds: u64) -
 /// Creates a `PositiveTimestamp` from a [`SystemTime`] with a corresponding Unix timestamp in
 /// the range `0..=MAX_TIMESTAMP`.
 ///
+/// Note that the subsecond part is dropped as it is not representable in BOLT 11 invoices.
+///
 /// Otherwise, returns a [`CreationError::TimestampOutOfBounds`].
 #[must_use]
 #[no_mangle]
@@ -2306,6 +2320,8 @@ pub extern "C" fn PositiveTimestamp_from_system_time(mut time: u64) -> crate::c_
 /// Creates a `PositiveTimestamp` from a [`Duration`] since the Unix epoch in the range
 /// `0..=MAX_TIMESTAMP`.
 ///
+/// Note that the subsecond part is dropped as it is not representable in BOLT 11 invoices.
+///
 /// Otherwise, returns a [`CreationError::TimestampOutOfBounds`].
 #[must_use]
 #[no_mangle]
@@ -2543,7 +2559,7 @@ pub extern "C" fn ExpiryTime_from_seconds(mut seconds: u64) -> crate::lightning_
        crate::lightning_invoice::ExpiryTime { inner: ObjOps::heap_alloc(ret), is_owned: true }
 }
 
-/// Construct an `ExpiryTime` from a `Duration`.
+/// Construct an `ExpiryTime` from a `Duration`, dropping the sub-second part.
 #[must_use]
 #[no_mangle]
 pub extern "C" fn ExpiryTime_from_duration(mut duration: u64) -> crate::lightning_invoice::ExpiryTime {
index ed1f0dd8dd74375954db3773515aab279cdbc392..675f432d06a35cb35cd940ebac3f2ed841d3d972 100644 (file)
@@ -783,6 +783,6 @@ pub(crate) extern "C" fn InFlightHtlcs_write_void(obj: *const c_void) -> crate::
 /// Read a InFlightHtlcs from a byte array, created by InFlightHtlcs_write
 pub extern "C" fn InFlightHtlcs_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_InFlightHtlcsDecodeErrorZ {
        let res: Result<lightning_invoice::payment::InFlightHtlcs, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning_invoice::payment::InFlightHtlcs { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning_invoice::payment::InFlightHtlcs { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
index 9d29e7ab84ca2184cccda196a902986496caaf30..4a05bb71af8e4b6ea5edb7b6102c290f7ce3a27c 100644 (file)
@@ -48,11 +48,11 @@ use alloc::{vec::Vec, boxed::Box};
 ///
 /// Note that payment_hash (or a relevant inner pointer) may be NULL or all-0s to represent None
 #[no_mangle]
-pub extern "C" fn create_phantom_invoice(mut amt_msat: crate::c_types::derived::COption_u64Z, mut payment_hash: crate::c_types::ThirtyTwoBytes, mut description: crate::c_types::Str, mut invoice_expiry_delta_secs: u32, mut phantom_route_hints: crate::c_types::derived::CVec_PhantomRouteHintsZ, mut keys_manager: crate::lightning::chain::keysinterface::KeysInterface, mut network: crate::lightning_invoice::Currency) -> crate::c_types::derived::CResult_InvoiceSignOrCreationErrorZ {
+pub extern "C" fn create_phantom_invoice(mut amt_msat: crate::c_types::derived::COption_u64Z, mut payment_hash: crate::c_types::ThirtyTwoBytes, mut description: crate::c_types::Str, mut invoice_expiry_delta_secs: u32, mut phantom_route_hints: crate::c_types::derived::CVec_PhantomRouteHintsZ, mut keys_manager: crate::lightning::chain::keysinterface::KeysInterface, mut logger: crate::lightning::util::logger::Logger, mut network: crate::lightning_invoice::Currency) -> crate::c_types::derived::CResult_InvoiceSignOrCreationErrorZ {
        let mut local_amt_msat = if amt_msat.is_some() { Some( { amt_msat.take() }) } else { None };
        let mut local_payment_hash = if payment_hash.data == [0; 32] { None } else { Some( { ::lightning::ln::PaymentHash(payment_hash.data) }) };
        let mut local_phantom_route_hints = Vec::new(); for mut item in phantom_route_hints.into_rust().drain(..) { local_phantom_route_hints.push( { *unsafe { Box::from_raw(item.take_inner()) } }); };
-       let mut ret = lightning_invoice::utils::create_phantom_invoice::<crate::lightning::chain::keysinterface::Sign, crate::lightning::chain::keysinterface::KeysInterface>(local_amt_msat, local_payment_hash, description.into_string(), invoice_expiry_delta_secs, local_phantom_route_hints, keys_manager, network.into_native());
+       let mut ret = lightning_invoice::utils::create_phantom_invoice::<crate::lightning::chain::keysinterface::Sign, crate::lightning::chain::keysinterface::KeysInterface, crate::lightning::util::logger::Logger>(local_amt_msat, local_payment_hash, description.into_string(), invoice_expiry_delta_secs, local_phantom_route_hints, keys_manager, logger, network.into_native());
        let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning_invoice::Invoice { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning_invoice::SignOrCreationError::native_into(e) }).into() };
        local_ret
 }
@@ -91,11 +91,11 @@ pub extern "C" fn create_phantom_invoice(mut amt_msat: crate::c_types::derived::
 ///
 /// Note that payment_hash (or a relevant inner pointer) may be NULL or all-0s to represent None
 #[no_mangle]
-pub extern "C" fn create_phantom_invoice_with_description_hash(mut amt_msat: crate::c_types::derived::COption_u64Z, mut payment_hash: crate::c_types::ThirtyTwoBytes, mut invoice_expiry_delta_secs: u32, mut description_hash: crate::lightning_invoice::Sha256, mut phantom_route_hints: crate::c_types::derived::CVec_PhantomRouteHintsZ, mut keys_manager: crate::lightning::chain::keysinterface::KeysInterface, mut network: crate::lightning_invoice::Currency) -> crate::c_types::derived::CResult_InvoiceSignOrCreationErrorZ {
+pub extern "C" fn create_phantom_invoice_with_description_hash(mut amt_msat: crate::c_types::derived::COption_u64Z, mut payment_hash: crate::c_types::ThirtyTwoBytes, mut invoice_expiry_delta_secs: u32, mut description_hash: crate::lightning_invoice::Sha256, mut phantom_route_hints: crate::c_types::derived::CVec_PhantomRouteHintsZ, mut keys_manager: crate::lightning::chain::keysinterface::KeysInterface, mut logger: crate::lightning::util::logger::Logger, mut network: crate::lightning_invoice::Currency) -> crate::c_types::derived::CResult_InvoiceSignOrCreationErrorZ {
        let mut local_amt_msat = if amt_msat.is_some() { Some( { amt_msat.take() }) } else { None };
        let mut local_payment_hash = if payment_hash.data == [0; 32] { None } else { Some( { ::lightning::ln::PaymentHash(payment_hash.data) }) };
        let mut local_phantom_route_hints = Vec::new(); for mut item in phantom_route_hints.into_rust().drain(..) { local_phantom_route_hints.push( { *unsafe { Box::from_raw(item.take_inner()) } }); };
-       let mut ret = lightning_invoice::utils::create_phantom_invoice_with_description_hash::<crate::lightning::chain::keysinterface::Sign, crate::lightning::chain::keysinterface::KeysInterface>(local_amt_msat, local_payment_hash, invoice_expiry_delta_secs, *unsafe { Box::from_raw(description_hash.take_inner()) }, local_phantom_route_hints, keys_manager, network.into_native());
+       let mut ret = lightning_invoice::utils::create_phantom_invoice_with_description_hash::<crate::lightning::chain::keysinterface::Sign, crate::lightning::chain::keysinterface::KeysInterface, crate::lightning::util::logger::Logger>(local_amt_msat, local_payment_hash, invoice_expiry_delta_secs, *unsafe { Box::from_raw(description_hash.take_inner()) }, local_phantom_route_hints, keys_manager, logger, network.into_native());
        let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning_invoice::Invoice { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning_invoice::SignOrCreationError::native_into(e) }).into() };
        local_ret
 }
@@ -109,9 +109,9 @@ pub extern "C" fn create_phantom_invoice_with_description_hash(mut amt_msat: cra
 /// `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
 /// in excess of the current time.
 #[no_mangle]
-pub extern "C" fn create_invoice_from_channelmanager(channelmanager: &crate::lightning::ln::channelmanager::ChannelManager, mut keys_manager: crate::lightning::chain::keysinterface::KeysInterface, mut network: crate::lightning_invoice::Currency, mut amt_msat: crate::c_types::derived::COption_u64Z, mut description: crate::c_types::Str, mut invoice_expiry_delta_secs: u32) -> crate::c_types::derived::CResult_InvoiceSignOrCreationErrorZ {
+pub extern "C" fn create_invoice_from_channelmanager(channelmanager: &crate::lightning::ln::channelmanager::ChannelManager, mut keys_manager: crate::lightning::chain::keysinterface::KeysInterface, mut logger: crate::lightning::util::logger::Logger, mut network: crate::lightning_invoice::Currency, mut amt_msat: crate::c_types::derived::COption_u64Z, mut description: crate::c_types::Str, mut invoice_expiry_delta_secs: u32) -> crate::c_types::derived::CResult_InvoiceSignOrCreationErrorZ {
        let mut local_amt_msat = if amt_msat.is_some() { Some( { amt_msat.take() }) } else { None };
-       let mut ret = lightning_invoice::utils::create_invoice_from_channelmanager::<crate::lightning::chain::keysinterface::Sign, crate::lightning::chain::Watch, crate::lightning::chain::chaininterface::BroadcasterInterface, crate::lightning::chain::keysinterface::KeysInterface, crate::lightning::chain::chaininterface::FeeEstimator, crate::lightning::util::logger::Logger>(channelmanager.get_native_ref(), keys_manager, network.into_native(), local_amt_msat, description.into_string(), invoice_expiry_delta_secs);
+       let mut ret = lightning_invoice::utils::create_invoice_from_channelmanager::<crate::lightning::chain::keysinterface::Sign, crate::lightning::chain::Watch, crate::lightning::chain::chaininterface::BroadcasterInterface, crate::lightning::chain::keysinterface::KeysInterface, crate::lightning::chain::chaininterface::FeeEstimator, crate::lightning::util::logger::Logger>(channelmanager.get_native_ref(), keys_manager, logger, network.into_native(), local_amt_msat, description.into_string(), invoice_expiry_delta_secs);
        let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning_invoice::Invoice { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning_invoice::SignOrCreationError::native_into(e) }).into() };
        local_ret
 }
@@ -126,9 +126,9 @@ pub extern "C" fn create_invoice_from_channelmanager(channelmanager: &crate::lig
 /// `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
 /// in excess of the current time.
 #[no_mangle]
-pub extern "C" fn create_invoice_from_channelmanager_with_description_hash(channelmanager: &crate::lightning::ln::channelmanager::ChannelManager, mut keys_manager: crate::lightning::chain::keysinterface::KeysInterface, mut network: crate::lightning_invoice::Currency, mut amt_msat: crate::c_types::derived::COption_u64Z, mut description_hash: crate::lightning_invoice::Sha256, mut invoice_expiry_delta_secs: u32) -> crate::c_types::derived::CResult_InvoiceSignOrCreationErrorZ {
+pub extern "C" fn create_invoice_from_channelmanager_with_description_hash(channelmanager: &crate::lightning::ln::channelmanager::ChannelManager, mut keys_manager: crate::lightning::chain::keysinterface::KeysInterface, mut logger: crate::lightning::util::logger::Logger, mut network: crate::lightning_invoice::Currency, mut amt_msat: crate::c_types::derived::COption_u64Z, mut description_hash: crate::lightning_invoice::Sha256, mut invoice_expiry_delta_secs: u32) -> crate::c_types::derived::CResult_InvoiceSignOrCreationErrorZ {
        let mut local_amt_msat = if amt_msat.is_some() { Some( { amt_msat.take() }) } else { None };
-       let mut ret = lightning_invoice::utils::create_invoice_from_channelmanager_with_description_hash::<crate::lightning::chain::keysinterface::Sign, crate::lightning::chain::Watch, crate::lightning::chain::chaininterface::BroadcasterInterface, crate::lightning::chain::keysinterface::KeysInterface, crate::lightning::chain::chaininterface::FeeEstimator, crate::lightning::util::logger::Logger>(channelmanager.get_native_ref(), keys_manager, network.into_native(), local_amt_msat, *unsafe { Box::from_raw(description_hash.take_inner()) }, invoice_expiry_delta_secs);
+       let mut ret = lightning_invoice::utils::create_invoice_from_channelmanager_with_description_hash::<crate::lightning::chain::keysinterface::Sign, crate::lightning::chain::Watch, crate::lightning::chain::chaininterface::BroadcasterInterface, crate::lightning::chain::keysinterface::KeysInterface, crate::lightning::chain::chaininterface::FeeEstimator, crate::lightning::util::logger::Logger>(channelmanager.get_native_ref(), keys_manager, logger, network.into_native(), local_amt_msat, *unsafe { Box::from_raw(description_hash.take_inner()) }, invoice_expiry_delta_secs);
        let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning_invoice::Invoice { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning_invoice::SignOrCreationError::native_into(e) }).into() };
        local_ret
 }
@@ -137,9 +137,9 @@ pub extern "C" fn create_invoice_from_channelmanager_with_description_hash(chann
 /// This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not
 /// available and the current time is supplied by the caller.
 #[no_mangle]
-pub extern "C" fn create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(channelmanager: &crate::lightning::ln::channelmanager::ChannelManager, mut keys_manager: crate::lightning::chain::keysinterface::KeysInterface, mut network: crate::lightning_invoice::Currency, mut amt_msat: crate::c_types::derived::COption_u64Z, mut description_hash: crate::lightning_invoice::Sha256, mut duration_since_epoch: u64, mut invoice_expiry_delta_secs: u32) -> crate::c_types::derived::CResult_InvoiceSignOrCreationErrorZ {
+pub extern "C" fn create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(channelmanager: &crate::lightning::ln::channelmanager::ChannelManager, mut keys_manager: crate::lightning::chain::keysinterface::KeysInterface, mut logger: crate::lightning::util::logger::Logger, mut network: crate::lightning_invoice::Currency, mut amt_msat: crate::c_types::derived::COption_u64Z, mut description_hash: crate::lightning_invoice::Sha256, mut duration_since_epoch: u64, mut invoice_expiry_delta_secs: u32) -> crate::c_types::derived::CResult_InvoiceSignOrCreationErrorZ {
        let mut local_amt_msat = if amt_msat.is_some() { Some( { amt_msat.take() }) } else { None };
-       let mut ret = lightning_invoice::utils::create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch::<crate::lightning::chain::keysinterface::Sign, crate::lightning::chain::Watch, crate::lightning::chain::chaininterface::BroadcasterInterface, crate::lightning::chain::keysinterface::KeysInterface, crate::lightning::chain::chaininterface::FeeEstimator, crate::lightning::util::logger::Logger>(channelmanager.get_native_ref(), keys_manager, network.into_native(), local_amt_msat, *unsafe { Box::from_raw(description_hash.take_inner()) }, core::time::Duration::from_secs(duration_since_epoch), invoice_expiry_delta_secs);
+       let mut ret = lightning_invoice::utils::create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch::<crate::lightning::chain::keysinterface::Sign, crate::lightning::chain::Watch, crate::lightning::chain::chaininterface::BroadcasterInterface, crate::lightning::chain::keysinterface::KeysInterface, crate::lightning::chain::chaininterface::FeeEstimator, crate::lightning::util::logger::Logger>(channelmanager.get_native_ref(), keys_manager, logger, network.into_native(), local_amt_msat, *unsafe { Box::from_raw(description_hash.take_inner()) }, core::time::Duration::from_secs(duration_since_epoch), invoice_expiry_delta_secs);
        let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning_invoice::Invoice { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning_invoice::SignOrCreationError::native_into(e) }).into() };
        local_ret
 }
@@ -148,9 +148,9 @@ pub extern "C" fn create_invoice_from_channelmanager_with_description_hash_and_d
 /// This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not
 /// available and the current time is supplied by the caller.
 #[no_mangle]
-pub extern "C" fn create_invoice_from_channelmanager_and_duration_since_epoch(channelmanager: &crate::lightning::ln::channelmanager::ChannelManager, mut keys_manager: crate::lightning::chain::keysinterface::KeysInterface, mut network: crate::lightning_invoice::Currency, mut amt_msat: crate::c_types::derived::COption_u64Z, mut description: crate::c_types::Str, mut duration_since_epoch: u64, mut invoice_expiry_delta_secs: u32) -> crate::c_types::derived::CResult_InvoiceSignOrCreationErrorZ {
+pub extern "C" fn create_invoice_from_channelmanager_and_duration_since_epoch(channelmanager: &crate::lightning::ln::channelmanager::ChannelManager, mut keys_manager: crate::lightning::chain::keysinterface::KeysInterface, mut logger: crate::lightning::util::logger::Logger, mut network: crate::lightning_invoice::Currency, mut amt_msat: crate::c_types::derived::COption_u64Z, mut description: crate::c_types::Str, mut duration_since_epoch: u64, mut invoice_expiry_delta_secs: u32) -> crate::c_types::derived::CResult_InvoiceSignOrCreationErrorZ {
        let mut local_amt_msat = if amt_msat.is_some() { Some( { amt_msat.take() }) } else { None };
-       let mut ret = lightning_invoice::utils::create_invoice_from_channelmanager_and_duration_since_epoch::<crate::lightning::chain::keysinterface::Sign, crate::lightning::chain::Watch, crate::lightning::chain::chaininterface::BroadcasterInterface, crate::lightning::chain::keysinterface::KeysInterface, crate::lightning::chain::chaininterface::FeeEstimator, crate::lightning::util::logger::Logger>(channelmanager.get_native_ref(), keys_manager, network.into_native(), local_amt_msat, description.into_string(), core::time::Duration::from_secs(duration_since_epoch), invoice_expiry_delta_secs);
+       let mut ret = lightning_invoice::utils::create_invoice_from_channelmanager_and_duration_since_epoch::<crate::lightning::chain::keysinterface::Sign, crate::lightning::chain::Watch, crate::lightning::chain::chaininterface::BroadcasterInterface, crate::lightning::chain::keysinterface::KeysInterface, crate::lightning::chain::chaininterface::FeeEstimator, crate::lightning::util::logger::Logger>(channelmanager.get_native_ref(), keys_manager, logger, network.into_native(), local_amt_msat, description.into_string(), core::time::Duration::from_secs(duration_since_epoch), invoice_expiry_delta_secs);
        let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning_invoice::Invoice { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning_invoice::SignOrCreationError::native_into(e) }).into() };
        local_ret
 }
@@ -264,9 +264,6 @@ extern "C" fn DefaultRouter_Router_notify_payment_probe_failed(this_arg: *const
        <nativeDefaultRouter as lightning_invoice::payment::Router<>>::notify_payment_probe_failed(unsafe { &mut *(this_arg as *mut nativeDefaultRouter) }, &local_path[..], short_channel_id)
 }
 
-use crate::lightning::ln::channelmanager::nativeChannelManager as nativeChannelManager;
-use crate::lightning::ln::channelmanager::ChannelManager;
-use crate::lightning::ln::channelmanager::ChannelManager_free_void;
 impl From<nativeChannelManager> for crate::lightning_invoice::payment::Payer {
        fn from(obj: nativeChannelManager) -> Self {
                let mut rust_obj = ChannelManager { inner: ObjOps::heap_alloc(obj), is_owned: true };
@@ -327,3 +324,6 @@ extern "C" fn ChannelManager_Payer_abandon_payment(this_arg: *const c_void, mut
        <nativeChannelManager as lightning_invoice::payment::Payer<>>::abandon_payment(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, ::lightning::ln::channelmanager::PaymentId(payment_id.data))
 }
 
+use crate::lightning::ln::channelmanager::nativeChannelManager as nativeChannelManager;
+use crate::lightning::ln::channelmanager::ChannelManager;
+use crate::lightning::ln::channelmanager::ChannelManager_free_void;
index 808a81723ad9e2df0800442207b41ae0be05fd91..0fe5716afaeaa3d6e95e0b5148cc18112aba7a26 100644 (file)
@@ -40,7 +40,7 @@ impl GraphSyncError {
                        GraphSyncError::DecodeError (ref a, ) => {
                                let mut a_nonref = (*a).clone();
                                nativeGraphSyncError::DecodeError (
-                                       *unsafe { Box::from_raw(a_nonref.take_inner()) },
+                                       a_nonref.into_native(),
                                )
                        },
                        GraphSyncError::LightningError (ref a, ) => {
@@ -56,7 +56,7 @@ impl GraphSyncError {
                match self {
                        GraphSyncError::DecodeError (mut a, ) => {
                                nativeGraphSyncError::DecodeError (
-                                       *unsafe { Box::from_raw(a.take_inner()) },
+                                       a.into_native(),
                                )
                        },
                        GraphSyncError::LightningError (mut a, ) => {
@@ -72,7 +72,7 @@ impl GraphSyncError {
                        nativeGraphSyncError::DecodeError (ref a, ) => {
                                let mut a_nonref = (*a).clone();
                                GraphSyncError::DecodeError (
-                                       crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(a_nonref), is_owned: true },
+                                       crate::lightning::ln::msgs::DecodeError::native_into(a_nonref),
                                )
                        },
                        nativeGraphSyncError::LightningError (ref a, ) => {
@@ -88,7 +88,7 @@ impl GraphSyncError {
                match native {
                        nativeGraphSyncError::DecodeError (mut a, ) => {
                                GraphSyncError::DecodeError (
-                                       crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(a), is_owned: true },
+                                       crate::lightning::ln::msgs::DecodeError::native_into(a),
                                )
                        },
                        nativeGraphSyncError::LightningError (mut a, ) => {
index 273b3be9b594e012b9be242410699e45247a7623..1cc8d149666d315edbe14abc24fa5d04cdc9385e 100644 (file)
@@ -34,7 +34,7 @@
 //!
 //! After the gossip data snapshot has been downloaded, one of the client's graph processing
 //! functions needs to be called. In this example, we process the update by reading its contents
-//! from disk, which we do by calling [sync_network_graph_with_file_path]:
+//! from disk, which we do by calling [`RapidGossipSync::update_network_graph`]:
 //!
 //! ```
 //! use bitcoin::blockdata::constants::genesis_block;
@@ -52,9 +52,9 @@
 //! let block_hash = genesis_block(Network::Bitcoin).header.block_hash();
 //! let network_graph = NetworkGraph::new(block_hash, &logger);
 //! let rapid_sync = RapidGossipSync::new(&network_graph);
-//! let new_last_sync_timestamp_result = rapid_sync.sync_network_graph_with_file_path(\"./rapid_sync.lngossip\");
+//! let snapshot_contents: &[u8] = &[0; 0];
+//! let new_last_sync_timestamp_result = rapid_sync.update_network_graph(snapshot_contents);
 //! ```
-//! [sync_network_graph_with_file_path]: RapidGossipSync::sync_network_graph_with_file_path
 
 use alloc::str::FromStr;
 use core::ffi::c_void;
@@ -65,7 +65,17 @@ use crate::c_types::*;
 use alloc::{vec::Vec, boxed::Box};
 
 pub mod error;
-pub mod processing;
+mod processing {
+
+use alloc::str::FromStr;
+use core::ffi::c_void;
+use core::convert::Infallible;
+use bitcoin::hashes::Hash;
+use crate::c_types::*;
+#[cfg(feature="no-std")]
+use alloc::{vec::Vec, boxed::Box};
+
+}
 
 use lightning_rapid_gossip_sync::RapidGossipSync as nativeRapidGossipSyncImport;
 pub(crate) type nativeRapidGossipSync = nativeRapidGossipSyncImport<&'static lightning::routing::gossip::NetworkGraph<crate::lightning::util::logger::Logger>, crate::lightning::util::logger::Logger>;
diff --git a/lightning-c-bindings/src/lightning_rapid_gossip_sync/processing.rs b/lightning-c-bindings/src/lightning_rapid_gossip_sync/processing.rs
deleted file mode 100644 (file)
index 9cafbfe..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-// This file is Copyright its original authors, visible in version control
-// history and in the source files from which this was generated.
-//
-// This file is licensed under the license available in the LICENSE or LICENSE.md
-// file in the root of this repository or, if no such file exists, the same
-// license as that which applies to the original source files from which this
-// source was automatically generated.
-
-/// Core functionality of this crate
-
-use alloc::str::FromStr;
-use core::ffi::c_void;
-use core::convert::Infallible;
-use bitcoin::hashes::Hash;
-use crate::c_types::*;
-#[cfg(feature="no-std")]
-use alloc::{vec::Vec, boxed::Box};
-