Update auto-generated bindings
authorMatt Corallo <git@bluematt.me>
Mon, 1 Nov 2021 21:49:12 +0000 (21:49 +0000)
committerMatt Corallo <git@bluematt.me>
Wed, 3 Nov 2021 17:37:53 +0000 (17:37 +0000)
27 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/routing/mod.rs
lightning-c-bindings/src/lightning/routing/network_graph.rs
lightning-c-bindings/src/lightning/routing/router.rs
lightning-c-bindings/src/lightning/routing/scorer.rs
lightning-c-bindings/src/lightning/util/config.rs
lightning-c-bindings/src/lightning/util/events.rs
lightning-c-bindings/src/lightning/util/mod.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 [new file with mode: 0644]
lightning-c-bindings/src/lightning_invoice/utils.rs
lightning-c-bindings/src/lightning_persister.rs

index 497d2595fcdfc247248e116b80b1fd501e2260bd..a68b1dd31432eacadb549ec880e0a32051011096 100644 (file)
@@ -44,6 +44,10 @@ struct nativeRouteHopOpaque;
 typedef struct nativeRouteHopOpaque LDKnativeRouteHop;
 struct nativeRouteOpaque;
 typedef struct nativeRouteOpaque LDKnativeRoute;
+struct nativeRouteParametersOpaque;
+typedef struct nativeRouteParametersOpaque LDKnativeRouteParameters;
+struct nativePayeeOpaque;
+typedef struct nativePayeeOpaque LDKnativePayee;
 struct nativeRouteHintOpaque;
 typedef struct nativeRouteHintOpaque LDKnativeRouteHint;
 struct nativeRouteHintHopOpaque;
@@ -52,6 +56,8 @@ struct nativeBestBlockOpaque;
 typedef struct nativeBestBlockOpaque LDKnativeBestBlock;
 struct nativeWatchedOutputOpaque;
 typedef struct nativeWatchedOutputOpaque LDKnativeWatchedOutput;
+struct nativeLockableScoreOpaque;
+typedef struct nativeLockableScoreOpaque LDKnativeLockableScore;
 struct nativeInitFeaturesOpaque;
 typedef struct nativeInitFeaturesOpaque LDKnativeInitFeatures;
 struct nativeNodeFeaturesOpaque;
@@ -62,6 +68,8 @@ struct nativeInvoiceFeaturesOpaque;
 typedef struct nativeInvoiceFeaturesOpaque LDKnativeInvoiceFeatures;
 struct nativeScorerOpaque;
 typedef struct nativeScorerOpaque LDKnativeScorer;
+struct nativeScoringParametersOpaque;
+typedef struct nativeScoringParametersOpaque LDKnativeScoringParameters;
 struct nativeDelayedPaymentOutputDescriptorOpaque;
 typedef struct nativeDelayedPaymentOutputDescriptorOpaque LDKnativeDelayedPaymentOutputDescriptor;
 struct nativeStaticPaymentOutputDescriptorOpaque;
@@ -73,8 +81,6 @@ struct nativeKeysManagerOpaque;
 typedef struct nativeKeysManagerOpaque LDKnativeKeysManager;
 struct nativeFilesystemPersisterOpaque;
 typedef struct nativeFilesystemPersisterOpaque LDKnativeFilesystemPersister;
-struct nativePaymentIdOpaque;
-typedef struct nativePaymentIdOpaque LDKnativePaymentId;
 struct nativeChannelManagerOpaque;
 typedef struct nativeChannelManagerOpaque LDKnativeChannelManager;
 struct nativeChainParametersOpaque;
@@ -97,6 +103,10 @@ struct nativeUserConfigOpaque;
 typedef struct nativeUserConfigOpaque LDKnativeUserConfig;
 struct nativeOutPointOpaque;
 typedef struct nativeOutPointOpaque LDKnativeOutPoint;
+struct nativeInvoicePayerOpaque;
+typedef struct nativeInvoicePayerOpaque LDKnativeInvoicePayer;
+struct nativeRetryAttemptsOpaque;
+typedef struct nativeRetryAttemptsOpaque LDKnativeRetryAttempts;
 struct nativeInvoiceOpaque;
 typedef struct nativeInvoiceOpaque LDKnativeInvoice;
 struct nativeSignedRawInvoiceOpaque;
@@ -229,6 +239,10 @@ struct nativeLightningErrorOpaque;
 typedef struct nativeLightningErrorOpaque LDKnativeLightningError;
 struct nativeCommitmentUpdateOpaque;
 typedef struct nativeCommitmentUpdateOpaque LDKnativeCommitmentUpdate;
+struct nativeDefaultRouterOpaque;
+typedef struct nativeDefaultRouterOpaque LDKnativeDefaultRouter;
+struct nativeMonitorUpdateIdOpaque;
+typedef struct nativeMonitorUpdateIdOpaque LDKnativeMonitorUpdateId;
 struct nativeLockedChannelMonitorOpaque;
 typedef struct nativeLockedChannelMonitorOpaque LDKnativeLockedChannelMonitor;
 struct nativeChainMonitorOpaque;
index 17abdfde4b89a3950abfc03f99e8d85365e08159..a1b91e72ee07b855ceac0a4782c7f453a2ed3899 100644 (file)
@@ -37,9 +37,10 @@ typedef enum LDKChannelMonitorUpdateErr {
     * our state failed, but is expected to succeed at some point in the future).
     *
     * Such a failure will \"freeze\" a channel, preventing us from revoking old states or
-    * submitting new commitment transactions to the counterparty. Once the update(s) which failed
-    * have been successfully applied, ChannelManager::channel_monitor_updated can be used to
-    * restore the channel to an operational state.
+    * 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
@@ -53,13 +54,14 @@ typedef enum LDKChannelMonitorUpdateErr {
     * the channel which would invalidate previous ChannelMonitors are not made when a channel has
     * been \"frozen\".
     *
-    * Note that even if updates made after TemporaryFailure succeed you must still call
-    * channel_monitor_updated to ensure you have the latest monitor and re-enable normal channel
-    * operation.
+    * Note that 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 call
-    * ChannelManager::channel_monitor_updated, so you must store the update itself along
-    * with the persisted ChannelMonitor on your own local disk prior to returning a
+    * 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.
@@ -67,6 +69,8 @@ typedef enum LDKChannelMonitorUpdateErr {
     * 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.
+    *
+    * [`ChainMonitor::channel_monitor_updated`]: chainmonitor::ChainMonitor::channel_monitor_updated
     */
    LDKChannelMonitorUpdateErr_TemporaryFailure,
    /**
@@ -1529,6 +1533,100 @@ typedef struct LDKCResult_RouteDecodeErrorZ {
    bool result_ok;
 } LDKCResult_RouteDecodeErrorZ;
 
+
+
+/**
+ * Parameters needed to find a [`Route`] for paying a [`Payee`].
+ *
+ * Passed to [`find_route`] and also provided in [`Event::PaymentPathFailed`] for retrying a failed
+ * payment path.
+ *
+ * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
+ */
+typedef struct MUST_USE_STRUCT LDKRouteParameters {
+   /**
+    * 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.
+    */
+   LDKnativeRouteParameters *inner;
+   /**
+    * Indicates that this is the only struct which contains the same pointer.
+    * Rust functions which take ownership of an object provided via an argument require
+    * this to be true and invalidate the object pointed to by inner.
+    */
+   bool is_owned;
+} LDKRouteParameters;
+
+/**
+ * The contents of CResult_RouteParametersDecodeErrorZ
+ */
+typedef union LDKCResult_RouteParametersDecodeErrorZPtr {
+   /**
+    * A pointer to the contents in the success state.
+    * Reading from this pointer when `result_ok` is not set is undefined.
+    */
+   struct LDKRouteParameters *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_RouteParametersDecodeErrorZPtr;
+
+/**
+ * A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::routing::router::RouteParameters 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_RouteParametersDecodeErrorZ {
+   /**
+    * The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
+    * `err` or `result` depending on the state of `result_ok`.
+    */
+   union LDKCResult_RouteParametersDecodeErrorZPtr contents;
+   /**
+    * Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
+    */
+   bool result_ok;
+} LDKCResult_RouteParametersDecodeErrorZ;
+
+
+
+/**
+ * A list of hops along a payment path terminating with a channel to the recipient.
+ */
+typedef struct MUST_USE_STRUCT LDKRouteHint {
+   /**
+    * 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.
+    */
+   LDKnativeRouteHint *inner;
+   /**
+    * Indicates that this is the only struct which contains the same pointer.
+    * Rust functions which take ownership of an object provided via an argument require
+    * this to be true and invalidate the object pointed to by inner.
+    */
+   bool is_owned;
+} LDKRouteHint;
+
+/**
+ * A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
+ * This corresponds to std::vector in C++
+ */
+typedef struct LDKCVec_RouteHintZ {
+   /**
+    * The elements in the array.
+    * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+    */
+   struct LDKRouteHint *data;
+   /**
+    * The number of elements pointed to by `data`.
+    */
+   uintptr_t datalen;
+} LDKCVec_RouteHintZ;
+
 /**
  * An enum which can either contain a u64 or not
  */
@@ -1559,74 +1657,193 @@ typedef struct LDKCOption_u64Z {
 
 
 /**
- * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels
+ * The recipient of a payment.
  */
-typedef struct MUST_USE_STRUCT LDKChannelDetails {
+typedef struct MUST_USE_STRUCT LDKPayee {
    /**
     * 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.
     */
-   LDKnativeChannelDetails *inner;
+   LDKnativePayee *inner;
    /**
     * Indicates that this is the only struct which contains the same pointer.
     * Rust functions which take ownership of an object provided via an argument require
     * this to be true and invalidate the object pointed to by inner.
     */
    bool is_owned;
-} LDKChannelDetails;
+} LDKPayee;
 
 /**
- * A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
+ * The contents of CResult_PayeeDecodeErrorZ
+ */
+typedef union LDKCResult_PayeeDecodeErrorZPtr {
+   /**
+    * A pointer to the contents in the success state.
+    * Reading from this pointer when `result_ok` is not set is undefined.
+    */
+   struct LDKPayee *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_PayeeDecodeErrorZPtr;
+
+/**
+ * A CResult_PayeeDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::routing::router::Payee 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_PayeeDecodeErrorZ {
+   /**
+    * The contents of this CResult_PayeeDecodeErrorZ, accessible via either
+    * `err` or `result` depending on the state of `result_ok`.
+    */
+   union LDKCResult_PayeeDecodeErrorZPtr contents;
+   /**
+    * Whether this CResult_PayeeDecodeErrorZ represents a success state.
+    */
+   bool result_ok;
+} LDKCResult_PayeeDecodeErrorZ;
+
+
+
+/**
+ * A channel descriptor for a hop along a payment path.
+ */
+typedef struct MUST_USE_STRUCT LDKRouteHintHop {
+   /**
+    * 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.
+    */
+   LDKnativeRouteHintHop *inner;
+   /**
+    * Indicates that this is the only struct which contains the same pointer.
+    * Rust functions which take ownership of an object provided via an argument require
+    * this to be true and invalidate the object pointed to by inner.
+    */
+   bool is_owned;
+} LDKRouteHintHop;
+
+/**
+ * A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
  * This corresponds to std::vector in C++
  */
-typedef struct LDKCVec_ChannelDetailsZ {
+typedef struct LDKCVec_RouteHintHopZ {
    /**
     * The elements in the array.
     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
     */
-   struct LDKChannelDetails *data;
+   struct LDKRouteHintHop *data;
    /**
     * The number of elements pointed to by `data`.
     */
    uintptr_t datalen;
-} LDKCVec_ChannelDetailsZ;
+} LDKCVec_RouteHintHopZ;
+
+/**
+ * The contents of CResult_RouteHintDecodeErrorZ
+ */
+typedef union LDKCResult_RouteHintDecodeErrorZPtr {
+   /**
+    * A pointer to the contents in the success state.
+    * Reading from this pointer when `result_ok` is not set is undefined.
+    */
+   struct LDKRouteHint *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_RouteHintDecodeErrorZPtr;
 
+/**
+ * A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::routing::router::RouteHint 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_RouteHintDecodeErrorZ {
+   /**
+    * The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
+    * `err` or `result` depending on the state of `result_ok`.
+    */
+   union LDKCResult_RouteHintDecodeErrorZPtr contents;
+   /**
+    * Whether this CResult_RouteHintDecodeErrorZ represents a success state.
+    */
+   bool result_ok;
+} LDKCResult_RouteHintDecodeErrorZ;
 
+/**
+ * The contents of CResult_RouteHintHopDecodeErrorZ
+ */
+typedef union LDKCResult_RouteHintHopDecodeErrorZPtr {
+   /**
+    * A pointer to the contents in the success state.
+    * Reading from this pointer when `result_ok` is not set is undefined.
+    */
+   struct LDKRouteHintHop *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_RouteHintHopDecodeErrorZPtr;
 
 /**
- * A list of hops along a payment path terminating with a channel to the recipient.
+ * A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
  */
-typedef struct MUST_USE_STRUCT LDKRouteHint {
+typedef struct LDKCResult_RouteHintHopDecodeErrorZ {
+   /**
+    * The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
+    * `err` or `result` depending on the state of `result_ok`.
+    */
+   union LDKCResult_RouteHintHopDecodeErrorZPtr contents;
+   /**
+    * Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
+    */
+   bool result_ok;
+} LDKCResult_RouteHintHopDecodeErrorZ;
+
+
+
+/**
+ * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels
+ */
+typedef struct MUST_USE_STRUCT LDKChannelDetails {
    /**
     * 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.
     */
-   LDKnativeRouteHint *inner;
+   LDKnativeChannelDetails *inner;
    /**
     * Indicates that this is the only struct which contains the same pointer.
     * Rust functions which take ownership of an object provided via an argument require
     * this to be true and invalidate the object pointed to by inner.
     */
    bool is_owned;
-} LDKRouteHint;
+} LDKChannelDetails;
 
 /**
- * A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
+ * A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
  * This corresponds to std::vector in C++
  */
-typedef struct LDKCVec_RouteHintZ {
+typedef struct LDKCVec_ChannelDetailsZ {
    /**
     * The elements in the array.
     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
     */
-   struct LDKRouteHint *data;
+   struct LDKChannelDetails *data;
    /**
     * The number of elements pointed to by `data`.
     */
    uintptr_t datalen;
-} LDKCVec_RouteHintZ;
+} LDKCVec_ChannelDetailsZ;
 
 
 
@@ -1860,12 +2077,41 @@ typedef enum LDKMonitorEvent_Tag {
     * A monitor event that the Channel's commitment transaction was confirmed.
     */
    LDKMonitorEvent_CommitmentTxConfirmed,
+   /**
+    * Indicates a [`ChannelMonitor`] update has completed. See
+    * [`ChannelMonitorUpdateErr::TemporaryFailure`] for more information on how this is used.
+    *
+    * [`ChannelMonitorUpdateErr::TemporaryFailure`]: super::ChannelMonitorUpdateErr::TemporaryFailure
+    */
+   LDKMonitorEvent_UpdateCompleted,
+   /**
+    * Indicates a [`ChannelMonitor`] update has failed. See
+    * [`ChannelMonitorUpdateErr::PermanentFailure`] for more information on how this is used.
+    *
+    * [`ChannelMonitorUpdateErr::PermanentFailure`]: super::ChannelMonitorUpdateErr::PermanentFailure
+    */
+   LDKMonitorEvent_UpdateFailed,
    /**
     * Must be last for serialization purposes
     */
    LDKMonitorEvent_Sentinel,
 } LDKMonitorEvent_Tag;
 
+typedef struct LDKMonitorEvent_LDKUpdateCompleted_Body {
+   /**
+    * The funding outpoint of the [`ChannelMonitor`] that was updated
+    */
+   struct LDKOutPoint funding_txo;
+   /**
+    * The Update ID from [`ChannelMonitorUpdate::update_id`] which was applied or
+    * [`ChannelMonitor::get_latest_update_id`].
+    *
+    * Note that this should only be set to a given update's ID if all previous updates for the
+    * same [`ChannelMonitor`] have been applied and persisted.
+    */
+   uint64_t monitor_update_id;
+} LDKMonitorEvent_LDKUpdateCompleted_Body;
+
 typedef struct MUST_USE_STRUCT LDKMonitorEvent {
    LDKMonitorEvent_Tag tag;
    union {
@@ -1875,6 +2121,10 @@ typedef struct MUST_USE_STRUCT LDKMonitorEvent {
       struct {
          struct LDKOutPoint commitment_tx_confirmed;
       };
+      LDKMonitorEvent_LDKUpdateCompleted_Body update_completed;
+      struct {
+         struct LDKOutPoint update_failed;
+      };
    };
 } LDKMonitorEvent;
 
@@ -3148,76 +3398,189 @@ typedef struct LDKCResult_InvoiceFeaturesDecodeErrorZ {
    bool result_ok;
 } LDKCResult_InvoiceFeaturesDecodeErrorZ;
 
-/**
- * The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
- */
-typedef union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
-   /**
-    * A pointer to the contents in the success state.
-    * Reading from this pointer when `result_ok` is not set is undefined.
-    */
-   struct LDKDelayedPaymentOutputDescriptor *result;
-   /**
-    * A pointer to the contents in the error state.
-    * Reading from this pointer when `result_ok` is set is undefined.
-    */
-   struct LDKDecodeError *err;
-} LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr;
+
 
 /**
- * A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
- * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ * Parameters for configuring [`Scorer`].
  */
-typedef struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
+typedef struct MUST_USE_STRUCT LDKScoringParameters {
    /**
-    * The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
-    * `err` or `result` depending on the state of `result_ok`.
+    * A pointer to the opaque Rust object.
+    * Nearly everywhere, inner must be non-null, however in places where
+    * the Rust equivalent takes an Option, it may be set to null to indicate None.
     */
-   union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr contents;
+   LDKnativeScoringParameters *inner;
    /**
-    * Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
+    * Indicates that this is the only struct which contains the same pointer.
+    * Rust functions which take ownership of an object provided via an argument require
+    * this to be true and invalidate the object pointed to by inner.
     */
-   bool result_ok;
-} LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ;
+   bool is_owned;
+} LDKScoringParameters;
 
 /**
- * The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
+ * The contents of CResult_ScoringParametersDecodeErrorZ
  */
-typedef union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
+typedef union LDKCResult_ScoringParametersDecodeErrorZPtr {
    /**
     * A pointer to the contents in the success state.
     * Reading from this pointer when `result_ok` is not set is undefined.
     */
-   struct LDKStaticPaymentOutputDescriptor *result;
+   struct LDKScoringParameters *result;
    /**
     * A pointer to the contents in the error state.
     * Reading from this pointer when `result_ok` is set is undefined.
     */
    struct LDKDecodeError *err;
-} LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr;
+} LDKCResult_ScoringParametersDecodeErrorZPtr;
 
 /**
- * A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * A CResult_ScoringParametersDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::routing::scorer::ScoringParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
  */
-typedef struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ {
+typedef struct LDKCResult_ScoringParametersDecodeErrorZ {
    /**
-    * The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
+    * The contents of this CResult_ScoringParametersDecodeErrorZ, accessible via either
     * `err` or `result` depending on the state of `result_ok`.
     */
-   union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr contents;
+   union LDKCResult_ScoringParametersDecodeErrorZPtr contents;
    /**
-    * Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
+    * Whether this CResult_ScoringParametersDecodeErrorZ represents a success state.
     */
    bool result_ok;
-} LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ;
+} LDKCResult_ScoringParametersDecodeErrorZ;
+
+
 
 /**
- * The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
+ * [`routing::Score`] implementation that provides reasonable default behavior.
+ *
+ * Used to apply a fixed penalty to each channel, thus avoiding long paths when shorter paths with
+ * slightly higher fees are available. Will further penalize channels that fail to relay payments.
+ *
+ * See [module-level documentation] for usage.
+ *
+ * [module-level documentation]: crate::routing::scorer
  */
-typedef union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr {
+typedef struct MUST_USE_STRUCT LDKScorer {
+   /**
+    * A pointer to the opaque Rust object.
+    * Nearly everywhere, inner must be non-null, however in places where
+    * the Rust equivalent takes an Option, it may be set to null to indicate None.
+    */
+   LDKnativeScorer *inner;
+   /**
+    * Indicates that this is the only struct which contains the same pointer.
+    * Rust functions which take ownership of an object provided via an argument require
+    * this to be true and invalidate the object pointed to by inner.
+    */
+   bool is_owned;
+} LDKScorer;
+
+/**
+ * The contents of CResult_ScorerDecodeErrorZ
+ */
+typedef union LDKCResult_ScorerDecodeErrorZPtr {
+   /**
+    * A pointer to the contents in the success state.
+    * Reading from this pointer when `result_ok` is not set is undefined.
+    */
+   struct LDKScorer *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_ScorerDecodeErrorZPtr;
+
+/**
+ * A CResult_ScorerDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::routing::scorer::Scorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_ScorerDecodeErrorZ {
+   /**
+    * The contents of this CResult_ScorerDecodeErrorZ, accessible via either
+    * `err` or `result` depending on the state of `result_ok`.
+    */
+   union LDKCResult_ScorerDecodeErrorZPtr contents;
+   /**
+    * Whether this CResult_ScorerDecodeErrorZ represents a success state.
+    */
+   bool result_ok;
+} LDKCResult_ScorerDecodeErrorZ;
+
+/**
+ * The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
+ */
+typedef union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
+   /**
+    * A pointer to the contents in the success state.
+    * Reading from this pointer when `result_ok` is not set is undefined.
+    */
+   struct LDKDelayedPaymentOutputDescriptor *result;
+   /**
+    * A pointer to the contents in the error state.
+    * Reading from this pointer when `result_ok` is set is undefined.
+    */
+   struct LDKDecodeError *err;
+} LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr;
+
+/**
+ * A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
+   /**
+    * The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
+    * `err` or `result` depending on the state of `result_ok`.
+    */
+   union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr contents;
+   /**
+    * Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
+    */
+   bool result_ok;
+} LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ;
+
+/**
+ * The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
+ */
+typedef union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
+   /**
+    * A pointer to the contents in the success state.
+    * Reading from this pointer when `result_ok` is not set is undefined.
+    */
+   struct LDKStaticPaymentOutputDescriptor *result;
+   /**
+    * A pointer to the contents in the error state.
+    * Reading from this pointer when `result_ok` is set is undefined.
+    */
+   struct LDKDecodeError *err;
+} LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr;
+
+/**
+ * A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ {
+   /**
+    * The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
+    * `err` or `result` depending on the state of `result_ok`.
+    */
+   union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr contents;
+   /**
+    * Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
+    */
+   bool result_ok;
+} LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ;
+
+/**
+ * The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
+ */
+typedef union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr {
    /**
     * A pointer to the contents in the success state.
     * Reading from this pointer when `result_ok` is not set is undefined.
@@ -3951,59 +4314,6 @@ typedef struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
    bool result_ok;
 } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ;
 
-
-
-/**
- * A payment identifier used to uniquely identify a payment to LDK.
- */
-typedef struct MUST_USE_STRUCT LDKPaymentId {
-   /**
-    * 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.
-    */
-   LDKnativePaymentId *inner;
-   /**
-    * Indicates that this is the only struct which contains the same pointer.
-    * Rust functions which take ownership of an object provided via an argument require
-    * this to be true and invalidate the object pointed to by inner.
-    */
-   bool is_owned;
-} LDKPaymentId;
-
-/**
- * The contents of CResult_PaymentIdDecodeErrorZ
- */
-typedef union LDKCResult_PaymentIdDecodeErrorZPtr {
-   /**
-    * A pointer to the contents in the success state.
-    * Reading from this pointer when `result_ok` is not set is undefined.
-    */
-   struct LDKPaymentId *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_PaymentIdDecodeErrorZPtr;
-
-/**
- * A CResult_PaymentIdDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::lightning::ln::channelmanager::PaymentId 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_PaymentIdDecodeErrorZ {
-   /**
-    * The contents of this CResult_PaymentIdDecodeErrorZ, accessible via either
-    * `err` or `result` depending on the state of `result_ok`.
-    */
-   union LDKCResult_PaymentIdDecodeErrorZPtr contents;
-   /**
-    * Whether this CResult_PaymentIdDecodeErrorZ represents a success state.
-    */
-   bool result_ok;
-} LDKCResult_PaymentIdDecodeErrorZ;
-
 /**
  * An enum which can either contain a u16 or not
  */
@@ -4276,6 +4586,25 @@ typedef enum LDKPaymentSendFailure_Tag {
    LDKPaymentSendFailure_Sentinel,
 } LDKPaymentSendFailure_Tag;
 
+typedef struct LDKPaymentSendFailure_LDKPartialFailure_Body {
+   /**
+    * The errors themselves, in the same order as the route hops.
+    */
+   struct LDKCVec_CResult_NoneAPIErrorZZ results;
+   /**
+    * If some paths failed without irrevocably committing to the new HTLC(s), this will
+    * contain a [`RouteParameters`] object which can be used to calculate a new route that
+    * will pay all remaining unpaid balance.
+    *
+    * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
+    */
+   struct LDKRouteParameters failed_paths_retry;
+   /**
+    * The payment id for the payment, which is now at least partially pending.
+    */
+   struct LDKThirtyTwoBytes payment_id;
+} LDKPaymentSendFailure_LDKPartialFailure_Body;
+
 typedef struct MUST_USE_STRUCT LDKPaymentSendFailure {
    LDKPaymentSendFailure_Tag tag;
    union {
@@ -4288,9 +4617,7 @@ typedef struct MUST_USE_STRUCT LDKPaymentSendFailure {
       struct {
          struct LDKCVec_APIErrorZ all_failed_retry_safe;
       };
-      struct {
-         struct LDKCVec_CResult_NoneAPIErrorZZ partial_failure;
-      };
+      LDKPaymentSendFailure_LDKPartialFailure_Body partial_failure;
    };
 } LDKPaymentSendFailure;
 
@@ -4302,7 +4629,7 @@ typedef union LDKCResult_PaymentIdPaymentSendFailureZPtr {
     * A pointer to the contents in the success state.
     * Reading from this pointer when `result_ok` is not set is undefined.
     */
-   struct LDKPaymentId *result;
+   struct LDKThirtyTwoBytes *result;
    /**
     * A pointer to the contents in the error state.
     * Reading from this pointer when `result_ok` is set is undefined.
@@ -4312,7 +4639,7 @@ typedef union LDKCResult_PaymentIdPaymentSendFailureZPtr {
 
 /**
  * A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation,
- * containing a crate::lightning::ln::channelmanager::PaymentId on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
+ * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
  */
 typedef struct LDKCResult_PaymentIdPaymentSendFailureZ {
@@ -4370,7 +4697,7 @@ typedef struct LDKC2Tuple_PaymentHashPaymentIdZ {
    /**
     * The element at position 1
     */
-   struct LDKPaymentId b;
+   struct LDKThirtyTwoBytes b;
 } LDKC2Tuple_PaymentHashPaymentIdZ;
 
 /**
@@ -4680,6 +5007,13 @@ typedef struct LDKWatch {
    /**
     * Returns any monitor events since the last call. Subsequent calls must only return new
     * events.
+    *
+    * Note that after any block- or transaction-connection calls to a [`ChannelMonitor`], no
+    * further events may be returned here until the [`ChannelMonitor`] has been fully persisted
+    * to disk.
+    *
+    * For details on asynchronous [`ChannelMonitor`] updating and returning
+    * [`MonitorEvent::UpdateCompleted`] here, see [`ChannelMonitorUpdateErr::TemporaryFailure`].
     */
    struct LDKCVec_MonitorEventZ (*release_pending_monitor_events)(const void *this_arg);
    /**
@@ -5121,6 +5455,76 @@ typedef struct LDKCResult_COption_TypeZDecodeErrorZ {
    bool result_ok;
 } LDKCResult_COption_TypeZDecodeErrorZ;
 
+/**
+ * An error that may occur when making a payment.
+ */
+typedef enum LDKPaymentError_Tag {
+   /**
+    * An error resulting from the provided [`Invoice`] or payment hash.
+    */
+   LDKPaymentError_Invoice,
+   /**
+    * An error occurring when finding a route.
+    */
+   LDKPaymentError_Routing,
+   /**
+    * An error occurring when sending a payment.
+    */
+   LDKPaymentError_Sending,
+   /**
+    * Must be last for serialization purposes
+    */
+   LDKPaymentError_Sentinel,
+} LDKPaymentError_Tag;
+
+typedef struct MUST_USE_STRUCT LDKPaymentError {
+   LDKPaymentError_Tag tag;
+   union {
+      struct {
+         struct LDKStr invoice;
+      };
+      struct {
+         struct LDKLightningError routing;
+      };
+      struct {
+         struct LDKPaymentSendFailure sending;
+      };
+   };
+} LDKPaymentError;
+
+/**
+ * The contents of CResult_PaymentIdPaymentErrorZ
+ */
+typedef union LDKCResult_PaymentIdPaymentErrorZPtr {
+   /**
+    * A pointer to the contents in the success state.
+    * Reading from this pointer when `result_ok` is not set is undefined.
+    */
+   struct LDKThirtyTwoBytes *result;
+   /**
+    * A pointer to the contents in the error state.
+    * Reading from this pointer when `result_ok` is set is undefined.
+    */
+   struct LDKPaymentError *err;
+} LDKCResult_PaymentIdPaymentErrorZPtr;
+
+/**
+ * A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
+ * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_PaymentIdPaymentErrorZ {
+   /**
+    * The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
+    * `err` or `result` depending on the state of `result_ok`.
+    */
+   union LDKCResult_PaymentIdPaymentErrorZPtr contents;
+   /**
+    * Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
+    */
+   bool result_ok;
+} LDKCResult_PaymentIdPaymentErrorZ;
+
 /**
  * The contents of CResult_SiPrefixNoneZ
  */
@@ -6182,6 +6586,16 @@ typedef struct LDKEvent_LDKPaymentReceived_Body {
 } LDKEvent_LDKPaymentReceived_Body;
 
 typedef struct LDKEvent_LDKPaymentSent_Body {
+   /**
+    * The id returned by [`ChannelManager::send_payment`] and used with
+    * [`ChannelManager::retry_payment`].
+    *
+    * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
+    * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
+    *
+    * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
+    */
+   struct LDKThirtyTwoBytes payment_id;
    /**
     * The preimage to the hash given to ChannelManager::send_payment.
     * Note that this serves as a payment receipt, if you wish to have such a thing, you must
@@ -6194,9 +6608,31 @@ typedef struct LDKEvent_LDKPaymentSent_Body {
     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
     */
    struct LDKThirtyTwoBytes payment_hash;
+   /**
+    * The total fee which was spent at intermediate hops in this payment, across all paths.
+    *
+    * Note that, like [`Route::get_total_fees`] this does *not* include any potential
+    * overpayment to the recipient node.
+    *
+    * If the recipient or an intermediate node misbehaves and gives us free money, this may
+    * overstate the amount paid, though this is unlikely.
+    *
+    * [`Route::get_total_fees`]: crate::routing::router::Route::get_total_fees
+    */
+   struct LDKCOption_u64Z fee_paid_msat;
 } LDKEvent_LDKPaymentSent_Body;
 
 typedef struct LDKEvent_LDKPaymentPathFailed_Body {
+   /**
+    * The id returned by [`ChannelManager::send_payment`] and used with
+    * [`ChannelManager::retry_payment`].
+    *
+    * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
+    * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
+    *
+    * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
+    */
+   struct LDKThirtyTwoBytes payment_id;
    /**
     * The hash which was given to ChannelManager::send_payment.
     */
@@ -6235,6 +6671,17 @@ typedef struct LDKEvent_LDKPaymentPathFailed_Body {
     * retried. May be `None` for older [`Event`] serializations.
     */
    struct LDKCOption_u64Z short_channel_id;
+   /**
+    * Parameters needed to compute a new [`Route`] when retrying the failed payment path.
+    *
+    * See [`find_route`] for details.
+    *
+    * [`Route`]: crate::routing::router::Route
+    * [`find_route`]: crate::routing::router::find_route
+    *
+    * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
+    */
+   struct LDKRouteParameters retry;
 } LDKEvent_LDKPaymentPathFailed_Body;
 
 typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body {
@@ -7312,9 +7759,9 @@ typedef struct LDKCOption_CVec_NetAddressZZ {
 } LDKCOption_CVec_NetAddressZZ;
 
 /**
- * The contents of CResult_NetAddressu8Z
+ * The contents of CResult_NetAddressDecodeErrorZ
  */
-typedef union LDKCResult_NetAddressu8ZPtr {
+typedef union LDKCResult_NetAddressDecodeErrorZPtr {
    /**
     * A pointer to the contents in the success state.
     * Reading from this pointer when `result_ok` is not set is undefined.
@@ -7324,111 +7771,45 @@ typedef union LDKCResult_NetAddressu8ZPtr {
     * A pointer to the contents in the error state.
     * Reading from this pointer when `result_ok` is set is undefined.
     */
-   uint8_t *err;
-} LDKCResult_NetAddressu8ZPtr;
+   struct LDKDecodeError *err;
+} LDKCResult_NetAddressDecodeErrorZPtr;
 
 /**
- * A CResult_NetAddressu8Z represents the result of a fallible operation,
- * containing a crate::lightning::ln::msgs::NetAddress on success and a u8 on failure.
+ * A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::NetAddress 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_NetAddressu8Z {
+typedef struct LDKCResult_NetAddressDecodeErrorZ {
    /**
-    * The contents of this CResult_NetAddressu8Z, accessible via either
+    * The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
     * `err` or `result` depending on the state of `result_ok`.
     */
-   union LDKCResult_NetAddressu8ZPtr contents;
+   union LDKCResult_NetAddressDecodeErrorZPtr contents;
    /**
-    * Whether this CResult_NetAddressu8Z represents a success state.
+    * Whether this CResult_NetAddressDecodeErrorZ represents a success state.
     */
    bool result_ok;
-} LDKCResult_NetAddressu8Z;
+} LDKCResult_NetAddressDecodeErrorZ;
+
+
 
 /**
- * The contents of CResult_CResult_NetAddressu8ZDecodeErrorZ
+ * An update_add_htlc message to be sent or received from a peer
  */
-typedef union LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr {
+typedef struct MUST_USE_STRUCT LDKUpdateAddHTLC {
    /**
-    * A pointer to the contents in the success state.
-    * Reading from this pointer when `result_ok` is not set is undefined.
+    * A pointer to the opaque Rust object.
+    * Nearly everywhere, inner must be non-null, however in places where
+    * the Rust equivalent takes an Option, it may be set to null to indicate None.
     */
-   struct LDKCResult_NetAddressu8Z *result;
+   LDKnativeUpdateAddHTLC *inner;
    /**
-    * A pointer to the contents in the error state.
-    * Reading from this pointer when `result_ok` is set is undefined.
+    * Indicates that this is the only struct which contains the same pointer.
+    * Rust functions which take ownership of an object provided via an argument require
+    * this to be true and invalidate the object pointed to by inner.
     */
-   struct LDKDecodeError *err;
-} LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr;
-
-/**
- * A CResult_CResult_NetAddressu8ZDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::c_types::derived::CResult_NetAddressu8Z 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_CResult_NetAddressu8ZDecodeErrorZ {
-   /**
-    * The contents of this CResult_CResult_NetAddressu8ZDecodeErrorZ, accessible via either
-    * `err` or `result` depending on the state of `result_ok`.
-    */
-   union LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr contents;
-   /**
-    * Whether this CResult_CResult_NetAddressu8ZDecodeErrorZ represents a success state.
-    */
-   bool result_ok;
-} LDKCResult_CResult_NetAddressu8ZDecodeErrorZ;
-
-/**
- * The contents of CResult_NetAddressDecodeErrorZ
- */
-typedef union LDKCResult_NetAddressDecodeErrorZPtr {
-   /**
-    * A pointer to the contents in the success state.
-    * Reading from this pointer when `result_ok` is not set is undefined.
-    */
-   struct LDKNetAddress *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_NetAddressDecodeErrorZPtr;
-
-/**
- * A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::lightning::ln::msgs::NetAddress 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_NetAddressDecodeErrorZ {
-   /**
-    * The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
-    * `err` or `result` depending on the state of `result_ok`.
-    */
-   union LDKCResult_NetAddressDecodeErrorZPtr contents;
-   /**
-    * Whether this CResult_NetAddressDecodeErrorZ represents a success state.
-    */
-   bool result_ok;
-} LDKCResult_NetAddressDecodeErrorZ;
-
-
-
-/**
- * An update_add_htlc message to be sent or received from a peer
- */
-typedef struct MUST_USE_STRUCT LDKUpdateAddHTLC {
-   /**
-    * 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.
-    */
-   LDKnativeUpdateAddHTLC *inner;
-   /**
-    * Indicates that this is the only struct which contains the same pointer.
-    * Rust functions which take ownership of an object provided via an argument require
-    * this to be true and invalidate the object pointed to by inner.
-    */
-   bool is_owned;
-} LDKUpdateAddHTLC;
+   bool is_owned;
+} LDKUpdateAddHTLC;
 
 /**
  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
@@ -9370,18 +9751,46 @@ typedef struct LDKConfirm {
    void (*free)(void *this_arg);
 } LDKConfirm;
 
+
+
+/**
+ * An opaque identifier describing a specific [`Persist`] method call.
+ */
+typedef struct MUST_USE_STRUCT LDKMonitorUpdateId {
+   /**
+    * 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.
+    */
+   LDKnativeMonitorUpdateId *inner;
+   /**
+    * Indicates that this is the only struct which contains the same pointer.
+    * Rust functions which take ownership of an object provided via an argument require
+    * this to be true and invalidate the object pointed to by inner.
+    */
+   bool is_owned;
+} LDKMonitorUpdateId;
+
 /**
  * `Persist` defines behavior for persisting channel monitors: this could mean
  * writing once to disk, and/or uploading to one or more backup services.
  *
- * Note that for every new monitor, you **must** persist the new `ChannelMonitor`
- * to disk/backups. And, on every update, you **must** persist either the
- * `ChannelMonitorUpdate` or the updated monitor itself. Otherwise, there is risk
- * of situations such as revoking a transaction, then crashing before this
- * revocation can be persisted, then unintentionally broadcasting a revoked
- * transaction and losing money. This is a risk because previous channel states
- * are toxic, so it's important that whatever channel state is persisted is
- * kept up-to-date.
+ * 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.
+ *  * 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`].
+ *
+ *    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
+ *    closed without broadcasting the latest state. See
+ *    [`ChannelMonitorUpdateErr::PermanentFailure`] for more details.
  */
 typedef struct LDKPersist {
    /**
@@ -9390,25 +9799,36 @@ typedef struct LDKPersist {
     */
    void *this_arg;
    /**
-    * Persist a new channel's data. The data can be stored any way you want, but
-    * the identifier provided by Rust-Lightning is the channel's outpoint (and
-    * it is up to you to maintain a correct mapping between the outpoint and the
-    * stored channel data). Note that you **must** persist every new monitor to
-    * disk. See the `Persist` trait documentation for more details.
+    * Persist a new channel's data in response to a [`chain::Watch::watch_channel`] call. This is
+    * called by [`ChannelManager`] for new channels, or may be called directly, e.g. on startup.
+    *
+    * The data can be stored any way you want, but the identifier provided by LDK is the
+    * channel's outpoint (and it is up to you to maintain a correct mapping between the outpoint
+    * and the stored channel data). Note that you **must** persist every new monitor to disk.
+    *
+    * The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`],
+    * if you return [`ChannelMonitorUpdateErr::TemporaryFailure`].
     *
     * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`
     * and [`ChannelMonitorUpdateErr`] 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 id, const struct LDKChannelMonitor *NONNULL_PTR data);
+   struct LDKCResult_NoneChannelMonitorUpdateErrZ (*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.
+    * Update one channel's data. The provided [`ChannelMonitor`] has already applied the given
+    * update.
+    *
+    * Note that on every update, you **must** persist either the [`ChannelMonitorUpdate`] or the
+    * updated monitor itself to disk/backups. See the [`Persist`] trait documentation for more
+    * details.
     *
-    * Note that on every update, you **must** persist either the
-    * `ChannelMonitorUpdate` or the updated monitor itself to disk/backups. See
-    * the `Persist` trait documentation for more details.
+    * During blockchain synchronization operations, this may be called with no
+    * [`ChannelMonitorUpdate`], in which case the full [`ChannelMonitor`] needs to be persisted.
+    * Note that after the full [`ChannelMonitor`] is persisted any previous
+    * [`ChannelMonitorUpdate`]s which were persisted should be discarded - they can no longer be
+    * applied to the persisted [`ChannelMonitor`] as they were already applied.
     *
     * If an implementer chooses to persist the updates only, they need to make
     * sure that all the updates are applied to the `ChannelMonitors` *before*
@@ -9422,13 +9842,18 @@ typedef struct LDKPersist {
     * them in batches. The size of each monitor grows `O(number of state updates)`
     * 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`].
+    *
     * 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.
     *
     * [`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 id, const struct LDKChannelMonitorUpdate *NONNULL_PTR update, const struct LDKChannelMonitor *NONNULL_PTR data);
+   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);
    /**
     * 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.
@@ -9678,20 +10103,25 @@ typedef struct LDKChannelMessageHandler {
  *
  * At a high-level, the process for deserializing a ChannelManager and resuming normal operation
  * is:
- * 1) Deserialize all stored ChannelMonitors.
- * 2) Deserialize the ChannelManager by filling in this struct and calling:
- *    <(BlockHash, ChannelManager)>::read(reader, args)
- *    This may result in closing some Channels if the ChannelMonitor is newer than the stored
- *    ChannelManager state to ensure no loss of funds. Thus, transactions may be broadcasted.
- * 3) If you are not fetching full blocks, register all relevant ChannelMonitor outpoints the same
- *    way you would handle a `chain::Filter` call using ChannelMonitor::get_outputs_to_watch() and
- *    ChannelMonitor::get_funding_txo().
- * 4) Reconnect blocks on your ChannelMonitors.
- * 5) Disconnect/connect blocks on the ChannelManager.
- * 6) Move the ChannelMonitors into your local chain::Watch.
- *
- * Note that the ordering of #4-6 is not of importance, however all three must occur before you
- * call any other methods on the newly-deserialized ChannelManager.
+ * 1) Deserialize all stored [`ChannelMonitor`]s.
+ * 2) Deserialize the [`ChannelManager`] by filling in this struct and calling:
+ *    `<(BlockHash, ChannelManager)>::read(reader, args)`
+ *    This may result in closing some channels if the [`ChannelMonitor`] is newer than the stored
+ *    [`ChannelManager`] state to ensure no loss of funds. Thus, transactions may be broadcasted.
+ * 3) If you are not fetching full blocks, register all relevant [`ChannelMonitor`] outpoints the
+ *    same way you would handle a [`chain::Filter`] call using
+ *    [`ChannelMonitor::get_outputs_to_watch`] and [`ChannelMonitor::get_funding_txo`].
+ * 4) Reconnect blocks on your [`ChannelMonitor`]s.
+ * 5) Disconnect/connect blocks on the [`ChannelManager`].
+ * 6) Re-persist the [`ChannelMonitor`]s to ensure the latest state is on disk.
+ *    Note that if you're using a [`ChainMonitor`] for your [`chain::Watch`] implementation, you
+ *    will likely accomplish this as a side-effect of calling [`chain::Watch::watch_channel`] in
+ *    the next step.
+ * 7) Move the [`ChannelMonitor`]s into your local [`chain::Watch`]. If you're using a
+ *    [`ChainMonitor`], this is done by calling [`chain::Watch::watch_channel`].
+ *
+ * Note that the ordering of #4-7 is not of importance, however all four must occur before you
+ * call any other methods on the newly-deserialized [`ChannelManager`].
  *
  * Note that because some channels may be closed during deserialization, it is critical that you
  * always deserialize only the latest version of a ChannelManager and ChannelMonitors available to
@@ -9699,6 +10129,8 @@ typedef struct LDKChannelMessageHandler {
  * broadcast), and then later deserialize a newer version of the same ChannelManager (which will
  * not force-close the same channels but consider them live), you may end up revoking a state for
  * which you've already broadcasted the transaction.
+ *
+ * [`ChainMonitor`]: crate::chain::chainmonitor::ChainMonitor
  */
 typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs {
    /**
@@ -10084,109 +10516,98 @@ typedef struct LDKScore {
     */
    void *this_arg;
    /**
-    * Returns the fee in msats willing to be paid to avoid routing through the given channel.
+    * Returns the fee in msats willing to be paid to avoid routing through the given channel
+    * in the direction from `source` to `target`.
     */
-   uint64_t (*channel_penalty_msat)(const void *this_arg, uint64_t short_channel_id);
+   uint64_t (*channel_penalty_msat)(const void *this_arg, uint64_t short_channel_id, const struct LDKNodeId *NONNULL_PTR source, const struct LDKNodeId *NONNULL_PTR target);
    /**
-    * 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.
+    * Handles updating channel penalties after failing to route through a channel.
     */
-   void (*free)(void *this_arg);
-} LDKScore;
-
-
-
-/**
- * A read-only view of [`NetworkGraph`].
- */
-typedef struct MUST_USE_STRUCT LDKReadOnlyNetworkGraph {
+   void (*payment_path_failed)(void *this_arg, struct LDKCVec_RouteHopZ path, uint64_t short_channel_id);
    /**
-    * 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.
+    * Serialize the object into a byte array
     */
-   LDKnativeReadOnlyNetworkGraph *inner;
+   struct LDKCVec_u8Z (*write)(const void *this_arg);
    /**
-    * Indicates that this is the only struct which contains the same pointer.
-    * Rust functions which take ownership of an object provided via an argument require
-    * this to be true and invalidate the object pointed to by inner.
+    * Frees any resources associated with this object given its this_arg pointer.
+    * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
     */
-   bool is_owned;
-} LDKReadOnlyNetworkGraph;
+   void (*free)(void *this_arg);
+} LDKScore;
 
 
 
 /**
- * Receives and validates network updates from peers,
- * stores authentic and relevant data as a network graph.
- * This network graph is then used for routing payments.
- * Provides interface to help with initial routing sync by
- * serving historical announcements.
+ * A scorer that is accessed under a lock.
  *
- * Serves as an [`EventHandler`] for applying updates from [`Event::PaymentPathFailed`] to the
- * [`NetworkGraph`].
+ * Needed so that calls to [`Score::channel_penalty_msat`] in [`find_route`] can be made while
+ * having shared ownership of a scorer but without requiring internal locking in [`Score`]
+ * implementations. Internal locking would be detrimental to route finding performance and could
+ * result in [`Score::channel_penalty_msat`] returning a different value for the same channel.
+ *
+ * [`find_route`]: crate::routing::router::find_route
  */
-typedef struct MUST_USE_STRUCT LDKNetGraphMsgHandler {
+typedef struct MUST_USE_STRUCT LDKLockableScore {
    /**
     * A pointer to the opaque Rust object.
     * Nearly everywhere, inner must be non-null, however in places where
     * the Rust equivalent takes an Option, it may be set to null to indicate None.
     */
-   LDKnativeNetGraphMsgHandler *inner;
+   LDKnativeLockableScore *inner;
    /**
     * Indicates that this is the only struct which contains the same pointer.
     * Rust functions which take ownership of an object provided via an argument require
     * this to be true and invalidate the object pointed to by inner.
     */
    bool is_owned;
-} LDKNetGraphMsgHandler;
+} LDKLockableScore;
 
 
 
 /**
- * A channel descriptor for a hop along a payment path.
+ * A read-only view of [`NetworkGraph`].
  */
-typedef struct MUST_USE_STRUCT LDKRouteHintHop {
+typedef struct MUST_USE_STRUCT LDKReadOnlyNetworkGraph {
    /**
     * 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.
     */
-   LDKnativeRouteHintHop *inner;
+   LDKnativeReadOnlyNetworkGraph *inner;
    /**
     * Indicates that this is the only struct which contains the same pointer.
     * Rust functions which take ownership of an object provided via an argument require
     * this to be true and invalidate the object pointed to by inner.
     */
    bool is_owned;
-} LDKRouteHintHop;
+} LDKReadOnlyNetworkGraph;
 
 
 
 /**
- * [`routing::Score`] implementation that provides reasonable default behavior.
- *
- * Used to apply a fixed penalty to each channel, thus avoiding long paths when shorter paths with
- * slightly higher fees are available.
- *
- * See [module-level documentation] for usage.
+ * Receives and validates network updates from peers,
+ * stores authentic and relevant data as a network graph.
+ * This network graph is then used for routing payments.
+ * Provides interface to help with initial routing sync by
+ * serving historical announcements.
  *
- * [module-level documentation]: crate::routing::scorer
+ * Serves as an [`EventHandler`] for applying updates from [`Event::PaymentPathFailed`] to the
+ * [`NetworkGraph`].
  */
-typedef struct MUST_USE_STRUCT LDKScorer {
+typedef struct MUST_USE_STRUCT LDKNetGraphMsgHandler {
    /**
     * A pointer to the opaque Rust object.
     * Nearly everywhere, inner must be non-null, however in places where
     * the Rust equivalent takes an Option, it may be set to null to indicate None.
     */
-   LDKnativeScorer *inner;
+   LDKnativeNetGraphMsgHandler *inner;
    /**
     * Indicates that this is the only struct which contains the same pointer.
     * Rust functions which take ownership of an object provided via an argument require
     * this to be true and invalidate the object pointed to by inner.
     */
    bool is_owned;
-} LDKScorer;
+} LDKNetGraphMsgHandler;
 
 
 
@@ -10394,6 +10815,126 @@ typedef struct MUST_USE_STRUCT LDKFallback {
    };
 } LDKFallback;
 
+/**
+ * A trait defining behavior of an [`Invoice`] payer.
+ */
+typedef struct LDKPayer {
+   /**
+    * 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 payer's node id.
+    */
+   struct LDKPublicKey (*node_id)(const void *this_arg);
+   /**
+    * Returns the payer's channels.
+    */
+   struct LDKCVec_ChannelDetailsZ (*first_hops)(const void *this_arg);
+   /**
+    * Sends a payment over the Lightning Network using the given [`Route`].
+    *
+    * Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None
+    */
+   struct LDKCResult_PaymentIdPaymentSendFailureZ (*send_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret);
+   /**
+    * Retries a failed payment path for the [`PaymentId`] using the given [`Route`].
+    */
+   struct LDKCResult_NonePaymentSendFailureZ (*retry_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_id);
+   /**
+    * Frees any resources associated with this object given its this_arg pointer.
+    * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+    */
+   void (*free)(void *this_arg);
+} LDKPayer;
+
+/**
+ * A trait defining behavior for routing an [`Invoice`] payment.
+ */
+typedef struct LDKRouter {
+   /**
+    * 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;
+   /**
+    * Finds a [`Route`] between `payer` and `payee` for a payment with the given values.
+    *
+    * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
+    */
+   struct LDKCResult_RouteLightningErrorZ (*find_route)(const void *this_arg, struct LDKPublicKey payer, const struct LDKRouteParameters *NONNULL_PTR params, struct LDKCVec_ChannelDetailsZ *first_hops, const struct LDKScore *NONNULL_PTR scorer);
+   /**
+    * Frees any resources associated with this object given its this_arg pointer.
+    * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+    */
+   void (*free)(void *this_arg);
+} LDKRouter;
+
+
+
+/**
+ * A utility for paying [`Invoice]`s.
+ */
+typedef struct MUST_USE_STRUCT LDKInvoicePayer {
+   /**
+    * 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.
+    */
+   LDKnativeInvoicePayer *inner;
+   /**
+    * Indicates that this is the only struct which contains the same pointer.
+    * Rust functions which take ownership of an object provided via an argument require
+    * this to be true and invalidate the object pointed to by inner.
+    */
+   bool is_owned;
+} LDKInvoicePayer;
+
+
+
+/**
+ * Number of attempts to retry payment path failures for an [`Invoice`].
+ *
+ * Note that this is the number of *path* failures, not full payment retries. For multi-path
+ * payments, if this is less than the total number of paths, we will never even retry all of the
+ * payment's paths.
+ */
+typedef struct MUST_USE_STRUCT LDKRetryAttempts {
+   /**
+    * 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.
+    */
+   LDKnativeRetryAttempts *inner;
+   /**
+    * Indicates that this is the only struct which contains the same pointer.
+    * Rust functions which take ownership of an object provided via an argument require
+    * this to be true and invalidate the object pointed to by inner.
+    */
+   bool is_owned;
+} LDKRetryAttempts;
+
+
+
+/**
+ * A [`Router`] implemented using [`find_route`].
+ */
+typedef struct MUST_USE_STRUCT LDKDefaultRouter {
+   /**
+    * 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.
+    */
+   LDKnativeDefaultRouter *inner;
+   /**
+    * Indicates that this is the only struct which contains the same pointer.
+    * Rust functions which take ownership of an object provided via an argument require
+    * this to be true and invalidate the object pointed to by inner.
+    */
+   bool is_owned;
+} LDKDefaultRouter;
+
 extern const uintptr_t MAX_BUF_SIZE;
 
 extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT;
@@ -10875,40 +11416,129 @@ void CResult_RouteDecodeErrorZ_free(struct LDKCResult_RouteDecodeErrorZ _res);
 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_clone(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR orig);
 
 /**
- * Constructs a new COption_u64Z containing a u64
+ * Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
  */
-struct LDKCOption_u64Z COption_u64Z_some(uint64_t o);
+struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_ok(struct LDKRouteParameters o);
 
 /**
- * Constructs a new COption_u64Z containing nothing
+ * Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
  */
-struct LDKCOption_u64Z COption_u64Z_none(void);
+struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_err(struct LDKDecodeError e);
 
 /**
- * Frees any resources associated with the u64, if we are in the Some state
+ * Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
  */
-void COption_u64Z_free(struct LDKCOption_u64Z _res);
+void CResult_RouteParametersDecodeErrorZ_free(struct LDKCResult_RouteParametersDecodeErrorZ _res);
 
 /**
- * Creates a new COption_u64Z which has the same data as `orig`
+ * Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
  * but with all dynamically-allocated buffers duplicated in new buffers.
  */
-struct LDKCOption_u64Z COption_u64Z_clone(const struct LDKCOption_u64Z *NONNULL_PTR orig);
+struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_clone(const struct LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR orig);
 
 /**
  * Frees the buffer pointed to by `data` if `datalen` is non-0.
  */
-void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res);
+void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res);
 
 /**
- * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ * Constructs a new COption_u64Z containing a u64
  */
-void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res);
+struct LDKCOption_u64Z COption_u64Z_some(uint64_t o);
 
 /**
- * Creates a new CResult_RouteLightningErrorZ in the success state.
+ * Constructs a new COption_u64Z containing nothing
  */
-struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LDKRoute o);
+struct LDKCOption_u64Z COption_u64Z_none(void);
+
+/**
+ * Frees any resources associated with the u64, if we are in the Some state
+ */
+void COption_u64Z_free(struct LDKCOption_u64Z _res);
+
+/**
+ * Creates a new COption_u64Z which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCOption_u64Z COption_u64Z_clone(const struct LDKCOption_u64Z *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_PayeeDecodeErrorZ in the success state.
+ */
+struct LDKCResult_PayeeDecodeErrorZ CResult_PayeeDecodeErrorZ_ok(struct LDKPayee o);
+
+/**
+ * Creates a new CResult_PayeeDecodeErrorZ in the error state.
+ */
+struct LDKCResult_PayeeDecodeErrorZ CResult_PayeeDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Frees any resources used by the CResult_PayeeDecodeErrorZ.
+ */
+void CResult_PayeeDecodeErrorZ_free(struct LDKCResult_PayeeDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_PayeeDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_PayeeDecodeErrorZ CResult_PayeeDecodeErrorZ_clone(const struct LDKCResult_PayeeDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ */
+void CVec_RouteHintHopZ_free(struct LDKCVec_RouteHintHopZ _res);
+
+/**
+ * Creates a new CResult_RouteHintDecodeErrorZ in the success state.
+ */
+struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_ok(struct LDKRouteHint o);
+
+/**
+ * Creates a new CResult_RouteHintDecodeErrorZ in the error state.
+ */
+struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Frees any resources used by the CResult_RouteHintDecodeErrorZ.
+ */
+void CResult_RouteHintDecodeErrorZ_free(struct LDKCResult_RouteHintDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_clone(const struct LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
+ */
+struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_ok(struct LDKRouteHintHop o);
+
+/**
+ * Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
+ */
+struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
+ */
+void CResult_RouteHintHopDecodeErrorZ_free(struct LDKCResult_RouteHintHopDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_clone(const struct LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ */
+void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res);
+
+/**
+ * Creates a new CResult_RouteLightningErrorZ in the success state.
+ */
+struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LDKRoute o);
 
 /**
  * Creates a new CResult_RouteLightningErrorZ in the error state.
@@ -11111,6 +11741,36 @@ struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeError
  */
 void CResult_InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_InvoiceFeaturesDecodeErrorZ _res);
 
+/**
+ * Creates a new CResult_ScoringParametersDecodeErrorZ in the success state.
+ */
+struct LDKCResult_ScoringParametersDecodeErrorZ CResult_ScoringParametersDecodeErrorZ_ok(struct LDKScoringParameters o);
+
+/**
+ * Creates a new CResult_ScoringParametersDecodeErrorZ in the error state.
+ */
+struct LDKCResult_ScoringParametersDecodeErrorZ CResult_ScoringParametersDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Frees any resources used by the CResult_ScoringParametersDecodeErrorZ.
+ */
+void CResult_ScoringParametersDecodeErrorZ_free(struct LDKCResult_ScoringParametersDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_ScorerDecodeErrorZ in the success state.
+ */
+struct LDKCResult_ScorerDecodeErrorZ CResult_ScorerDecodeErrorZ_ok(struct LDKScorer o);
+
+/**
+ * Creates a new CResult_ScorerDecodeErrorZ in the error state.
+ */
+struct LDKCResult_ScorerDecodeErrorZ CResult_ScorerDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Frees any resources used by the CResult_ScorerDecodeErrorZ.
+ */
+void CResult_ScorerDecodeErrorZ_free(struct LDKCResult_ScorerDecodeErrorZ _res);
+
 /**
  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
  */
@@ -11403,27 +12063,6 @@ struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tu
  */
 void CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res);
 
-/**
- * Creates a new CResult_PaymentIdDecodeErrorZ in the success state.
- */
-struct LDKCResult_PaymentIdDecodeErrorZ CResult_PaymentIdDecodeErrorZ_ok(struct LDKPaymentId o);
-
-/**
- * Creates a new CResult_PaymentIdDecodeErrorZ in the error state.
- */
-struct LDKCResult_PaymentIdDecodeErrorZ CResult_PaymentIdDecodeErrorZ_err(struct LDKDecodeError e);
-
-/**
- * Frees any resources used by the CResult_PaymentIdDecodeErrorZ.
- */
-void CResult_PaymentIdDecodeErrorZ_free(struct LDKCResult_PaymentIdDecodeErrorZ _res);
-
-/**
- * Creates a new CResult_PaymentIdDecodeErrorZ which has the same data as `orig`
- * but with all dynamically-allocated buffers duplicated in new buffers.
- */
-struct LDKCResult_PaymentIdDecodeErrorZ CResult_PaymentIdDecodeErrorZ_clone(const struct LDKCResult_PaymentIdDecodeErrorZ *NONNULL_PTR orig);
-
 /**
  * Constructs a new COption_u16Z containing a u16
  */
@@ -11500,7 +12139,7 @@ struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_clone(const struct LDKCR
 /**
  * Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state.
  */
-struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_ok(struct LDKPaymentId o);
+struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_ok(struct LDKThirtyTwoBytes o);
 
 /**
  * Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state.
@@ -11548,7 +12187,7 @@ struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_clone(cons
 /**
  * Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
  */
-struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_new(struct LDKThirtyTwoBytes a, struct LDKPaymentId b);
+struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b);
 
 /**
  * Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
@@ -11720,6 +12359,27 @@ struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_er
  */
 void CResult_COption_TypeZDecodeErrorZ_free(struct LDKCResult_COption_TypeZDecodeErrorZ _res);
 
+/**
+ * Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
+ */
+struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_ok(struct LDKThirtyTwoBytes o);
+
+/**
+ * Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
+ */
+struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_err(struct LDKPaymentError e);
+
+/**
+ * Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
+ */
+void CResult_PaymentIdPaymentErrorZ_free(struct LDKCResult_PaymentIdPaymentErrorZ _res);
+
+/**
+ * Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_clone(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR orig);
+
 /**
  * Creates a new CResult_SiPrefixNoneZ in the success state.
  */
@@ -12498,48 +13158,6 @@ void COption_CVec_NetAddressZZ_free(struct LDKCOption_CVec_NetAddressZZ _res);
  */
 struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_clone(const struct LDKCOption_CVec_NetAddressZZ *NONNULL_PTR orig);
 
-/**
- * Creates a new CResult_NetAddressu8Z in the success state.
- */
-struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_ok(struct LDKNetAddress o);
-
-/**
- * Creates a new CResult_NetAddressu8Z in the error state.
- */
-struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_err(uint8_t e);
-
-/**
- * Frees any resources used by the CResult_NetAddressu8Z.
- */
-void CResult_NetAddressu8Z_free(struct LDKCResult_NetAddressu8Z _res);
-
-/**
- * Creates a new CResult_NetAddressu8Z which has the same data as `orig`
- * but with all dynamically-allocated buffers duplicated in new buffers.
- */
-struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_clone(const struct LDKCResult_NetAddressu8Z *NONNULL_PTR orig);
-
-/**
- * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the success state.
- */
-struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(struct LDKCResult_NetAddressu8Z o);
-
-/**
- * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the error state.
- */
-struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_err(struct LDKDecodeError e);
-
-/**
- * Frees any resources used by the CResult_CResult_NetAddressu8ZDecodeErrorZ.
- */
-void CResult_CResult_NetAddressu8ZDecodeErrorZ_free(struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res);
-
-/**
- * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ which has the same data as `orig`
- * but with all dynamically-allocated buffers duplicated in new buffers.
- */
-struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(const struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *NONNULL_PTR orig);
-
 /**
  * Creates a new CResult_NetAddressDecodeErrorZ in the success state.
  */
@@ -13402,12 +14020,12 @@ struct LDKEvent Event_payment_received(struct LDKThirtyTwoBytes payment_hash, ui
 /**
  * Utility method to constructs a new PaymentSent-variant Event
  */
-struct LDKEvent Event_payment_sent(struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_hash);
+struct LDKEvent Event_payment_sent(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z fee_paid_msat);
 
 /**
  * Utility method to constructs a new PaymentPathFailed-variant Event
  */
-struct LDKEvent Event_payment_path_failed(struct LDKThirtyTwoBytes payment_hash, bool rejected_by_dest, struct LDKCOption_NetworkUpdateZ network_update, bool all_paths_failed, struct LDKCVec_RouteHopZ path, struct LDKCOption_u64Z short_channel_id);
+struct LDKEvent Event_payment_path_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, bool rejected_by_dest, struct LDKCOption_NetworkUpdateZ network_update, bool all_paths_failed, struct LDKCVec_RouteHopZ path, struct LDKCOption_u64Z short_channel_id, struct LDKRouteParameters retry);
 
 /**
  * Utility method to constructs a new PendingHTLCsForwardable-variant Event
@@ -14478,6 +15096,28 @@ bool ConfirmationTarget_eq(const enum LDKConfirmationTarget *NONNULL_PTR a, cons
  */
 void FeeEstimator_free(struct LDKFeeEstimator this_ptr);
 
+/**
+ * Frees any resources used by the MonitorUpdateId, if is_owned is set and inner is non-NULL.
+ */
+void MonitorUpdateId_free(struct LDKMonitorUpdateId this_obj);
+
+/**
+ * Creates a copy of the MonitorUpdateId
+ */
+struct LDKMonitorUpdateId MonitorUpdateId_clone(const struct LDKMonitorUpdateId *NONNULL_PTR orig);
+
+/**
+ * Checks if two MonitorUpdateIds contain equal inner contents.
+ */
+uint64_t MonitorUpdateId_hash(const struct LDKMonitorUpdateId *NONNULL_PTR o);
+
+/**
+ * Checks if two MonitorUpdateIds 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 MonitorUpdateId_eq(const struct LDKMonitorUpdateId *NONNULL_PTR a, const struct LDKMonitorUpdateId *NONNULL_PTR b);
+
 /**
  * Calls the free function if one is set
  */
@@ -14534,6 +15174,23 @@ MUST_USE_RES struct LDKCResult_LockedChannelMonitorNoneZ ChainMonitor_get_monito
  */
 MUST_USE_RES struct LDKCVec_OutPointZ ChainMonitor_list_monitors(const struct LDKChainMonitor *NONNULL_PTR this_arg);
 
+/**
+ * Indicates the persistence of a [`ChannelMonitor`] has completed after
+ * [`ChannelMonitorUpdateErr::TemporaryFailure`] 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`],
+ *  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.
+ *
+ * Returns an [`APIError::APIMisuseError`] if `funding_txo` does not match any currently
+ * registered [`ChannelMonitor`]s.
+ */
+MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChainMonitor_channel_monitor_updated(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKOutPoint funding_txo, struct LDKMonitorUpdateId completed_update_id);
+
 /**
  * Constructs a new Listen which calls the relevant methods on this_arg.
  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
@@ -14613,6 +15270,15 @@ struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(str
  */
 void MonitorUpdateError_free(struct LDKMonitorUpdateError this_obj);
 
+struct LDKStr MonitorUpdateError_get_a(const struct LDKMonitorUpdateError *NONNULL_PTR this_ptr);
+
+void MonitorUpdateError_set_a(struct LDKMonitorUpdateError *NONNULL_PTR this_ptr, struct LDKStr val);
+
+/**
+ * Constructs a new MonitorUpdateError given each field
+ */
+MUST_USE_RES struct LDKMonitorUpdateError MonitorUpdateError_new(struct LDKStr a_arg);
+
 /**
  * Creates a copy of the MonitorUpdateError
  */
@@ -14638,6 +15304,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
+ */
+struct LDKMonitorEvent MonitorEvent_update_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);
+
+/**
+ * Serialize the MonitorEvent object into a byte array which can be read by MonitorEvent_read
+ */
+struct LDKCVec_u8Z MonitorEvent_write(const struct LDKMonitorEvent *NONNULL_PTR obj);
+
 /**
  * Frees any resources used by the HTLCUpdate, if is_owned is set and inner is non-NULL.
  */
@@ -15347,38 +16028,6 @@ MUST_USE_RES struct LDKCResult_TransactionNoneZ KeysManager_spend_spendable_outp
  */
 struct LDKKeysInterface KeysManager_as_KeysInterface(const struct LDKKeysManager *NONNULL_PTR this_arg);
 
-/**
- * Frees any resources used by the PaymentId, if is_owned is set and inner is non-NULL.
- */
-void PaymentId_free(struct LDKPaymentId this_obj);
-
-/**
- * Checks if two PaymentIds contain equal inner contents.
- */
-uint64_t PaymentId_hash(const struct LDKPaymentId *NONNULL_PTR o);
-
-/**
- * Creates a copy of the PaymentId
- */
-struct LDKPaymentId PaymentId_clone(const struct LDKPaymentId *NONNULL_PTR orig);
-
-/**
- * Checks if two PaymentIds 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 PaymentId_eq(const struct LDKPaymentId *NONNULL_PTR a, const struct LDKPaymentId *NONNULL_PTR b);
-
-/**
- * Serialize the PaymentId object into a byte array which can be read by PaymentId_read
- */
-struct LDKCVec_u8Z PaymentId_write(const struct LDKPaymentId *NONNULL_PTR obj);
-
-/**
- * Read a PaymentId from a byte array, created by PaymentId_write
- */
-struct LDKCResult_PaymentIdDecodeErrorZ PaymentId_read(struct LDKu8slice ser);
-
 /**
  * Frees any resources used by the ChannelManager, if is_owned is set and inner is non-NULL.
  */
@@ -15858,7 +16507,7 @@ struct LDKPaymentSendFailure PaymentSendFailure_all_failed_retry_safe(struct LDK
 /**
  * Utility method to constructs a new PartialFailure-variant PaymentSendFailure
  */
-struct LDKPaymentSendFailure PaymentSendFailure_partial_failure(struct LDKCVec_CResult_NoneAPIErrorZZ a);
+struct LDKPaymentSendFailure PaymentSendFailure_partial_failure(struct LDKCVec_CResult_NoneAPIErrorZZ results, struct LDKRouteParameters failed_paths_retry, struct LDKThirtyTwoBytes payment_id);
 
 /**
  * Constructs a new ChannelManager to hold several channels and route between them.
@@ -16040,7 +16689,7 @@ MUST_USE_RES struct LDKCResult_PaymentIdPaymentSendFailureZ ChannelManager_send_
  *
  * [`send_payment`]: [`ChannelManager::send_payment`]
  */
-MUST_USE_RES struct LDKCResult_NonePaymentSendFailureZ ChannelManager_retry_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKPaymentId payment_id);
+MUST_USE_RES struct LDKCResult_NonePaymentSendFailureZ ChannelManager_retry_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_id);
 
 /**
  * Send a spontaneous payment, which is a payment that does not require the recipient to have
@@ -16161,30 +16810,6 @@ MUST_USE_RES bool ChannelManager_claim_funds(const struct LDKChannelManager *NON
  */
 MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg);
 
-/**
- * Restores a single, given channel to normal operation after a
- * ChannelMonitorUpdateErr::TemporaryFailure was returned from a channel monitor update
- * operation.
- *
- * All ChannelMonitor updates up to and including highest_applied_update_id must have been
- * fully committed in every copy of the given channels' ChannelMonitors.
- *
- * Note that there is no effect to calling with a highest_applied_update_id other than the
- * current latest ChannelMonitorUpdate and one call to this function after multiple
- * ChannelMonitorUpdateErr::TemporaryFailures is fine. The highest_applied_update_id field
- * exists largely only to prevent races between this and concurrent update_monitor calls.
- *
- * Thus, the anticipated use is, at a high level:
- *  1) You register a chain::Watch with this ChannelManager,
- *  2) it stores each update to disk, and begins updating any remote (eg watchtower) copies of
- *     said ChannelMonitors as it can, returning ChannelMonitorUpdateErr::TemporaryFailures
- *     any time it cannot do so instantly,
- *  3) update(s) are applied to each remote copy of a ChannelMonitor,
- *  4) once all remote copies are updated, you call this function with the update_id that
- *     completed, and once it is the latest the Channel will be re-enabled.
- */
-void ChannelManager_channel_monitor_updated(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKOutPoint *NONNULL_PTR funding_txo, uint64_t highest_applied_update_id);
-
 /**
  * Gets a payment secret and payment hash for use in an invoice given to a third party wishing
  * to pay us.
@@ -17616,11 +18241,6 @@ struct LDKNetAddress NetAddress_onion_v3(struct LDKThirtyTwoBytes ed25519_pubkey
  */
 struct LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *NONNULL_PTR obj);
 
-/**
- * Read a Result from a byte array, created by Result_write
- */
-struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ Result_read(struct LDKu8slice ser);
-
 /**
  * Read a NetAddress from a byte array, created by NetAddress_write
  */
@@ -18971,6 +19591,13 @@ void PeerManager_socket_disconnected(const struct LDKPeerManager *NONNULL_PTR th
  */
 void PeerManager_disconnect_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id, bool no_connection_possible);
 
+/**
+ * Disconnects all currently-connected peers. This is useful on platforms where there may be
+ * an indication that TCP sockets have stalled even if we weren't around to time them out
+ * using regular ping/pongs.
+ */
+void PeerManager_disconnect_all_peers(const struct LDKPeerManager *NONNULL_PTR this_arg);
+
 /**
  * Send pings to each peer and disconnect those which did not respond to the last round of
  * pings.
@@ -20094,6 +20721,21 @@ void Type_free(struct LDKType this_ptr);
  */
 void Score_free(struct LDKScore this_ptr);
 
+/**
+ * Frees any resources used by the LockableScore, if is_owned is set and inner is non-NULL.
+ */
+void LockableScore_free(struct LDKLockableScore this_obj);
+
+/**
+ * Constructs a new LockableScore from a Score
+ */
+MUST_USE_RES struct LDKLockableScore LockableScore_new(struct LDKScore score);
+
+/**
+ * Serialize the LockableScore object into a byte array which can be read by LockableScore_read
+ */
+struct LDKCVec_u8Z LockableScore_write(const struct LDKLockableScore *NONNULL_PTR obj);
+
 /**
  * Frees any resources used by the NodeId, if is_owned is set and inner is non-NULL.
  */
@@ -20185,16 +20827,6 @@ struct LDKEventHandler NetGraphMsgHandler_as_EventHandler(const struct LDKNetGra
  */
 void NetGraphMsgHandler_free(struct LDKNetGraphMsgHandler this_obj);
 
-/**
- * Representation of the payment channel network
- */
-struct LDKNetworkGraph NetGraphMsgHandler_get_network_graph(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_ptr);
-
-/**
- * Representation of the payment channel network
- */
-void NetGraphMsgHandler_set_network_graph(struct LDKNetGraphMsgHandler *NONNULL_PTR this_ptr, struct LDKNetworkGraph val);
-
 /**
  * Creates a new tracker of the actual state of the network of channels and nodes,
  * assuming an existing Network Graph.
@@ -20202,7 +20834,7 @@ void NetGraphMsgHandler_set_network_graph(struct LDKNetGraphMsgHandler *NONNULL_
  * channel data is correct, and that the announcement is signed with
  * channel owners' keys.
  */
-MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_new(struct LDKNetworkGraph network_graph, struct LDKCOption_AccessZ chain_access, struct LDKLogger logger);
+MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKCOption_AccessZ chain_access, struct LDKLogger logger);
 
 /**
  * Adds a provider used to check new announcements. Does not affect
@@ -20893,10 +21525,32 @@ struct LDKCVec_CVec_RouteHopZZ Route_get_paths(const struct LDKRoute *NONNULL_PT
  */
 void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_CVec_RouteHopZZ val);
 
+/**
+ * The `payee` parameter passed to [`find_route`].
+ * This is used by `ChannelManager` to track information which may be required for retries,
+ * provided back to you via [`Event::PaymentPathFailed`].
+ *
+ * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
+ *
+ * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
+ */
+struct LDKPayee Route_get_payee(const struct LDKRoute *NONNULL_PTR this_ptr);
+
+/**
+ * The `payee` parameter passed to [`find_route`].
+ * This is used by `ChannelManager` to track information which may be required for retries,
+ * provided back to you via [`Event::PaymentPathFailed`].
+ *
+ * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
+ *
+ * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
+ */
+void Route_set_payee(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKPayee val);
+
 /**
  * Constructs a new Route given each field
  */
-MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_CVec_RouteHopZZ paths_arg);
+MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_CVec_RouteHopZZ paths_arg, struct LDKPayee payee_arg);
 
 /**
  * Creates a copy of the Route
@@ -20919,7 +21573,7 @@ bool Route_eq(const struct LDKRoute *NONNULL_PTR a, const struct LDKRoute *NONNU
  * Returns the total amount of fees paid on this [`Route`].
  *
  * This doesn't include any extra payment made to the recipient, which can happen in excess of
- * the amount passed to [`get_route`]'s `final_value_msat`.
+ * the amount passed to [`find_route`]'s `params.final_value_msat`.
  */
 MUST_USE_RES uint64_t Route_get_total_fees(const struct LDKRoute *NONNULL_PTR this_arg);
 
@@ -20938,11 +21592,176 @@ struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj);
  */
 struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser);
 
+/**
+ * Frees any resources used by the RouteParameters, if is_owned is set and inner is non-NULL.
+ */
+void RouteParameters_free(struct LDKRouteParameters this_obj);
+
+/**
+ * The recipient of the failed payment path.
+ */
+struct LDKPayee RouteParameters_get_payee(const struct LDKRouteParameters *NONNULL_PTR this_ptr);
+
+/**
+ * The recipient of the failed payment path.
+ */
+void RouteParameters_set_payee(struct LDKRouteParameters *NONNULL_PTR this_ptr, struct LDKPayee val);
+
+/**
+ * The amount in msats sent on the failed payment path.
+ */
+uint64_t RouteParameters_get_final_value_msat(const struct LDKRouteParameters *NONNULL_PTR this_ptr);
+
+/**
+ * The amount in msats sent on the failed payment path.
+ */
+void RouteParameters_set_final_value_msat(struct LDKRouteParameters *NONNULL_PTR this_ptr, uint64_t val);
+
+/**
+ * The CLTV on the final hop of the failed payment path.
+ */
+uint32_t RouteParameters_get_final_cltv_expiry_delta(const struct LDKRouteParameters *NONNULL_PTR this_ptr);
+
+/**
+ * The CLTV on the final hop of the failed payment path.
+ */
+void RouteParameters_set_final_cltv_expiry_delta(struct LDKRouteParameters *NONNULL_PTR this_ptr, uint32_t val);
+
+/**
+ * Constructs a new RouteParameters given each field
+ */
+MUST_USE_RES struct LDKRouteParameters RouteParameters_new(struct LDKPayee payee_arg, uint64_t final_value_msat_arg, uint32_t final_cltv_expiry_delta_arg);
+
+/**
+ * Creates a copy of the RouteParameters
+ */
+struct LDKRouteParameters RouteParameters_clone(const struct LDKRouteParameters *NONNULL_PTR orig);
+
+/**
+ * Serialize the RouteParameters object into a byte array which can be read by RouteParameters_read
+ */
+struct LDKCVec_u8Z RouteParameters_write(const struct LDKRouteParameters *NONNULL_PTR obj);
+
+/**
+ * Read a RouteParameters from a byte array, created by RouteParameters_write
+ */
+struct LDKCResult_RouteParametersDecodeErrorZ RouteParameters_read(struct LDKu8slice ser);
+
+/**
+ * Frees any resources used by the Payee, if is_owned is set and inner is non-NULL.
+ */
+void Payee_free(struct LDKPayee this_obj);
+
+/**
+ * The node id of the payee.
+ */
+struct LDKPublicKey Payee_get_pubkey(const struct LDKPayee *NONNULL_PTR this_ptr);
+
+/**
+ * The node id of the payee.
+ */
+void Payee_set_pubkey(struct LDKPayee *NONNULL_PTR this_ptr, struct LDKPublicKey val);
+
+/**
+ * Features supported by the payee.
+ *
+ * May be set from the payee's invoice or via [`for_keysend`]. May be `None` if the invoice
+ * does not contain any features.
+ *
+ * [`for_keysend`]: Self::for_keysend
+ *
+ * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
+ */
+struct LDKInvoiceFeatures Payee_get_features(const struct LDKPayee *NONNULL_PTR this_ptr);
+
+/**
+ * Features supported by the payee.
+ *
+ * May be set from the payee's invoice or via [`for_keysend`]. May be `None` if the invoice
+ * does not contain any features.
+ *
+ * [`for_keysend`]: Self::for_keysend
+ *
+ * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
+ */
+void Payee_set_features(struct LDKPayee *NONNULL_PTR this_ptr, struct LDKInvoiceFeatures val);
+
+/**
+ * Hints for routing to the payee, containing channels connecting the payee to public nodes.
+ */
+struct LDKCVec_RouteHintZ Payee_get_route_hints(const struct LDKPayee *NONNULL_PTR this_ptr);
+
+/**
+ * Hints for routing to the payee, containing channels connecting the payee to public nodes.
+ */
+void Payee_set_route_hints(struct LDKPayee *NONNULL_PTR this_ptr, struct LDKCVec_RouteHintZ val);
+
+/**
+ * Expiration of a payment to the payee, in seconds relative to the UNIX epoch.
+ */
+struct LDKCOption_u64Z Payee_get_expiry_time(const struct LDKPayee *NONNULL_PTR this_ptr);
+
+/**
+ * Expiration of a payment to the payee, in seconds relative to the UNIX epoch.
+ */
+void Payee_set_expiry_time(struct LDKPayee *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
+
+/**
+ * Constructs a new Payee given each field
+ */
+MUST_USE_RES struct LDKPayee Payee_new(struct LDKPublicKey pubkey_arg, struct LDKInvoiceFeatures features_arg, struct LDKCVec_RouteHintZ route_hints_arg, struct LDKCOption_u64Z expiry_time_arg);
+
+/**
+ * Creates a copy of the Payee
+ */
+struct LDKPayee Payee_clone(const struct LDKPayee *NONNULL_PTR orig);
+
+/**
+ * Checks if two Payees contain equal inner contents.
+ */
+uint64_t Payee_hash(const struct LDKPayee *NONNULL_PTR o);
+
+/**
+ * Checks if two Payees 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 Payee_eq(const struct LDKPayee *NONNULL_PTR a, const struct LDKPayee *NONNULL_PTR b);
+
+/**
+ * Serialize the Payee object into a byte array which can be read by Payee_read
+ */
+struct LDKCVec_u8Z Payee_write(const struct LDKPayee *NONNULL_PTR obj);
+
+/**
+ * Read a Payee from a byte array, created by Payee_write
+ */
+struct LDKCResult_PayeeDecodeErrorZ Payee_read(struct LDKu8slice ser);
+
+/**
+ * Creates a payee with the node id of the given `pubkey`.
+ */
+MUST_USE_RES struct LDKPayee Payee_from_node_id(struct LDKPublicKey pubkey);
+
+/**
+ * Creates a payee with the node id of the given `pubkey` to use for keysend payments.
+ */
+MUST_USE_RES struct LDKPayee Payee_for_keysend(struct LDKPublicKey pubkey);
+
 /**
  * Frees any resources used by the RouteHint, if is_owned is set and inner is non-NULL.
  */
 void RouteHint_free(struct LDKRouteHint this_obj);
 
+struct LDKCVec_RouteHintHopZ RouteHint_get_a(const struct LDKRouteHint *NONNULL_PTR this_ptr);
+
+void RouteHint_set_a(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKCVec_RouteHintHopZ val);
+
+/**
+ * Constructs a new RouteHint given each field
+ */
+MUST_USE_RES struct LDKRouteHint RouteHint_new(struct LDKCVec_RouteHintHopZ a_arg);
+
 /**
  * Creates a copy of the RouteHint
  */
@@ -20960,6 +21779,16 @@ uint64_t RouteHint_hash(const struct LDKRouteHint *NONNULL_PTR o);
  */
 bool RouteHint_eq(const struct LDKRouteHint *NONNULL_PTR a, const struct LDKRouteHint *NONNULL_PTR b);
 
+/**
+ * Serialize the RouteHint object into a byte array which can be read by RouteHint_read
+ */
+struct LDKCVec_u8Z RouteHint_write(const struct LDKRouteHint *NONNULL_PTR obj);
+
+/**
+ * Read a RouteHint from a byte array, created by RouteHint_write
+ */
+struct LDKCResult_RouteHintDecodeErrorZ RouteHint_read(struct LDKu8slice ser);
+
 /**
  * Frees any resources used by the RouteHintHop, if is_owned is set and inner is non-NULL.
  */
@@ -21048,39 +21877,48 @@ uint64_t RouteHintHop_hash(const struct LDKRouteHintHop *NONNULL_PTR o);
 bool RouteHintHop_eq(const struct LDKRouteHintHop *NONNULL_PTR a, const struct LDKRouteHintHop *NONNULL_PTR b);
 
 /**
- * Gets a keysend route from us (payer) to the given target node (payee). This is needed because
- * keysend payments do not have an invoice from which to pull the payee's supported features, which
- * makes it tricky to otherwise supply the `payee_features` parameter of `get_route`.
- *
- * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
+ * Serialize the RouteHintHop object into a byte array which can be read by RouteHintHop_read
  */
-struct LDKCResult_RouteLightningErrorZ get_keysend_route(struct LDKPublicKey our_node_pubkey, const struct LDKNetworkGraph *NONNULL_PTR network, struct LDKPublicKey payee, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKCVec_RouteHintZ last_hops, uint64_t final_value_msat, uint32_t final_cltv, struct LDKLogger logger, const struct LDKScore *NONNULL_PTR scorer);
+struct LDKCVec_u8Z RouteHintHop_write(const struct LDKRouteHintHop *NONNULL_PTR obj);
 
 /**
- * Gets a route from us (payer) to the given target node (payee).
+ * Read a RouteHintHop from a byte array, created by RouteHintHop_write
+ */
+struct LDKCResult_RouteHintHopDecodeErrorZ RouteHintHop_read(struct LDKu8slice ser);
+
+/**
+ * Finds a route from us (payer) to the given target node (payee).
  *
- * If the payee provided features in their invoice, they should be provided via payee_features.
+ * If the payee provided features in their invoice, they should be provided via `params.payee`.
  * Without this, MPP will only be used if the payee's features are available in the network graph.
  *
- * Private routing paths between a public node and the target may be included in `last_hops`.
- * Currently, only the last hop in each path is considered.
+ * Private routing paths between a public node and the target may be included in `params.payee`.
+ *
+ * If some channels aren't announced, it may be useful to fill in `first_hops` with the results
+ * from [`ChannelManager::list_usable_channels`]. If it is filled in, the view of our local
+ * channels from [`NetworkGraph`] will be ignored, and only those in `first_hops` will be used.
  *
- * If some channels aren't announced, it may be useful to fill in a first_hops with the
- * results from a local ChannelManager::list_usable_channels() call. If it is filled in, our
- * view of our local channels (from net_graph_msg_handler) will be ignored, and only those
- * in first_hops will be used.
+ * The fees on channels from us to the next hop are ignored as they are assumed to all be equal.
+ * However, the enabled/disabled bit on such channels as well as the `htlc_minimum_msat` /
+ * `htlc_maximum_msat` *are* checked as they may change based on the receiving node.
  *
- * Panics if first_hops contains channels without short_channel_ids
- * (ChannelManager::list_usable_channels will never include such channels).
+ * # Note
+ *
+ * May be used to re-compute a [`Route`] when handling a [`Event::PaymentPathFailed`]. Any
+ * adjustments to the [`NetworkGraph`] and channel scores should be made prior to calling this
+ * function.
+ *
+ * # Panics
  *
- * The fees on channels from us to next-hops are ignored (as they are assumed to all be
- * equal), however the enabled/disabled bit on such channels as well as the
- * htlc_minimum_msat/htlc_maximum_msat *are* checked as they may change based on the receiving node.
+ * Panics if first_hops contains channels without short_channel_ids;
+ * [`ChannelManager::list_usable_channels`] will never include such channels.
+ *
+ * [`ChannelManager::list_usable_channels`]: crate::ln::channelmanager::ChannelManager::list_usable_channels
+ * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
  *
- * Note that payee_features (or a relevant inner pointer) may be NULL or all-0s to represent None
  * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
  */
-struct LDKCResult_RouteLightningErrorZ get_route(struct LDKPublicKey our_node_pubkey, const struct LDKNetworkGraph *NONNULL_PTR network, struct LDKPublicKey payee, struct LDKInvoiceFeatures payee_features, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKCVec_RouteHintZ last_hops, uint64_t final_value_msat, uint32_t final_cltv, struct LDKLogger logger, const struct LDKScore *NONNULL_PTR scorer);
+struct LDKCResult_RouteLightningErrorZ find_route(struct LDKPublicKey our_node_pubkey, const struct LDKRouteParameters *NONNULL_PTR params, const struct LDKNetworkGraph *NONNULL_PTR network, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKLogger logger, const struct LDKScore *NONNULL_PTR scorer);
 
 /**
  * Frees any resources used by the Scorer, if is_owned is set and inner is non-NULL.
@@ -21088,21 +21926,112 @@ struct LDKCResult_RouteLightningErrorZ get_route(struct LDKPublicKey our_node_pu
 void Scorer_free(struct LDKScorer this_obj);
 
 /**
- * Creates a new scorer using `base_penalty_msat` as the channel penalty.
+ * Frees any resources used by the ScoringParameters, if is_owned is set and inner is non-NULL.
+ */
+void ScoringParameters_free(struct LDKScoringParameters this_obj);
+
+/**
+ * A fixed penalty in msats to apply to each channel.
+ */
+uint64_t ScoringParameters_get_base_penalty_msat(const struct LDKScoringParameters *NONNULL_PTR this_ptr);
+
+/**
+ * A fixed penalty in msats to apply to each channel.
  */
-MUST_USE_RES struct LDKScorer Scorer_new(uint64_t base_penalty_msat);
+void ScoringParameters_set_base_penalty_msat(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
+
+/**
+ * A penalty in msats to apply to a channel upon failing to relay a payment.
+ *
+ * This accumulates for each failure but may be reduced over time based on
+ * [`failure_penalty_half_life`].
+ *
+ * [`failure_penalty_half_life`]: Self::failure_penalty_half_life
+ */
+uint64_t ScoringParameters_get_failure_penalty_msat(const struct LDKScoringParameters *NONNULL_PTR this_ptr);
+
+/**
+ * A penalty in msats to apply to a channel upon failing to relay a payment.
+ *
+ * This accumulates for each failure but may be reduced over time based on
+ * [`failure_penalty_half_life`].
+ *
+ * [`failure_penalty_half_life`]: Self::failure_penalty_half_life
+ */
+void ScoringParameters_set_failure_penalty_msat(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
+
+/**
+ * The time required to elapse before any accumulated [`failure_penalty_msat`] penalties are
+ * cut in half.
+ *
+ * # Note
+ *
+ * When time is an [`Eternity`], as is default when enabling feature `no-std`, it will never
+ * elapse. Therefore, this penalty will never decay.
+ *
+ * [`failure_penalty_msat`]: Self::failure_penalty_msat
+ */
+uint64_t ScoringParameters_get_failure_penalty_half_life(const struct LDKScoringParameters *NONNULL_PTR this_ptr);
+
+/**
+ * The time required to elapse before any accumulated [`failure_penalty_msat`] penalties are
+ * cut in half.
+ *
+ * # Note
+ *
+ * When time is an [`Eternity`], as is default when enabling feature `no-std`, it will never
+ * elapse. Therefore, this penalty will never decay.
+ *
+ * [`failure_penalty_msat`]: Self::failure_penalty_msat
+ */
+void ScoringParameters_set_failure_penalty_half_life(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
+
+/**
+ * Constructs a new ScoringParameters given each field
+ */
+MUST_USE_RES struct LDKScoringParameters ScoringParameters_new(uint64_t base_penalty_msat_arg, uint64_t failure_penalty_msat_arg, uint64_t failure_penalty_half_life_arg);
+
+/**
+ * Serialize the ScoringParameters object into a byte array which can be read by ScoringParameters_read
+ */
+struct LDKCVec_u8Z ScoringParameters_write(const struct LDKScoringParameters *NONNULL_PTR obj);
+
+/**
+ * Read a ScoringParameters from a byte array, created by ScoringParameters_write
+ */
+struct LDKCResult_ScoringParametersDecodeErrorZ ScoringParameters_read(struct LDKu8slice ser);
+
+/**
+ * Creates a new scorer using the given scoring parameters.
+ */
+MUST_USE_RES struct LDKScorer Scorer_new(struct LDKScoringParameters params);
 
 /**
  * Creates a "default" Scorer. See struct and individual field documentaiton for details on which values are used.
  */
 MUST_USE_RES struct LDKScorer Scorer_default(void);
 
+/**
+ * Creates a "default" ScoringParameters. See struct and individual field documentaiton for details on which values are used.
+ */
+MUST_USE_RES struct LDKScoringParameters ScoringParameters_default(void);
+
 /**
  * Constructs a new Score which calls the relevant methods on this_arg.
  * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is
  */
 struct LDKScore Scorer_as_Score(const struct LDKScorer *NONNULL_PTR this_arg);
 
+/**
+ * Serialize the Scorer object into a byte array which can be read by Scorer_read
+ */
+struct LDKCVec_u8Z Scorer_write(const struct LDKScorer *NONNULL_PTR obj);
+
+/**
+ * Read a Scorer from a byte array, created by Scorer_write
+ */
+struct LDKCResult_ScorerDecodeErrorZ Scorer_read(struct LDKu8slice ser);
+
 /**
  * Frees any resources used by the FilesystemPersister, if is_owned is set and inner is non-NULL.
  */
@@ -21459,6 +22388,15 @@ bool Description_eq(const struct LDKDescription *NONNULL_PTR a, const struct LDK
  */
 void PayeePubKey_free(struct LDKPayeePubKey this_obj);
 
+struct LDKPublicKey PayeePubKey_get_a(const struct LDKPayeePubKey *NONNULL_PTR this_ptr);
+
+void PayeePubKey_set_a(struct LDKPayeePubKey *NONNULL_PTR this_ptr, struct LDKPublicKey val);
+
+/**
+ * Constructs a new PayeePubKey given each field
+ */
+MUST_USE_RES struct LDKPayeePubKey PayeePubKey_new(struct LDKPublicKey a_arg);
+
 /**
  * Creates a copy of the PayeePubKey
  */
@@ -21503,6 +22441,15 @@ bool ExpiryTime_eq(const struct LDKExpiryTime *NONNULL_PTR a, const struct LDKEx
  */
 void MinFinalCltvExpiry_free(struct LDKMinFinalCltvExpiry this_obj);
 
+uint64_t MinFinalCltvExpiry_get_a(const struct LDKMinFinalCltvExpiry *NONNULL_PTR this_ptr);
+
+void MinFinalCltvExpiry_set_a(struct LDKMinFinalCltvExpiry *NONNULL_PTR this_ptr, uint64_t val);
+
+/**
+ * Constructs a new MinFinalCltvExpiry given each field
+ */
+MUST_USE_RES struct LDKMinFinalCltvExpiry MinFinalCltvExpiry_new(uint64_t a_arg);
+
 /**
  * Creates a copy of the MinFinalCltvExpiry
  */
@@ -21766,7 +22713,7 @@ MUST_USE_RES struct LDKPublicKey Invoice_payee_pub_key(const struct LDKInvoice *
 /**
  * Get the payment secret if one was included in the invoice
  */
-MUST_USE_RES struct LDKThirtyTwoBytes Invoice_payment_secret(const struct LDKInvoice *NONNULL_PTR this_arg);
+MUST_USE_RES const uint8_t (*Invoice_payment_secret(const struct LDKInvoice *NONNULL_PTR this_arg))[32];
 
 /**
  * Get the invoice features if they were included in the invoice
@@ -21785,6 +22732,11 @@ MUST_USE_RES struct LDKPublicKey Invoice_recover_payee_pub_key(const struct LDKI
  */
 MUST_USE_RES uint64_t Invoice_expiry_time(const struct LDKInvoice *NONNULL_PTR this_arg);
 
+/**
+ * Returns whether the invoice has expired.
+ */
+MUST_USE_RES bool Invoice_is_expired(const struct LDKInvoice *NONNULL_PTR this_arg);
+
 /**
  * Returns the invoice's `min_final_cltv_expiry` time, if present, otherwise
  * [`DEFAULT_MIN_FINAL_CLTV_EXPIRY`].
@@ -21807,9 +22759,9 @@ MUST_USE_RES struct LDKCVec_RouteHintZ Invoice_route_hints(const struct LDKInvoi
 MUST_USE_RES enum LDKCurrency Invoice_currency(const struct LDKInvoice *NONNULL_PTR this_arg);
 
 /**
- * Returns the amount if specified in the invoice as pico <currency>.
+ * Returns the amount if specified in the invoice as millisatoshis.
  */
-MUST_USE_RES struct LDKCOption_u64Z Invoice_amount_pico_btc(const struct LDKInvoice *NONNULL_PTR this_arg);
+MUST_USE_RES struct LDKCOption_u64Z Invoice_amount_milli_satoshis(const struct LDKInvoice *NONNULL_PTR this_arg);
 
 /**
  * Creates a new `Description` if `description` is at most 1023 __bytes__ long,
@@ -21991,6 +22943,118 @@ bool SignOrCreationError_eq(const struct LDKSignOrCreationError *NONNULL_PTR a,
  */
 struct LDKStr SignOrCreationError_to_str(const struct LDKSignOrCreationError *NONNULL_PTR o);
 
+/**
+ * Frees any resources used by the InvoicePayer, if is_owned is set and inner is non-NULL.
+ */
+void InvoicePayer_free(struct LDKInvoicePayer this_obj);
+
+/**
+ * Calls the free function if one is set
+ */
+void Payer_free(struct LDKPayer this_ptr);
+
+/**
+ * Calls the free function if one is set
+ */
+void Router_free(struct LDKRouter this_ptr);
+
+/**
+ * Frees any resources used by the RetryAttempts, if is_owned is set and inner is non-NULL.
+ */
+void RetryAttempts_free(struct LDKRetryAttempts this_obj);
+
+uintptr_t RetryAttempts_get_a(const struct LDKRetryAttempts *NONNULL_PTR this_ptr);
+
+void RetryAttempts_set_a(struct LDKRetryAttempts *NONNULL_PTR this_ptr, uintptr_t val);
+
+/**
+ * Constructs a new RetryAttempts given each field
+ */
+MUST_USE_RES struct LDKRetryAttempts RetryAttempts_new(uintptr_t a_arg);
+
+/**
+ * Creates a copy of the RetryAttempts
+ */
+struct LDKRetryAttempts RetryAttempts_clone(const struct LDKRetryAttempts *NONNULL_PTR orig);
+
+/**
+ * Checks if two RetryAttemptss contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+bool RetryAttempts_eq(const struct LDKRetryAttempts *NONNULL_PTR a, const struct LDKRetryAttempts *NONNULL_PTR b);
+
+/**
+ * Checks if two RetryAttemptss contain equal inner contents.
+ */
+uint64_t RetryAttempts_hash(const struct LDKRetryAttempts *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the PaymentError
+ */
+void PaymentError_free(struct LDKPaymentError this_ptr);
+
+/**
+ * Creates a copy of the PaymentError
+ */
+struct LDKPaymentError PaymentError_clone(const struct LDKPaymentError *NONNULL_PTR orig);
+
+/**
+ * Utility method to constructs a new Invoice-variant PaymentError
+ */
+struct LDKPaymentError PaymentError_invoice(struct LDKStr a);
+
+/**
+ * Utility method to constructs a new Routing-variant PaymentError
+ */
+struct LDKPaymentError PaymentError_routing(struct LDKLightningError a);
+
+/**
+ * Utility method to constructs a new Sending-variant PaymentError
+ */
+struct LDKPaymentError PaymentError_sending(struct LDKPaymentSendFailure a);
+
+/**
+ * Creates an invoice payer that retries failed payment paths.
+ *
+ * Will forward any [`Event::PaymentPathFailed`] events to the decorated `event_handler` once
+ * `retry_attempts` has been exceeded for a given [`Invoice`].
+ */
+MUST_USE_RES struct LDKInvoicePayer InvoicePayer_new(struct LDKPayer payer, struct LDKRouter router, const struct LDKLockableScore *NONNULL_PTR scorer, struct LDKLogger logger, struct LDKEventHandler event_handler, struct LDKRetryAttempts retry_attempts);
+
+/**
+ * Pays the given [`Invoice`], caching it for later use in case a retry is needed.
+ *
+ * You should ensure that the `invoice.payment_hash()` is unique and the same payment_hash has
+ * never been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so
+ * for you.
+ */
+MUST_USE_RES struct LDKCResult_PaymentIdPaymentErrorZ InvoicePayer_pay_invoice(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const struct LDKInvoice *NONNULL_PTR invoice);
+
+/**
+ * Pays the given zero-value [`Invoice`] using the given amount, caching it for later use in
+ * case a retry is needed.
+ *
+ * You should ensure that the `invoice.payment_hash()` is unique and the same payment_hash has
+ * never been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so
+ * for you.
+ */
+MUST_USE_RES struct LDKCResult_PaymentIdPaymentErrorZ InvoicePayer_pay_zero_value_invoice(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const struct LDKInvoice *NONNULL_PTR invoice, uint64_t amount_msats);
+
+/**
+ * Removes the payment cached by the given payment hash.
+ *
+ * Should be called once a payment has failed or succeeded if not using [`InvoicePayer`] as an
+ * [`EventHandler`]. Otherwise, calling this method is unnecessary.
+ */
+void InvoicePayer_remove_cached_payment(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]);
+
+/**
+ * Constructs a new EventHandler which calls the relevant methods on this_arg.
+ * This copies the `inner` pointer in this_arg and thus the returned EventHandler must be freed before this_arg is
+ */
+struct LDKEventHandler InvoicePayer_as_EventHandler(const struct LDKInvoicePayer *NONNULL_PTR this_arg);
+
 /**
  * Utility to construct an invoice. Generally, unless you want to do something like a custom
  * cltv_expiry, this is what you should be using to create an invoice. The reason being, this
@@ -22000,6 +23064,28 @@ struct LDKStr SignOrCreationError_to_str(const struct LDKSignOrCreationError *NO
  */
 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);
 
+/**
+ * Frees any resources used by the DefaultRouter, if is_owned is set and inner is non-NULL.
+ */
+void DefaultRouter_free(struct LDKDefaultRouter this_obj);
+
+/**
+ * Creates a new router using the given [`NetworkGraph`] and  [`Logger`].
+ */
+MUST_USE_RES struct LDKDefaultRouter DefaultRouter_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger);
+
+/**
+ * Constructs a new Router which calls the relevant methods on this_arg.
+ * This copies the `inner` pointer in this_arg and thus the returned Router must be freed before this_arg is
+ */
+struct LDKRouter DefaultRouter_as_Router(const struct LDKDefaultRouter *NONNULL_PTR this_arg);
+
+/**
+ * Constructs a new Payer which calls the relevant methods on this_arg.
+ * This copies the `inner` pointer in this_arg and thus the returned Payer must be freed before this_arg is
+ */
+struct LDKPayer ChannelManager_as_Payer(const struct LDKChannelManager *NONNULL_PTR this_arg);
+
 /**
  * Read a SiPrefix object from a string
  */
index d05c71cda8898f9bd48925f38425be4dda684eaf..730713c994043058c3fc2095e56554ba8ef3fb91 100644 (file)
@@ -20,6 +20,8 @@ class BackgroundProcessor;
 class ChannelManagerPersister;
 class RouteHop;
 class Route;
+class RouteParameters;
+class Payee;
 class RouteHint;
 class RouteHintHop;
 class BroadcasterInterface;
@@ -42,11 +44,13 @@ class MessageSendEventsProvider;
 class EventsProvider;
 class EventHandler;
 class Score;
+class LockableScore;
 class InitFeatures;
 class NodeFeatures;
 class ChannelFeatures;
 class InvoiceFeatures;
 class Scorer;
+class ScoringParameters;
 class DelayedPaymentOutputDescriptor;
 class StaticPaymentOutputDescriptor;
 class SpendableOutputDescriptor;
@@ -56,7 +60,6 @@ class KeysInterface;
 class InMemorySigner;
 class KeysManager;
 class FilesystemPersister;
-class PaymentId;
 class ChannelManager;
 class ChainParameters;
 class CounterpartyForwardingInfo;
@@ -72,6 +75,11 @@ class APIError;
 class OutPoint;
 class CustomMessageReader;
 class Type;
+class InvoicePayer;
+class Payer;
+class Router;
+class RetryAttempts;
+class PaymentError;
 class Invoice;
 class SignedRawInvoice;
 class RawInvoice;
@@ -153,17 +161,20 @@ class LightningError;
 class CommitmentUpdate;
 class ChannelMessageHandler;
 class RoutingMessageHandler;
+class DefaultRouter;
 class Level;
 class Logger;
+class MonitorUpdateId;
 class Persist;
 class LockedChannelMonitor;
 class ChainMonitor;
 class CVec_SpendableOutputDescriptorZ;
 class CResult_LockedChannelMonitorNoneZ;
 class CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ;
-class CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ;
+class CResult_ScoringParametersDecodeErrorZ;
 class CResult_HTLCUpdateDecodeErrorZ;
 class C2Tuple_SignatureCVec_SignatureZZ;
+class CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ;
 class CVec_C2Tuple_u32TxOutZZ;
 class CResult_ChannelInfoDecodeErrorZ;
 class CResult_FundingCreatedDecodeErrorZ;
@@ -178,18 +189,18 @@ class CResult_TxOutAccessErrorZ;
 class CResult_TrustedClosingTransactionNoneZ;
 class CResult_ChannelMonitorUpdateDecodeErrorZ;
 class C2Tuple_PublicKeyTypeZ;
+class CResult_RouteHintDecodeErrorZ;
 class CResult_NetAddressDecodeErrorZ;
 class CResult_ChannelReestablishDecodeErrorZ;
 class CResult_UnsignedNodeAnnouncementDecodeErrorZ;
-class CResult_ReplyChannelRangeDecodeErrorZ;
 class CResult_CommitmentSignedDecodeErrorZ;
 class CVec_UpdateAddHTLCZ;
-class CResult_GossipTimestampFilterDecodeErrorZ;
+class CResult_ReplyChannelRangeDecodeErrorZ;
 class COption_u32Z;
 class CResult_InitFeaturesDecodeErrorZ;
 class CResult_StaticPaymentOutputDescriptorDecodeErrorZ;
 class CResult_PaymentIdPaymentSendFailureZ;
-class CResult_InvoiceSignOrCreationErrorZ;
+class CResult_GossipTimestampFilterDecodeErrorZ;
 class CResult_CommitmentTransactionDecodeErrorZ;
 class COption_C2Tuple_usizeTransactionZZ;
 class CResult_TransactionNoneZ;
@@ -197,11 +208,12 @@ class CResult_SignedRawInvoiceNoneZ;
 class CResult_ExpiryTimeCreationErrorZ;
 class CResult_ClosingSignedFeeRangeDecodeErrorZ;
 class CResult_PingDecodeErrorZ;
-class COption_FilterZ;
+class CResult_InvoiceSignOrCreationErrorZ;
 class CVec_TransactionOutputsZ;
 class CResult_ErrorMessageDecodeErrorZ;
 class CResult_OpenChannelDecodeErrorZ;
 class CVec_CVec_u8ZZ;
+class COption_FilterZ;
 class CResult_SecretKeyErrorZ;
 class CResult_ShutdownScriptDecodeErrorZ;
 class CResult_InvoiceNoneZ;
@@ -223,9 +235,8 @@ class CResult_NodeIdDecodeErrorZ;
 class CResult_ShutdownScriptInvalidShutdownScriptZ;
 class CResult_RecoverableSignatureNoneZ;
 class CResult_NodeAnnouncementInfoDecodeErrorZ;
-class CResult_NetAddressu8Z;
-class C3Tuple_RawInvoice_u832InvoiceSignatureZ;
 class CVec_UpdateFailMalformedHTLCZ;
+class C3Tuple_RawInvoice_u832InvoiceSignatureZ;
 class CResult_FundingSignedDecodeErrorZ;
 class CResult_NetworkGraphDecodeErrorZ;
 class CVec_RouteHopZ;
@@ -239,6 +250,7 @@ class CResult_ClosingSignedDecodeErrorZ;
 class CResult_HolderCommitmentTransactionDecodeErrorZ;
 class CVec_CResult_NoneAPIErrorZZ;
 class CResult_SignatureNoneZ;
+class CVec_RouteHintHopZ;
 class C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ;
 class CResult_InitDecodeErrorZ;
 class CResult_OutPointDecodeErrorZ;
@@ -246,7 +258,7 @@ class CVec_ChannelDetailsZ;
 class CResult_SignDecodeErrorZ;
 class CVec_MessageSendEventZ;
 class C2Tuple_OutPointScriptZ;
-class CResult_PaymentIdDecodeErrorZ;
+class CResult_RouteHintHopDecodeErrorZ;
 class CResult_UpdateFailMalformedHTLCDecodeErrorZ;
 class CVec_NodeAnnouncementZ;
 class CResult_UnsignedChannelAnnouncementDecodeErrorZ;
@@ -263,12 +275,13 @@ class CResult_ChannelTransactionParametersDecodeErrorZ;
 class CResult_AcceptChannelDecodeErrorZ;
 class CVec_SignatureZ;
 class CVec_u64Z;
-class CResult_PongDecodeErrorZ;
+class CResult_ScorerDecodeErrorZ;
 class CResult_DelayedPaymentOutputDescriptorDecodeErrorZ;
 class C2Tuple_PaymentHashPaymentIdZ;
 class CResult_StringErrorZ;
 class CResult_NoneErrorZ;
 class C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ;
+class CResult_PongDecodeErrorZ;
 class CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ;
 class CVec_RouteHintZ;
 class COption_u16Z;
@@ -278,11 +291,13 @@ class CResult_NoneLightningErrorZ;
 class CResult_NonePeerHandleErrorZ;
 class COption_CVec_NetAddressZZ;
 class CResult_CVec_SignatureZNoneZ;
+class CResult_PayeeDecodeErrorZ;
 class CResult__u832APIErrorZ;
+class CResult_PaymentIdPaymentErrorZ;
 class CResult_DescriptionCreationErrorZ;
 class CVec_C2Tuple_PublicKeyTypeZZ;
-class CResult_RoutingFeesDecodeErrorZ;
 class CResult_PayeePubKeyErrorZ;
+class CResult_RoutingFeesDecodeErrorZ;
 class CResult_QueryShortChannelIdsDecodeErrorZ;
 class CResult_InvoiceSemanticErrorZ;
 class CResult_UpdateAddHTLCDecodeErrorZ;
@@ -310,10 +325,11 @@ class CResult_NoneChannelMonitorUpdateErrZ;
 class CResult_SiPrefixNoneZ;
 class CResult_PublicKeyErrorZ;
 class C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ;
+class CResult_RouteParametersDecodeErrorZ;
 class CResult_NoneNoneZ;
 class CResult_PrivateRouteCreationErrorZ;
-class CResult_boolPeerHandleErrorZ;
 class CVec_APIErrorZ;
+class CResult_boolPeerHandleErrorZ;
 class CResult_ChannelUpdateDecodeErrorZ;
 class CVec_UpdateFulfillHTLCZ;
 class CResult_AnnouncementSignaturesDecodeErrorZ;
@@ -322,7 +338,6 @@ class CResult_NodeFeaturesDecodeErrorZ;
 class CResult_InMemorySignerDecodeErrorZ;
 class CResult_PaymentSecretAPIErrorZ;
 class C2Tuple_u32ScriptZ;
-class CResult_CResult_NetAddressu8ZDecodeErrorZ;
 class CResult_ReplyShortChannelIdsEndDecodeErrorZ;
 class CResult_RouteDecodeErrorZ;
 class CResult_BuiltCommitmentTransactionDecodeErrorZ;
@@ -623,6 +638,36 @@ public:
        const LDKRoute* operator &() const { return &self; }
        const LDKRoute* operator ->() const { return &self; }
 };
+class RouteParameters {
+private:
+       LDKRouteParameters self;
+public:
+       RouteParameters(const RouteParameters&) = delete;
+       RouteParameters(RouteParameters&& o) : self(o.self) { memset(&o, 0, sizeof(RouteParameters)); }
+       RouteParameters(LDKRouteParameters&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKRouteParameters)); }
+       operator LDKRouteParameters() && { LDKRouteParameters res = self; memset(&self, 0, sizeof(LDKRouteParameters)); return res; }
+       ~RouteParameters() { RouteParameters_free(self); }
+       RouteParameters& operator=(RouteParameters&& o) { RouteParameters_free(self); self = o.self; memset(&o, 0, sizeof(RouteParameters)); return *this; }
+       LDKRouteParameters* operator &() { return &self; }
+       LDKRouteParameters* operator ->() { return &self; }
+       const LDKRouteParameters* operator &() const { return &self; }
+       const LDKRouteParameters* operator ->() const { return &self; }
+};
+class Payee {
+private:
+       LDKPayee self;
+public:
+       Payee(const Payee&) = delete;
+       Payee(Payee&& o) : self(o.self) { memset(&o, 0, sizeof(Payee)); }
+       Payee(LDKPayee&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKPayee)); }
+       operator LDKPayee() && { LDKPayee res = self; memset(&self, 0, sizeof(LDKPayee)); return res; }
+       ~Payee() { Payee_free(self); }
+       Payee& operator=(Payee&& o) { Payee_free(self); self = o.self; memset(&o, 0, sizeof(Payee)); return *this; }
+       LDKPayee* operator &() { return &self; }
+       LDKPayee* operator ->() { return &self; }
+       const LDKPayee* operator &() const { return &self; }
+       const LDKPayee* operator ->() const { return &self; }
+};
 class RouteHint {
 private:
        LDKRouteHint self;
@@ -907,6 +952,13 @@ public:
        /**
         *  Returns any monitor events since the last call. Subsequent calls must only return new
         *  events.
+        * 
+        *  Note that after any block- or transaction-connection calls to a [`ChannelMonitor`], no
+        *  further events may be returned here until the [`ChannelMonitor`] has been fully persisted
+        *  to disk.
+        * 
+        *  For details on asynchronous [`ChannelMonitor`] updating and returning
+        *  [`MonitorEvent::UpdateCompleted`] here, see [`ChannelMonitorUpdateErr::TemporaryFailure`].
         */
        inline LDK::CVec_MonitorEventZ release_pending_monitor_events();
 };
@@ -1096,9 +1148,29 @@ public:
        const LDKScore* operator &() const { return &self; }
        const LDKScore* operator ->() const { return &self; }
        /**
-        *  Returns the fee in msats willing to be paid to avoid routing through the given channel.
+        *  Returns the fee in msats willing to be paid to avoid routing through the given channel
+        *  in the direction from `source` to `target`.
         */
-       inline uint64_t channel_penalty_msat(uint64_t short_channel_id);
+       inline uint64_t channel_penalty_msat(uint64_t short_channel_id, const struct LDKNodeId *NONNULL_PTR source, const struct LDKNodeId *NONNULL_PTR target);
+       /**
+        *  Handles updating channel penalties after failing to route through a channel.
+        */
+       inline void payment_path_failed(struct LDKCVec_RouteHopZ path, uint64_t short_channel_id);
+};
+class LockableScore {
+private:
+       LDKLockableScore self;
+public:
+       LockableScore(const LockableScore&) = delete;
+       LockableScore(LockableScore&& o) : self(o.self) { memset(&o, 0, sizeof(LockableScore)); }
+       LockableScore(LDKLockableScore&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKLockableScore)); }
+       operator LDKLockableScore() && { LDKLockableScore res = self; memset(&self, 0, sizeof(LDKLockableScore)); return res; }
+       ~LockableScore() { LockableScore_free(self); }
+       LockableScore& operator=(LockableScore&& o) { LockableScore_free(self); self = o.self; memset(&o, 0, sizeof(LockableScore)); return *this; }
+       LDKLockableScore* operator &() { return &self; }
+       LDKLockableScore* operator ->() { return &self; }
+       const LDKLockableScore* operator &() const { return &self; }
+       const LDKLockableScore* operator ->() const { return &self; }
 };
 class InitFeatures {
 private:
@@ -1175,6 +1247,21 @@ public:
        const LDKScorer* operator &() const { return &self; }
        const LDKScorer* operator ->() const { return &self; }
 };
+class ScoringParameters {
+private:
+       LDKScoringParameters self;
+public:
+       ScoringParameters(const ScoringParameters&) = delete;
+       ScoringParameters(ScoringParameters&& o) : self(o.self) { memset(&o, 0, sizeof(ScoringParameters)); }
+       ScoringParameters(LDKScoringParameters&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKScoringParameters)); }
+       operator LDKScoringParameters() && { LDKScoringParameters res = self; memset(&self, 0, sizeof(LDKScoringParameters)); return res; }
+       ~ScoringParameters() { ScoringParameters_free(self); }
+       ScoringParameters& operator=(ScoringParameters&& o) { ScoringParameters_free(self); self = o.self; memset(&o, 0, sizeof(ScoringParameters)); return *this; }
+       LDKScoringParameters* operator &() { return &self; }
+       LDKScoringParameters* operator ->() { return &self; }
+       const LDKScoringParameters* operator &() const { return &self; }
+       const LDKScoringParameters* operator ->() const { return &self; }
+};
 class DelayedPaymentOutputDescriptor {
 private:
        LDKDelayedPaymentOutputDescriptor self;
@@ -1509,21 +1596,6 @@ public:
        const LDKFilesystemPersister* operator &() const { return &self; }
        const LDKFilesystemPersister* operator ->() const { return &self; }
 };
-class PaymentId {
-private:
-       LDKPaymentId self;
-public:
-       PaymentId(const PaymentId&) = delete;
-       PaymentId(PaymentId&& o) : self(o.self) { memset(&o, 0, sizeof(PaymentId)); }
-       PaymentId(LDKPaymentId&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKPaymentId)); }
-       operator LDKPaymentId() && { LDKPaymentId res = self; memset(&self, 0, sizeof(LDKPaymentId)); return res; }
-       ~PaymentId() { PaymentId_free(self); }
-       PaymentId& operator=(PaymentId&& o) { PaymentId_free(self); self = o.self; memset(&o, 0, sizeof(PaymentId)); return *this; }
-       LDKPaymentId* operator &() { return &self; }
-       LDKPaymentId* operator ->() { return &self; }
-       const LDKPaymentId* operator &() const { return &self; }
-       const LDKPaymentId* operator ->() const { return &self; }
-};
 class ChannelManager {
 private:
        LDKChannelManager self;
@@ -1764,6 +1836,105 @@ public:
         */
        inline LDK::Str debug_str();
 };
+class InvoicePayer {
+private:
+       LDKInvoicePayer self;
+public:
+       InvoicePayer(const InvoicePayer&) = delete;
+       InvoicePayer(InvoicePayer&& o) : self(o.self) { memset(&o, 0, sizeof(InvoicePayer)); }
+       InvoicePayer(LDKInvoicePayer&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKInvoicePayer)); }
+       operator LDKInvoicePayer() && { LDKInvoicePayer res = self; memset(&self, 0, sizeof(LDKInvoicePayer)); return res; }
+       ~InvoicePayer() { InvoicePayer_free(self); }
+       InvoicePayer& operator=(InvoicePayer&& o) { InvoicePayer_free(self); self = o.self; memset(&o, 0, sizeof(InvoicePayer)); return *this; }
+       LDKInvoicePayer* operator &() { return &self; }
+       LDKInvoicePayer* operator ->() { return &self; }
+       const LDKInvoicePayer* operator &() const { return &self; }
+       const LDKInvoicePayer* operator ->() const { return &self; }
+};
+class Payer {
+private:
+       LDKPayer self;
+public:
+       Payer(const Payer&) = delete;
+       Payer(Payer&& o) : self(o.self) { memset(&o, 0, sizeof(Payer)); }
+       Payer(LDKPayer&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKPayer)); }
+       operator LDKPayer() && { LDKPayer res = self; memset(&self, 0, sizeof(LDKPayer)); return res; }
+       ~Payer() { Payer_free(self); }
+       Payer& operator=(Payer&& o) { Payer_free(self); self = o.self; memset(&o, 0, sizeof(Payer)); return *this; }
+       LDKPayer* operator &() { return &self; }
+       LDKPayer* operator ->() { return &self; }
+       const LDKPayer* operator &() const { return &self; }
+       const LDKPayer* operator ->() const { return &self; }
+       /**
+        *  Returns the payer's node id.
+        */
+       inline LDKPublicKey node_id();
+       /**
+        *  Returns the payer's channels.
+        */
+       inline LDK::CVec_ChannelDetailsZ first_hops();
+       /**
+        *  Sends a payment over the Lightning Network using the given [`Route`].
+        * 
+        *  Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None
+        */
+       inline LDK::CResult_PaymentIdPaymentSendFailureZ send_payment(const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret);
+       /**
+        *  Retries a failed payment path for the [`PaymentId`] using the given [`Route`].
+        */
+       inline LDK::CResult_NonePaymentSendFailureZ retry_payment(const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_id);
+};
+class Router {
+private:
+       LDKRouter self;
+public:
+       Router(const Router&) = delete;
+       Router(Router&& o) : self(o.self) { memset(&o, 0, sizeof(Router)); }
+       Router(LDKRouter&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKRouter)); }
+       operator LDKRouter() && { LDKRouter res = self; memset(&self, 0, sizeof(LDKRouter)); return res; }
+       ~Router() { Router_free(self); }
+       Router& operator=(Router&& o) { Router_free(self); self = o.self; memset(&o, 0, sizeof(Router)); return *this; }
+       LDKRouter* operator &() { return &self; }
+       LDKRouter* operator ->() { return &self; }
+       const LDKRouter* operator &() const { return &self; }
+       const LDKRouter* operator ->() const { return &self; }
+       /**
+        *  Finds a [`Route`] between `payer` and `payee` for a payment with the given values.
+        * 
+        *  Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
+        */
+       inline LDK::CResult_RouteLightningErrorZ find_route(struct LDKPublicKey payer, const struct LDKRouteParameters *NONNULL_PTR params, struct LDKCVec_ChannelDetailsZ *first_hops, const struct LDKScore *NONNULL_PTR scorer);
+};
+class RetryAttempts {
+private:
+       LDKRetryAttempts self;
+public:
+       RetryAttempts(const RetryAttempts&) = delete;
+       RetryAttempts(RetryAttempts&& o) : self(o.self) { memset(&o, 0, sizeof(RetryAttempts)); }
+       RetryAttempts(LDKRetryAttempts&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKRetryAttempts)); }
+       operator LDKRetryAttempts() && { LDKRetryAttempts res = self; memset(&self, 0, sizeof(LDKRetryAttempts)); return res; }
+       ~RetryAttempts() { RetryAttempts_free(self); }
+       RetryAttempts& operator=(RetryAttempts&& o) { RetryAttempts_free(self); self = o.self; memset(&o, 0, sizeof(RetryAttempts)); return *this; }
+       LDKRetryAttempts* operator &() { return &self; }
+       LDKRetryAttempts* operator ->() { return &self; }
+       const LDKRetryAttempts* operator &() const { return &self; }
+       const LDKRetryAttempts* operator ->() const { return &self; }
+};
+class PaymentError {
+private:
+       LDKPaymentError self;
+public:
+       PaymentError(const PaymentError&) = delete;
+       PaymentError(PaymentError&& o) : self(o.self) { memset(&o, 0, sizeof(PaymentError)); }
+       PaymentError(LDKPaymentError&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKPaymentError)); }
+       operator LDKPaymentError() && { LDKPaymentError res = self; memset(&self, 0, sizeof(LDKPaymentError)); return res; }
+       ~PaymentError() { PaymentError_free(self); }
+       PaymentError& operator=(PaymentError&& o) { PaymentError_free(self); self = o.self; memset(&o, 0, sizeof(PaymentError)); return *this; }
+       LDKPaymentError* operator &() { return &self; }
+       LDKPaymentError* operator ->() { return &self; }
+       const LDKPaymentError* operator &() const { return &self; }
+       const LDKPaymentError* operator ->() const { return &self; }
+};
 class Invoice {
 private:
        LDKInvoice self;
@@ -3163,6 +3334,21 @@ public:
         */
        inline LDK::CResult_NoneLightningErrorZ handle_query_short_channel_ids(struct LDKPublicKey their_node_id, struct LDKQueryShortChannelIds msg);
 };
+class DefaultRouter {
+private:
+       LDKDefaultRouter self;
+public:
+       DefaultRouter(const DefaultRouter&) = delete;
+       DefaultRouter(DefaultRouter&& o) : self(o.self) { memset(&o, 0, sizeof(DefaultRouter)); }
+       DefaultRouter(LDKDefaultRouter&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKDefaultRouter)); }
+       operator LDKDefaultRouter() && { LDKDefaultRouter res = self; memset(&self, 0, sizeof(LDKDefaultRouter)); return res; }
+       ~DefaultRouter() { DefaultRouter_free(self); }
+       DefaultRouter& operator=(DefaultRouter&& o) { DefaultRouter_free(self); self = o.self; memset(&o, 0, sizeof(DefaultRouter)); return *this; }
+       LDKDefaultRouter* operator &() { return &self; }
+       LDKDefaultRouter* operator ->() { return &self; }
+       const LDKDefaultRouter* operator &() const { return &self; }
+       const LDKDefaultRouter* operator ->() const { return &self; }
+};
 class Level {
 private:
        LDKLevel self;
@@ -3196,6 +3382,21 @@ public:
         */
        inline void log(const char *record);
 };
+class MonitorUpdateId {
+private:
+       LDKMonitorUpdateId self;
+public:
+       MonitorUpdateId(const MonitorUpdateId&) = delete;
+       MonitorUpdateId(MonitorUpdateId&& o) : self(o.self) { memset(&o, 0, sizeof(MonitorUpdateId)); }
+       MonitorUpdateId(LDKMonitorUpdateId&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKMonitorUpdateId)); }
+       operator LDKMonitorUpdateId() && { LDKMonitorUpdateId res = self; memset(&self, 0, sizeof(LDKMonitorUpdateId)); return res; }
+       ~MonitorUpdateId() { MonitorUpdateId_free(self); }
+       MonitorUpdateId& operator=(MonitorUpdateId&& o) { MonitorUpdateId_free(self); self = o.self; memset(&o, 0, sizeof(MonitorUpdateId)); return *this; }
+       LDKMonitorUpdateId* operator &() { return &self; }
+       LDKMonitorUpdateId* operator ->() { return &self; }
+       const LDKMonitorUpdateId* operator &() const { return &self; }
+       const LDKMonitorUpdateId* operator ->() const { return &self; }
+};
 class Persist {
 private:
        LDKPersist self;
@@ -3211,25 +3412,36 @@ public:
        const LDKPersist* operator &() const { return &self; }
        const LDKPersist* operator ->() const { return &self; }
        /**
-        *  Persist a new channel's data. The data can be stored any way you want, but
-        *  the identifier provided by Rust-Lightning is the channel's outpoint (and
-        *  it is up to you to maintain a correct mapping between the outpoint and the
-        *  stored channel data). Note that you **must** persist every new monitor to
-        *  disk. See the `Persist` trait documentation for more details.
+        *  Persist a new channel's data in response to a [`chain::Watch::watch_channel`] call. This is
+        *  called by [`ChannelManager`] for new channels, or may be called directly, e.g. on startup.
+        * 
+        *  The data can be stored any way you want, but the identifier provided by LDK is the
+        *  channel's outpoint (and it is up to you to maintain a correct mapping between the outpoint
+        *  and the stored channel data). Note that you **must** persist every new monitor to disk.
+        * 
+        *  The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`],
+        *  if you return [`ChannelMonitorUpdateErr::TemporaryFailure`].
         * 
         *  See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`
         *  and [`ChannelMonitorUpdateErr`] 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 id, const struct LDKChannelMonitor *NONNULL_PTR data);
+       inline LDK::CResult_NoneChannelMonitorUpdateErrZ 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.
+        *  Update one channel's data. The provided [`ChannelMonitor`] has already applied the given
+        *  update.
         * 
-        *  Note that on every update, you **must** persist either the
-        *  `ChannelMonitorUpdate` or the updated monitor itself to disk/backups. See
-        *  the `Persist` trait documentation for more details.
+        *  Note that on every update, you **must** persist either the [`ChannelMonitorUpdate`] or the
+        *  updated monitor itself to disk/backups. See the [`Persist`] trait documentation for more
+        *  details.
+        * 
+        *  During blockchain synchronization operations, this may be called with no
+        *  [`ChannelMonitorUpdate`], in which case the full [`ChannelMonitor`] needs to be persisted.
+        *  Note that after the full [`ChannelMonitor`] is persisted any previous
+        *  [`ChannelMonitorUpdate`]s which were persisted should be discarded - they can no longer be
+        *  applied to the persisted [`ChannelMonitor`] as they were already applied.
         * 
         *  If an implementer chooses to persist the updates only, they need to make
         *  sure that all the updates are applied to the `ChannelMonitors` *before*
@@ -3243,13 +3455,18 @@ public:
         *  them in batches. The size of each monitor grows `O(number of state updates)`
         *  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`].
+        * 
         *  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.
         * 
         *  [`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 id, const struct LDKChannelMonitorUpdate *NONNULL_PTR update, const struct LDKChannelMonitor *NONNULL_PTR data);
+       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);
 };
 class LockedChannelMonitor {
 private:
@@ -3326,20 +3543,20 @@ public:
        const LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* operator &() const { return &self; }
        const LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* operator ->() const { return &self; }
 };
-class CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
+class CResult_ScoringParametersDecodeErrorZ {
 private:
-       LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ self;
+       LDKCResult_ScoringParametersDecodeErrorZ self;
 public:
-       CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ(const CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ&) = delete;
-       CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ(CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ)); }
-       CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ)); }
-       operator LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ() && { LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ res = self; memset(&self, 0, sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ)); return res; }
-       ~CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ() { CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(self); }
-       CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ& operator=(CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ&& o) { CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ)); return *this; }
-       LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ* operator &() { return &self; }
-       LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ* operator ->() { return &self; }
-       const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ* operator &() const { return &self; }
-       const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ* operator ->() const { return &self; }
+       CResult_ScoringParametersDecodeErrorZ(const CResult_ScoringParametersDecodeErrorZ&) = delete;
+       CResult_ScoringParametersDecodeErrorZ(CResult_ScoringParametersDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ScoringParametersDecodeErrorZ)); }
+       CResult_ScoringParametersDecodeErrorZ(LDKCResult_ScoringParametersDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ScoringParametersDecodeErrorZ)); }
+       operator LDKCResult_ScoringParametersDecodeErrorZ() && { LDKCResult_ScoringParametersDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ScoringParametersDecodeErrorZ)); return res; }
+       ~CResult_ScoringParametersDecodeErrorZ() { CResult_ScoringParametersDecodeErrorZ_free(self); }
+       CResult_ScoringParametersDecodeErrorZ& operator=(CResult_ScoringParametersDecodeErrorZ&& o) { CResult_ScoringParametersDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ScoringParametersDecodeErrorZ)); return *this; }
+       LDKCResult_ScoringParametersDecodeErrorZ* operator &() { return &self; }
+       LDKCResult_ScoringParametersDecodeErrorZ* operator ->() { return &self; }
+       const LDKCResult_ScoringParametersDecodeErrorZ* operator &() const { return &self; }
+       const LDKCResult_ScoringParametersDecodeErrorZ* operator ->() const { return &self; }
 };
 class CResult_HTLCUpdateDecodeErrorZ {
 private:
@@ -3371,6 +3588,21 @@ public:
        const LDKC2Tuple_SignatureCVec_SignatureZZ* operator &() const { return &self; }
        const LDKC2Tuple_SignatureCVec_SignatureZZ* operator ->() const { return &self; }
 };
+class CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
+private:
+       LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ self;
+public:
+       CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ(const CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ&) = delete;
+       CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ(CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ)); }
+       CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ)); }
+       operator LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ() && { LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ res = self; memset(&self, 0, sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ)); return res; }
+       ~CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ() { CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(self); }
+       CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ& operator=(CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ&& o) { CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ)); return *this; }
+       LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ* operator &() { return &self; }
+       LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ* operator ->() { return &self; }
+       const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ* operator &() const { return &self; }
+       const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ* operator ->() const { return &self; }
+};
 class CVec_C2Tuple_u32TxOutZZ {
 private:
        LDKCVec_C2Tuple_u32TxOutZZ self;
@@ -3581,6 +3813,21 @@ public:
        const LDKC2Tuple_PublicKeyTypeZ* operator &() const { return &self; }
        const LDKC2Tuple_PublicKeyTypeZ* operator ->() const { return &self; }
 };
+class CResult_RouteHintDecodeErrorZ {
+private:
+       LDKCResult_RouteHintDecodeErrorZ self;
+public:
+       CResult_RouteHintDecodeErrorZ(const CResult_RouteHintDecodeErrorZ&) = delete;
+       CResult_RouteHintDecodeErrorZ(CResult_RouteHintDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_RouteHintDecodeErrorZ)); }
+       CResult_RouteHintDecodeErrorZ(LDKCResult_RouteHintDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_RouteHintDecodeErrorZ)); }
+       operator LDKCResult_RouteHintDecodeErrorZ() && { LDKCResult_RouteHintDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_RouteHintDecodeErrorZ)); return res; }
+       ~CResult_RouteHintDecodeErrorZ() { CResult_RouteHintDecodeErrorZ_free(self); }
+       CResult_RouteHintDecodeErrorZ& operator=(CResult_RouteHintDecodeErrorZ&& o) { CResult_RouteHintDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_RouteHintDecodeErrorZ)); return *this; }
+       LDKCResult_RouteHintDecodeErrorZ* operator &() { return &self; }
+       LDKCResult_RouteHintDecodeErrorZ* operator ->() { return &self; }
+       const LDKCResult_RouteHintDecodeErrorZ* operator &() const { return &self; }
+       const LDKCResult_RouteHintDecodeErrorZ* operator ->() const { return &self; }
+};
 class CResult_NetAddressDecodeErrorZ {
 private:
        LDKCResult_NetAddressDecodeErrorZ self;
@@ -3626,21 +3873,6 @@ public:
        const LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* operator &() const { return &self; }
        const LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* operator ->() const { return &self; }
 };
-class CResult_ReplyChannelRangeDecodeErrorZ {
-private:
-       LDKCResult_ReplyChannelRangeDecodeErrorZ self;
-public:
-       CResult_ReplyChannelRangeDecodeErrorZ(const CResult_ReplyChannelRangeDecodeErrorZ&) = delete;
-       CResult_ReplyChannelRangeDecodeErrorZ(CResult_ReplyChannelRangeDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ReplyChannelRangeDecodeErrorZ)); }
-       CResult_ReplyChannelRangeDecodeErrorZ(LDKCResult_ReplyChannelRangeDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ)); }
-       operator LDKCResult_ReplyChannelRangeDecodeErrorZ() && { LDKCResult_ReplyChannelRangeDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ)); return res; }
-       ~CResult_ReplyChannelRangeDecodeErrorZ() { CResult_ReplyChannelRangeDecodeErrorZ_free(self); }
-       CResult_ReplyChannelRangeDecodeErrorZ& operator=(CResult_ReplyChannelRangeDecodeErrorZ&& o) { CResult_ReplyChannelRangeDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ReplyChannelRangeDecodeErrorZ)); return *this; }
-       LDKCResult_ReplyChannelRangeDecodeErrorZ* operator &() { return &self; }
-       LDKCResult_ReplyChannelRangeDecodeErrorZ* operator ->() { return &self; }
-       const LDKCResult_ReplyChannelRangeDecodeErrorZ* operator &() const { return &self; }
-       const LDKCResult_ReplyChannelRangeDecodeErrorZ* operator ->() const { return &self; }
-};
 class CResult_CommitmentSignedDecodeErrorZ {
 private:
        LDKCResult_CommitmentSignedDecodeErrorZ self;
@@ -3671,20 +3903,20 @@ public:
        const LDKCVec_UpdateAddHTLCZ* operator &() const { return &self; }
        const LDKCVec_UpdateAddHTLCZ* operator ->() const { return &self; }
 };
-class CResult_GossipTimestampFilterDecodeErrorZ {
+class CResult_ReplyChannelRangeDecodeErrorZ {
 private:
-       LDKCResult_GossipTimestampFilterDecodeErrorZ self;
+       LDKCResult_ReplyChannelRangeDecodeErrorZ self;
 public:
-       CResult_GossipTimestampFilterDecodeErrorZ(const CResult_GossipTimestampFilterDecodeErrorZ&) = delete;
-       CResult_GossipTimestampFilterDecodeErrorZ(CResult_GossipTimestampFilterDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_GossipTimestampFilterDecodeErrorZ)); }
-       CResult_GossipTimestampFilterDecodeErrorZ(LDKCResult_GossipTimestampFilterDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ)); }
-       operator LDKCResult_GossipTimestampFilterDecodeErrorZ() && { LDKCResult_GossipTimestampFilterDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ)); return res; }
-       ~CResult_GossipTimestampFilterDecodeErrorZ() { CResult_GossipTimestampFilterDecodeErrorZ_free(self); }
-       CResult_GossipTimestampFilterDecodeErrorZ& operator=(CResult_GossipTimestampFilterDecodeErrorZ&& o) { CResult_GossipTimestampFilterDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_GossipTimestampFilterDecodeErrorZ)); return *this; }
-       LDKCResult_GossipTimestampFilterDecodeErrorZ* operator &() { return &self; }
-       LDKCResult_GossipTimestampFilterDecodeErrorZ* operator ->() { return &self; }
-       const LDKCResult_GossipTimestampFilterDecodeErrorZ* operator &() const { return &self; }
-       const LDKCResult_GossipTimestampFilterDecodeErrorZ* operator ->() const { return &self; }
+       CResult_ReplyChannelRangeDecodeErrorZ(const CResult_ReplyChannelRangeDecodeErrorZ&) = delete;
+       CResult_ReplyChannelRangeDecodeErrorZ(CResult_ReplyChannelRangeDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ReplyChannelRangeDecodeErrorZ)); }
+       CResult_ReplyChannelRangeDecodeErrorZ(LDKCResult_ReplyChannelRangeDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ)); }
+       operator LDKCResult_ReplyChannelRangeDecodeErrorZ() && { LDKCResult_ReplyChannelRangeDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ)); return res; }
+       ~CResult_ReplyChannelRangeDecodeErrorZ() { CResult_ReplyChannelRangeDecodeErrorZ_free(self); }
+       CResult_ReplyChannelRangeDecodeErrorZ& operator=(CResult_ReplyChannelRangeDecodeErrorZ&& o) { CResult_ReplyChannelRangeDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ReplyChannelRangeDecodeErrorZ)); return *this; }
+       LDKCResult_ReplyChannelRangeDecodeErrorZ* operator &() { return &self; }
+       LDKCResult_ReplyChannelRangeDecodeErrorZ* operator ->() { return &self; }
+       const LDKCResult_ReplyChannelRangeDecodeErrorZ* operator &() const { return &self; }
+       const LDKCResult_ReplyChannelRangeDecodeErrorZ* operator ->() const { return &self; }
 };
 class COption_u32Z {
 private:
@@ -3746,20 +3978,20 @@ public:
        const LDKCResult_PaymentIdPaymentSendFailureZ* operator &() const { return &self; }
        const LDKCResult_PaymentIdPaymentSendFailureZ* operator ->() const { return &self; }
 };
-class CResult_InvoiceSignOrCreationErrorZ {
+class CResult_GossipTimestampFilterDecodeErrorZ {
 private:
-       LDKCResult_InvoiceSignOrCreationErrorZ self;
+       LDKCResult_GossipTimestampFilterDecodeErrorZ 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; }
+       CResult_GossipTimestampFilterDecodeErrorZ(const CResult_GossipTimestampFilterDecodeErrorZ&) = delete;
+       CResult_GossipTimestampFilterDecodeErrorZ(CResult_GossipTimestampFilterDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_GossipTimestampFilterDecodeErrorZ)); }
+       CResult_GossipTimestampFilterDecodeErrorZ(LDKCResult_GossipTimestampFilterDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ)); }
+       operator LDKCResult_GossipTimestampFilterDecodeErrorZ() && { LDKCResult_GossipTimestampFilterDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ)); return res; }
+       ~CResult_GossipTimestampFilterDecodeErrorZ() { CResult_GossipTimestampFilterDecodeErrorZ_free(self); }
+       CResult_GossipTimestampFilterDecodeErrorZ& operator=(CResult_GossipTimestampFilterDecodeErrorZ&& o) { CResult_GossipTimestampFilterDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_GossipTimestampFilterDecodeErrorZ)); return *this; }
+       LDKCResult_GossipTimestampFilterDecodeErrorZ* operator &() { return &self; }
+       LDKCResult_GossipTimestampFilterDecodeErrorZ* operator ->() { return &self; }
+       const LDKCResult_GossipTimestampFilterDecodeErrorZ* operator &() const { return &self; }
+       const LDKCResult_GossipTimestampFilterDecodeErrorZ* operator ->() const { return &self; }
 };
 class CResult_CommitmentTransactionDecodeErrorZ {
 private:
@@ -3866,20 +4098,20 @@ public:
        const LDKCResult_PingDecodeErrorZ* operator &() const { return &self; }
        const LDKCResult_PingDecodeErrorZ* operator ->() const { return &self; }
 };
-class COption_FilterZ {
+class CResult_InvoiceSignOrCreationErrorZ {
 private:
-       LDKCOption_FilterZ self;
+       LDKCResult_InvoiceSignOrCreationErrorZ 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_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:
@@ -3941,6 +4173,21 @@ public:
        const LDKCVec_CVec_u8ZZ* operator &() const { return &self; }
        const LDKCVec_CVec_u8ZZ* 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 CResult_SecretKeyErrorZ {
 private:
        LDKCResult_SecretKeyErrorZ self;
@@ -4256,20 +4503,20 @@ public:
        const LDKCResult_NodeAnnouncementInfoDecodeErrorZ* operator &() const { return &self; }
        const LDKCResult_NodeAnnouncementInfoDecodeErrorZ* operator ->() const { return &self; }
 };
-class CResult_NetAddressu8Z {
+class CVec_UpdateFailMalformedHTLCZ {
 private:
-       LDKCResult_NetAddressu8Z self;
+       LDKCVec_UpdateFailMalformedHTLCZ self;
 public:
-       CResult_NetAddressu8Z(const CResult_NetAddressu8Z&) = delete;
-       CResult_NetAddressu8Z(CResult_NetAddressu8Z&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NetAddressu8Z)); }
-       CResult_NetAddressu8Z(LDKCResult_NetAddressu8Z&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NetAddressu8Z)); }
-       operator LDKCResult_NetAddressu8Z() && { LDKCResult_NetAddressu8Z res = self; memset(&self, 0, sizeof(LDKCResult_NetAddressu8Z)); return res; }
-       ~CResult_NetAddressu8Z() { CResult_NetAddressu8Z_free(self); }
-       CResult_NetAddressu8Z& operator=(CResult_NetAddressu8Z&& o) { CResult_NetAddressu8Z_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NetAddressu8Z)); return *this; }
-       LDKCResult_NetAddressu8Z* operator &() { return &self; }
-       LDKCResult_NetAddressu8Z* operator ->() { return &self; }
-       const LDKCResult_NetAddressu8Z* operator &() const { return &self; }
-       const LDKCResult_NetAddressu8Z* operator ->() const { return &self; }
+       CVec_UpdateFailMalformedHTLCZ(const CVec_UpdateFailMalformedHTLCZ&) = delete;
+       CVec_UpdateFailMalformedHTLCZ(CVec_UpdateFailMalformedHTLCZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_UpdateFailMalformedHTLCZ)); }
+       CVec_UpdateFailMalformedHTLCZ(LDKCVec_UpdateFailMalformedHTLCZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_UpdateFailMalformedHTLCZ)); }
+       operator LDKCVec_UpdateFailMalformedHTLCZ() && { LDKCVec_UpdateFailMalformedHTLCZ res = self; memset(&self, 0, sizeof(LDKCVec_UpdateFailMalformedHTLCZ)); return res; }
+       ~CVec_UpdateFailMalformedHTLCZ() { CVec_UpdateFailMalformedHTLCZ_free(self); }
+       CVec_UpdateFailMalformedHTLCZ& operator=(CVec_UpdateFailMalformedHTLCZ&& o) { CVec_UpdateFailMalformedHTLCZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_UpdateFailMalformedHTLCZ)); return *this; }
+       LDKCVec_UpdateFailMalformedHTLCZ* operator &() { return &self; }
+       LDKCVec_UpdateFailMalformedHTLCZ* operator ->() { return &self; }
+       const LDKCVec_UpdateFailMalformedHTLCZ* operator &() const { return &self; }
+       const LDKCVec_UpdateFailMalformedHTLCZ* operator ->() const { return &self; }
 };
 class C3Tuple_RawInvoice_u832InvoiceSignatureZ {
 private:
@@ -4286,21 +4533,6 @@ public:
        const LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* operator &() const { return &self; }
        const LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* operator ->() const { return &self; }
 };
-class CVec_UpdateFailMalformedHTLCZ {
-private:
-       LDKCVec_UpdateFailMalformedHTLCZ self;
-public:
-       CVec_UpdateFailMalformedHTLCZ(const CVec_UpdateFailMalformedHTLCZ&) = delete;
-       CVec_UpdateFailMalformedHTLCZ(CVec_UpdateFailMalformedHTLCZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_UpdateFailMalformedHTLCZ)); }
-       CVec_UpdateFailMalformedHTLCZ(LDKCVec_UpdateFailMalformedHTLCZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_UpdateFailMalformedHTLCZ)); }
-       operator LDKCVec_UpdateFailMalformedHTLCZ() && { LDKCVec_UpdateFailMalformedHTLCZ res = self; memset(&self, 0, sizeof(LDKCVec_UpdateFailMalformedHTLCZ)); return res; }
-       ~CVec_UpdateFailMalformedHTLCZ() { CVec_UpdateFailMalformedHTLCZ_free(self); }
-       CVec_UpdateFailMalformedHTLCZ& operator=(CVec_UpdateFailMalformedHTLCZ&& o) { CVec_UpdateFailMalformedHTLCZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_UpdateFailMalformedHTLCZ)); return *this; }
-       LDKCVec_UpdateFailMalformedHTLCZ* operator &() { return &self; }
-       LDKCVec_UpdateFailMalformedHTLCZ* operator ->() { return &self; }
-       const LDKCVec_UpdateFailMalformedHTLCZ* operator &() const { return &self; }
-       const LDKCVec_UpdateFailMalformedHTLCZ* operator ->() const { return &self; }
-};
 class CResult_FundingSignedDecodeErrorZ {
 private:
        LDKCResult_FundingSignedDecodeErrorZ self;
@@ -4496,6 +4728,21 @@ public:
        const LDKCResult_SignatureNoneZ* operator &() const { return &self; }
        const LDKCResult_SignatureNoneZ* operator ->() const { return &self; }
 };
+class CVec_RouteHintHopZ {
+private:
+       LDKCVec_RouteHintHopZ self;
+public:
+       CVec_RouteHintHopZ(const CVec_RouteHintHopZ&) = delete;
+       CVec_RouteHintHopZ(CVec_RouteHintHopZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_RouteHintHopZ)); }
+       CVec_RouteHintHopZ(LDKCVec_RouteHintHopZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_RouteHintHopZ)); }
+       operator LDKCVec_RouteHintHopZ() && { LDKCVec_RouteHintHopZ res = self; memset(&self, 0, sizeof(LDKCVec_RouteHintHopZ)); return res; }
+       ~CVec_RouteHintHopZ() { CVec_RouteHintHopZ_free(self); }
+       CVec_RouteHintHopZ& operator=(CVec_RouteHintHopZ&& o) { CVec_RouteHintHopZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_RouteHintHopZ)); return *this; }
+       LDKCVec_RouteHintHopZ* operator &() { return &self; }
+       LDKCVec_RouteHintHopZ* operator ->() { return &self; }
+       const LDKCVec_RouteHintHopZ* operator &() const { return &self; }
+       const LDKCVec_RouteHintHopZ* operator ->() const { return &self; }
+};
 class C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
 private:
        LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ self;
@@ -4601,20 +4848,20 @@ public:
        const LDKC2Tuple_OutPointScriptZ* operator &() const { return &self; }
        const LDKC2Tuple_OutPointScriptZ* operator ->() const { return &self; }
 };
-class CResult_PaymentIdDecodeErrorZ {
+class CResult_RouteHintHopDecodeErrorZ {
 private:
-       LDKCResult_PaymentIdDecodeErrorZ self;
+       LDKCResult_RouteHintHopDecodeErrorZ self;
 public:
-       CResult_PaymentIdDecodeErrorZ(const CResult_PaymentIdDecodeErrorZ&) = delete;
-       CResult_PaymentIdDecodeErrorZ(CResult_PaymentIdDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PaymentIdDecodeErrorZ)); }
-       CResult_PaymentIdDecodeErrorZ(LDKCResult_PaymentIdDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PaymentIdDecodeErrorZ)); }
-       operator LDKCResult_PaymentIdDecodeErrorZ() && { LDKCResult_PaymentIdDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PaymentIdDecodeErrorZ)); return res; }
-       ~CResult_PaymentIdDecodeErrorZ() { CResult_PaymentIdDecodeErrorZ_free(self); }
-       CResult_PaymentIdDecodeErrorZ& operator=(CResult_PaymentIdDecodeErrorZ&& o) { CResult_PaymentIdDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PaymentIdDecodeErrorZ)); return *this; }
-       LDKCResult_PaymentIdDecodeErrorZ* operator &() { return &self; }
-       LDKCResult_PaymentIdDecodeErrorZ* operator ->() { return &self; }
-       const LDKCResult_PaymentIdDecodeErrorZ* operator &() const { return &self; }
-       const LDKCResult_PaymentIdDecodeErrorZ* operator ->() const { return &self; }
+       CResult_RouteHintHopDecodeErrorZ(const CResult_RouteHintHopDecodeErrorZ&) = delete;
+       CResult_RouteHintHopDecodeErrorZ(CResult_RouteHintHopDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_RouteHintHopDecodeErrorZ)); }
+       CResult_RouteHintHopDecodeErrorZ(LDKCResult_RouteHintHopDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_RouteHintHopDecodeErrorZ)); }
+       operator LDKCResult_RouteHintHopDecodeErrorZ() && { LDKCResult_RouteHintHopDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_RouteHintHopDecodeErrorZ)); return res; }
+       ~CResult_RouteHintHopDecodeErrorZ() { CResult_RouteHintHopDecodeErrorZ_free(self); }
+       CResult_RouteHintHopDecodeErrorZ& operator=(CResult_RouteHintHopDecodeErrorZ&& o) { CResult_RouteHintHopDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_RouteHintHopDecodeErrorZ)); return *this; }
+       LDKCResult_RouteHintHopDecodeErrorZ* operator &() { return &self; }
+       LDKCResult_RouteHintHopDecodeErrorZ* operator ->() { return &self; }
+       const LDKCResult_RouteHintHopDecodeErrorZ* operator &() const { return &self; }
+       const LDKCResult_RouteHintHopDecodeErrorZ* operator ->() const { return &self; }
 };
 class CResult_UpdateFailMalformedHTLCDecodeErrorZ {
 private:
@@ -4856,20 +5103,20 @@ public:
        const LDKCVec_u64Z* operator &() const { return &self; }
        const LDKCVec_u64Z* operator ->() const { return &self; }
 };
-class CResult_PongDecodeErrorZ {
+class CResult_ScorerDecodeErrorZ {
 private:
-       LDKCResult_PongDecodeErrorZ self;
+       LDKCResult_ScorerDecodeErrorZ self;
 public:
-       CResult_PongDecodeErrorZ(const CResult_PongDecodeErrorZ&) = delete;
-       CResult_PongDecodeErrorZ(CResult_PongDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PongDecodeErrorZ)); }
-       CResult_PongDecodeErrorZ(LDKCResult_PongDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PongDecodeErrorZ)); }
-       operator LDKCResult_PongDecodeErrorZ() && { LDKCResult_PongDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PongDecodeErrorZ)); return res; }
-       ~CResult_PongDecodeErrorZ() { CResult_PongDecodeErrorZ_free(self); }
-       CResult_PongDecodeErrorZ& operator=(CResult_PongDecodeErrorZ&& o) { CResult_PongDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PongDecodeErrorZ)); return *this; }
-       LDKCResult_PongDecodeErrorZ* operator &() { return &self; }
-       LDKCResult_PongDecodeErrorZ* operator ->() { return &self; }
-       const LDKCResult_PongDecodeErrorZ* operator &() const { return &self; }
-       const LDKCResult_PongDecodeErrorZ* operator ->() const { return &self; }
+       CResult_ScorerDecodeErrorZ(const CResult_ScorerDecodeErrorZ&) = delete;
+       CResult_ScorerDecodeErrorZ(CResult_ScorerDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ScorerDecodeErrorZ)); }
+       CResult_ScorerDecodeErrorZ(LDKCResult_ScorerDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ScorerDecodeErrorZ)); }
+       operator LDKCResult_ScorerDecodeErrorZ() && { LDKCResult_ScorerDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ScorerDecodeErrorZ)); return res; }
+       ~CResult_ScorerDecodeErrorZ() { CResult_ScorerDecodeErrorZ_free(self); }
+       CResult_ScorerDecodeErrorZ& operator=(CResult_ScorerDecodeErrorZ&& o) { CResult_ScorerDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ScorerDecodeErrorZ)); return *this; }
+       LDKCResult_ScorerDecodeErrorZ* operator &() { return &self; }
+       LDKCResult_ScorerDecodeErrorZ* operator ->() { return &self; }
+       const LDKCResult_ScorerDecodeErrorZ* operator &() const { return &self; }
+       const LDKCResult_ScorerDecodeErrorZ* operator ->() const { return &self; }
 };
 class CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
 private:
@@ -4946,6 +5193,21 @@ public:
        const LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* operator &() const { return &self; }
        const LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* operator ->() const { return &self; }
 };
+class CResult_PongDecodeErrorZ {
+private:
+       LDKCResult_PongDecodeErrorZ self;
+public:
+       CResult_PongDecodeErrorZ(const CResult_PongDecodeErrorZ&) = delete;
+       CResult_PongDecodeErrorZ(CResult_PongDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PongDecodeErrorZ)); }
+       CResult_PongDecodeErrorZ(LDKCResult_PongDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PongDecodeErrorZ)); }
+       operator LDKCResult_PongDecodeErrorZ() && { LDKCResult_PongDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PongDecodeErrorZ)); return res; }
+       ~CResult_PongDecodeErrorZ() { CResult_PongDecodeErrorZ_free(self); }
+       CResult_PongDecodeErrorZ& operator=(CResult_PongDecodeErrorZ&& o) { CResult_PongDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PongDecodeErrorZ)); return *this; }
+       LDKCResult_PongDecodeErrorZ* operator &() { return &self; }
+       LDKCResult_PongDecodeErrorZ* operator ->() { return &self; }
+       const LDKCResult_PongDecodeErrorZ* operator &() const { return &self; }
+       const LDKCResult_PongDecodeErrorZ* operator ->() const { return &self; }
+};
 class CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
 private:
        LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ self;
@@ -5081,6 +5343,21 @@ public:
        const LDKCResult_CVec_SignatureZNoneZ* operator &() const { return &self; }
        const LDKCResult_CVec_SignatureZNoneZ* operator ->() const { return &self; }
 };
+class CResult_PayeeDecodeErrorZ {
+private:
+       LDKCResult_PayeeDecodeErrorZ self;
+public:
+       CResult_PayeeDecodeErrorZ(const CResult_PayeeDecodeErrorZ&) = delete;
+       CResult_PayeeDecodeErrorZ(CResult_PayeeDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PayeeDecodeErrorZ)); }
+       CResult_PayeeDecodeErrorZ(LDKCResult_PayeeDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PayeeDecodeErrorZ)); }
+       operator LDKCResult_PayeeDecodeErrorZ() && { LDKCResult_PayeeDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PayeeDecodeErrorZ)); return res; }
+       ~CResult_PayeeDecodeErrorZ() { CResult_PayeeDecodeErrorZ_free(self); }
+       CResult_PayeeDecodeErrorZ& operator=(CResult_PayeeDecodeErrorZ&& o) { CResult_PayeeDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PayeeDecodeErrorZ)); return *this; }
+       LDKCResult_PayeeDecodeErrorZ* operator &() { return &self; }
+       LDKCResult_PayeeDecodeErrorZ* operator ->() { return &self; }
+       const LDKCResult_PayeeDecodeErrorZ* operator &() const { return &self; }
+       const LDKCResult_PayeeDecodeErrorZ* operator ->() const { return &self; }
+};
 class CResult__u832APIErrorZ {
 private:
        LDKCResult__u832APIErrorZ self;
@@ -5096,6 +5373,21 @@ public:
        const LDKCResult__u832APIErrorZ* operator &() const { return &self; }
        const LDKCResult__u832APIErrorZ* operator ->() const { return &self; }
 };
+class CResult_PaymentIdPaymentErrorZ {
+private:
+       LDKCResult_PaymentIdPaymentErrorZ self;
+public:
+       CResult_PaymentIdPaymentErrorZ(const CResult_PaymentIdPaymentErrorZ&) = delete;
+       CResult_PaymentIdPaymentErrorZ(CResult_PaymentIdPaymentErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PaymentIdPaymentErrorZ)); }
+       CResult_PaymentIdPaymentErrorZ(LDKCResult_PaymentIdPaymentErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PaymentIdPaymentErrorZ)); }
+       operator LDKCResult_PaymentIdPaymentErrorZ() && { LDKCResult_PaymentIdPaymentErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PaymentIdPaymentErrorZ)); return res; }
+       ~CResult_PaymentIdPaymentErrorZ() { CResult_PaymentIdPaymentErrorZ_free(self); }
+       CResult_PaymentIdPaymentErrorZ& operator=(CResult_PaymentIdPaymentErrorZ&& o) { CResult_PaymentIdPaymentErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PaymentIdPaymentErrorZ)); return *this; }
+       LDKCResult_PaymentIdPaymentErrorZ* operator &() { return &self; }
+       LDKCResult_PaymentIdPaymentErrorZ* operator ->() { return &self; }
+       const LDKCResult_PaymentIdPaymentErrorZ* operator &() const { return &self; }
+       const LDKCResult_PaymentIdPaymentErrorZ* operator ->() const { return &self; }
+};
 class CResult_DescriptionCreationErrorZ {
 private:
        LDKCResult_DescriptionCreationErrorZ self;
@@ -5126,21 +5418,6 @@ public:
        const LDKCVec_C2Tuple_PublicKeyTypeZZ* operator &() const { return &self; }
        const LDKCVec_C2Tuple_PublicKeyTypeZZ* operator ->() const { return &self; }
 };
-class CResult_RoutingFeesDecodeErrorZ {
-private:
-       LDKCResult_RoutingFeesDecodeErrorZ self;
-public:
-       CResult_RoutingFeesDecodeErrorZ(const CResult_RoutingFeesDecodeErrorZ&) = delete;
-       CResult_RoutingFeesDecodeErrorZ(CResult_RoutingFeesDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_RoutingFeesDecodeErrorZ)); }
-       CResult_RoutingFeesDecodeErrorZ(LDKCResult_RoutingFeesDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_RoutingFeesDecodeErrorZ)); }
-       operator LDKCResult_RoutingFeesDecodeErrorZ() && { LDKCResult_RoutingFeesDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_RoutingFeesDecodeErrorZ)); return res; }
-       ~CResult_RoutingFeesDecodeErrorZ() { CResult_RoutingFeesDecodeErrorZ_free(self); }
-       CResult_RoutingFeesDecodeErrorZ& operator=(CResult_RoutingFeesDecodeErrorZ&& o) { CResult_RoutingFeesDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_RoutingFeesDecodeErrorZ)); return *this; }
-       LDKCResult_RoutingFeesDecodeErrorZ* operator &() { return &self; }
-       LDKCResult_RoutingFeesDecodeErrorZ* operator ->() { return &self; }
-       const LDKCResult_RoutingFeesDecodeErrorZ* operator &() const { return &self; }
-       const LDKCResult_RoutingFeesDecodeErrorZ* operator ->() const { return &self; }
-};
 class CResult_PayeePubKeyErrorZ {
 private:
        LDKCResult_PayeePubKeyErrorZ self;
@@ -5156,6 +5433,21 @@ public:
        const LDKCResult_PayeePubKeyErrorZ* operator &() const { return &self; }
        const LDKCResult_PayeePubKeyErrorZ* operator ->() const { return &self; }
 };
+class CResult_RoutingFeesDecodeErrorZ {
+private:
+       LDKCResult_RoutingFeesDecodeErrorZ self;
+public:
+       CResult_RoutingFeesDecodeErrorZ(const CResult_RoutingFeesDecodeErrorZ&) = delete;
+       CResult_RoutingFeesDecodeErrorZ(CResult_RoutingFeesDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_RoutingFeesDecodeErrorZ)); }
+       CResult_RoutingFeesDecodeErrorZ(LDKCResult_RoutingFeesDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_RoutingFeesDecodeErrorZ)); }
+       operator LDKCResult_RoutingFeesDecodeErrorZ() && { LDKCResult_RoutingFeesDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_RoutingFeesDecodeErrorZ)); return res; }
+       ~CResult_RoutingFeesDecodeErrorZ() { CResult_RoutingFeesDecodeErrorZ_free(self); }
+       CResult_RoutingFeesDecodeErrorZ& operator=(CResult_RoutingFeesDecodeErrorZ&& o) { CResult_RoutingFeesDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_RoutingFeesDecodeErrorZ)); return *this; }
+       LDKCResult_RoutingFeesDecodeErrorZ* operator &() { return &self; }
+       LDKCResult_RoutingFeesDecodeErrorZ* operator ->() { return &self; }
+       const LDKCResult_RoutingFeesDecodeErrorZ* operator &() const { return &self; }
+       const LDKCResult_RoutingFeesDecodeErrorZ* operator ->() const { return &self; }
+};
 class CResult_QueryShortChannelIdsDecodeErrorZ {
 private:
        LDKCResult_QueryShortChannelIdsDecodeErrorZ self;
@@ -5561,6 +5853,21 @@ public:
        const LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* operator &() const { return &self; }
        const LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* operator ->() const { return &self; }
 };
+class CResult_RouteParametersDecodeErrorZ {
+private:
+       LDKCResult_RouteParametersDecodeErrorZ self;
+public:
+       CResult_RouteParametersDecodeErrorZ(const CResult_RouteParametersDecodeErrorZ&) = delete;
+       CResult_RouteParametersDecodeErrorZ(CResult_RouteParametersDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_RouteParametersDecodeErrorZ)); }
+       CResult_RouteParametersDecodeErrorZ(LDKCResult_RouteParametersDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_RouteParametersDecodeErrorZ)); }
+       operator LDKCResult_RouteParametersDecodeErrorZ() && { LDKCResult_RouteParametersDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_RouteParametersDecodeErrorZ)); return res; }
+       ~CResult_RouteParametersDecodeErrorZ() { CResult_RouteParametersDecodeErrorZ_free(self); }
+       CResult_RouteParametersDecodeErrorZ& operator=(CResult_RouteParametersDecodeErrorZ&& o) { CResult_RouteParametersDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_RouteParametersDecodeErrorZ)); return *this; }
+       LDKCResult_RouteParametersDecodeErrorZ* operator &() { return &self; }
+       LDKCResult_RouteParametersDecodeErrorZ* operator ->() { return &self; }
+       const LDKCResult_RouteParametersDecodeErrorZ* operator &() const { return &self; }
+       const LDKCResult_RouteParametersDecodeErrorZ* operator ->() const { return &self; }
+};
 class CResult_NoneNoneZ {
 private:
        LDKCResult_NoneNoneZ self;
@@ -5591,21 +5898,6 @@ public:
        const LDKCResult_PrivateRouteCreationErrorZ* operator &() const { return &self; }
        const LDKCResult_PrivateRouteCreationErrorZ* operator ->() const { return &self; }
 };
-class CResult_boolPeerHandleErrorZ {
-private:
-       LDKCResult_boolPeerHandleErrorZ self;
-public:
-       CResult_boolPeerHandleErrorZ(const CResult_boolPeerHandleErrorZ&) = delete;
-       CResult_boolPeerHandleErrorZ(CResult_boolPeerHandleErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_boolPeerHandleErrorZ)); }
-       CResult_boolPeerHandleErrorZ(LDKCResult_boolPeerHandleErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_boolPeerHandleErrorZ)); }
-       operator LDKCResult_boolPeerHandleErrorZ() && { LDKCResult_boolPeerHandleErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_boolPeerHandleErrorZ)); return res; }
-       ~CResult_boolPeerHandleErrorZ() { CResult_boolPeerHandleErrorZ_free(self); }
-       CResult_boolPeerHandleErrorZ& operator=(CResult_boolPeerHandleErrorZ&& o) { CResult_boolPeerHandleErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_boolPeerHandleErrorZ)); return *this; }
-       LDKCResult_boolPeerHandleErrorZ* operator &() { return &self; }
-       LDKCResult_boolPeerHandleErrorZ* operator ->() { return &self; }
-       const LDKCResult_boolPeerHandleErrorZ* operator &() const { return &self; }
-       const LDKCResult_boolPeerHandleErrorZ* operator ->() const { return &self; }
-};
 class CVec_APIErrorZ {
 private:
        LDKCVec_APIErrorZ self;
@@ -5621,6 +5913,21 @@ public:
        const LDKCVec_APIErrorZ* operator &() const { return &self; }
        const LDKCVec_APIErrorZ* operator ->() const { return &self; }
 };
+class CResult_boolPeerHandleErrorZ {
+private:
+       LDKCResult_boolPeerHandleErrorZ self;
+public:
+       CResult_boolPeerHandleErrorZ(const CResult_boolPeerHandleErrorZ&) = delete;
+       CResult_boolPeerHandleErrorZ(CResult_boolPeerHandleErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_boolPeerHandleErrorZ)); }
+       CResult_boolPeerHandleErrorZ(LDKCResult_boolPeerHandleErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_boolPeerHandleErrorZ)); }
+       operator LDKCResult_boolPeerHandleErrorZ() && { LDKCResult_boolPeerHandleErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_boolPeerHandleErrorZ)); return res; }
+       ~CResult_boolPeerHandleErrorZ() { CResult_boolPeerHandleErrorZ_free(self); }
+       CResult_boolPeerHandleErrorZ& operator=(CResult_boolPeerHandleErrorZ&& o) { CResult_boolPeerHandleErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_boolPeerHandleErrorZ)); return *this; }
+       LDKCResult_boolPeerHandleErrorZ* operator &() { return &self; }
+       LDKCResult_boolPeerHandleErrorZ* operator ->() { return &self; }
+       const LDKCResult_boolPeerHandleErrorZ* operator &() const { return &self; }
+       const LDKCResult_boolPeerHandleErrorZ* operator ->() const { return &self; }
+};
 class CResult_ChannelUpdateDecodeErrorZ {
 private:
        LDKCResult_ChannelUpdateDecodeErrorZ self;
@@ -5741,21 +6048,6 @@ public:
        const LDKC2Tuple_u32ScriptZ* operator &() const { return &self; }
        const LDKC2Tuple_u32ScriptZ* operator ->() const { return &self; }
 };
-class CResult_CResult_NetAddressu8ZDecodeErrorZ {
-private:
-       LDKCResult_CResult_NetAddressu8ZDecodeErrorZ self;
-public:
-       CResult_CResult_NetAddressu8ZDecodeErrorZ(const CResult_CResult_NetAddressu8ZDecodeErrorZ&) = delete;
-       CResult_CResult_NetAddressu8ZDecodeErrorZ(CResult_CResult_NetAddressu8ZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_CResult_NetAddressu8ZDecodeErrorZ)); }
-       CResult_CResult_NetAddressu8ZDecodeErrorZ(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ)); }
-       operator LDKCResult_CResult_NetAddressu8ZDecodeErrorZ() && { LDKCResult_CResult_NetAddressu8ZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ)); return res; }
-       ~CResult_CResult_NetAddressu8ZDecodeErrorZ() { CResult_CResult_NetAddressu8ZDecodeErrorZ_free(self); }
-       CResult_CResult_NetAddressu8ZDecodeErrorZ& operator=(CResult_CResult_NetAddressu8ZDecodeErrorZ&& o) { CResult_CResult_NetAddressu8ZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_CResult_NetAddressu8ZDecodeErrorZ)); return *this; }
-       LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* operator &() { return &self; }
-       LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* operator ->() { return &self; }
-       const LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* operator &() const { return &self; }
-       const LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* operator ->() const { return &self; }
-};
 class CResult_ReplyShortChannelIdsEndDecodeErrorZ {
 private:
        LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ self;
@@ -5925,10 +6217,13 @@ inline void EventsProvider::process_pending_events(struct LDKEventHandler handle
 inline void EventHandler::handle_event(const struct LDKEvent *NONNULL_PTR event) {
        (self.handle_event)(self.this_arg, event);
 }
-inline uint64_t Score::channel_penalty_msat(uint64_t short_channel_id) {
-       uint64_t ret = (self.channel_penalty_msat)(self.this_arg, short_channel_id);
+inline uint64_t Score::channel_penalty_msat(uint64_t short_channel_id, const struct LDKNodeId *NONNULL_PTR source, const struct LDKNodeId *NONNULL_PTR target) {
+       uint64_t ret = (self.channel_penalty_msat)(self.this_arg, short_channel_id, source, target);
        return ret;
 }
+inline void Score::payment_path_failed(struct LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
+       (self.payment_path_failed)(self.this_arg, path, short_channel_id);
+}
 inline LDKPublicKey BaseSign::get_per_commitment_point(uint64_t idx) {
        LDKPublicKey ret = (self.get_per_commitment_point)(self.this_arg, idx);
        return ret;
@@ -6020,6 +6315,26 @@ inline LDK::Str Type::debug_str() {
        LDK::Str ret = (self.debug_str)(self.this_arg);
        return ret;
 }
+inline LDKPublicKey Payer::node_id() {
+       LDKPublicKey ret = (self.node_id)(self.this_arg);
+       return ret;
+}
+inline LDK::CVec_ChannelDetailsZ Payer::first_hops() {
+       LDK::CVec_ChannelDetailsZ ret = (self.first_hops)(self.this_arg);
+       return ret;
+}
+inline LDK::CResult_PaymentIdPaymentSendFailureZ Payer::send_payment(const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret) {
+       LDK::CResult_PaymentIdPaymentSendFailureZ ret = (self.send_payment)(self.this_arg, route, payment_hash, payment_secret);
+       return ret;
+}
+inline LDK::CResult_NonePaymentSendFailureZ Payer::retry_payment(const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_id) {
+       LDK::CResult_NonePaymentSendFailureZ ret = (self.retry_payment)(self.this_arg, route, payment_id);
+       return ret;
+}
+inline LDK::CResult_RouteLightningErrorZ Router::find_route(struct LDKPublicKey payer, const struct LDKRouteParameters *NONNULL_PTR params, struct LDKCVec_ChannelDetailsZ *first_hops, const struct LDKScore *NONNULL_PTR scorer) {
+       LDK::CResult_RouteLightningErrorZ ret = (self.find_route)(self.this_arg, payer, params, first_hops, scorer);
+       return ret;
+}
 inline LDK::CResult_NoneLightningErrorZ CustomMessageHandler::handle_custom_message(struct LDKType msg, struct LDKPublicKey sender_node_id) {
        LDK::CResult_NoneLightningErrorZ ret = (self.handle_custom_message)(self.this_arg, msg, sender_node_id);
        return ret;
@@ -6145,12 +6460,12 @@ inline LDK::CResult_NoneLightningErrorZ RoutingMessageHandler::handle_query_shor
 inline void Logger::log(const char *record) {
        (self.log)(self.this_arg, record);
 }
-inline LDK::CResult_NoneChannelMonitorUpdateErrZ Persist::persist_new_channel(struct LDKOutPoint id, const struct LDKChannelMonitor *NONNULL_PTR data) {
-       LDK::CResult_NoneChannelMonitorUpdateErrZ ret = (self.persist_new_channel)(self.this_arg, id, data);
+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);
        return ret;
 }
-inline LDK::CResult_NoneChannelMonitorUpdateErrZ Persist::update_persisted_channel(struct LDKOutPoint id, const struct LDKChannelMonitorUpdate *NONNULL_PTR update, const struct LDKChannelMonitor *NONNULL_PTR data) {
-       LDK::CResult_NoneChannelMonitorUpdateErrZ ret = (self.update_persisted_channel)(self.this_arg, id, update, data);
+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);
        return ret;
 }
 }
index 61b8bff5e3e2977747d1c89a16394a75c492ecc2..69438880f4fb4eb8362475803927fc9c94b12a3b 100644 (file)
@@ -1819,6 +1819,143 @@ impl Clone for CResult_RouteDecodeErrorZ {
 /// but with all dynamically-allocated buffers duplicated in new buffers.
 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { Clone::clone(&orig) }
 #[repr(C)]
+/// The contents of CResult_RouteParametersDecodeErrorZ
+pub union CResult_RouteParametersDecodeErrorZPtr {
+       /// A pointer to the contents in the success state.
+       /// Reading from this pointer when `result_ok` is not set is undefined.
+       pub result: *mut crate::lightning::routing::router::RouteParameters,
+       /// 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_RouteParametersDecodeErrorZ represents the result of a fallible operation,
+/// containing a crate::lightning::routing::router::RouteParameters 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_RouteParametersDecodeErrorZ {
+       /// The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
+       /// `err` or `result` depending on the state of `result_ok`.
+       pub contents: CResult_RouteParametersDecodeErrorZPtr,
+       /// Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
+       pub result_ok: bool,
+}
+#[no_mangle]
+/// Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
+pub extern "C" fn CResult_RouteParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteParameters) -> CResult_RouteParametersDecodeErrorZ {
+       CResult_RouteParametersDecodeErrorZ {
+               contents: CResult_RouteParametersDecodeErrorZPtr {
+                       result: Box::into_raw(Box::new(o)),
+               },
+               result_ok: true,
+       }
+}
+#[no_mangle]
+/// Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
+pub extern "C" fn CResult_RouteParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteParametersDecodeErrorZ {
+       CResult_RouteParametersDecodeErrorZ {
+               contents: CResult_RouteParametersDecodeErrorZPtr {
+                       err: Box::into_raw(Box::new(e)),
+               },
+               result_ok: false,
+       }
+}
+#[no_mangle]
+/// Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
+pub extern "C" fn CResult_RouteParametersDecodeErrorZ_free(_res: CResult_RouteParametersDecodeErrorZ) { }
+impl Drop for CResult_RouteParametersDecodeErrorZ {
+       fn drop(&mut self) {
+               if self.result_ok {
+                       if unsafe { !(self.contents.result as *mut ()).is_null() } {
+                               let _ = unsafe { Box::from_raw(self.contents.result) };
+                       }
+               } else {
+                       if unsafe { !(self.contents.err as *mut ()).is_null() } {
+                               let _ = unsafe { Box::from_raw(self.contents.err) };
+                       }
+               }
+       }
+}
+impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteParametersDecodeErrorZ {
+       fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
+               let contents = if o.result_ok {
+                       let result = unsafe { o.contents.result };
+                       unsafe { o.contents.result = std::ptr::null_mut() };
+                       CResult_RouteParametersDecodeErrorZPtr { result }
+               } else {
+                       let err = unsafe { o.contents.err };
+                       unsafe { o.contents.err = std::ptr::null_mut(); }
+                       CResult_RouteParametersDecodeErrorZPtr { err }
+               };
+               Self {
+                       contents,
+                       result_ok: o.result_ok,
+               }
+       }
+}
+impl Clone for CResult_RouteParametersDecodeErrorZ {
+       fn clone(&self) -> Self {
+               if self.result_ok {
+                       Self { result_ok: true, contents: CResult_RouteParametersDecodeErrorZPtr {
+                               result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteParameters>::clone(unsafe { &*self.contents.result })))
+                       } }
+               } else {
+                       Self { result_ok: false, contents: CResult_RouteParametersDecodeErrorZPtr {
+                               err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
+                       } }
+               }
+       }
+}
+#[no_mangle]
+/// Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
+/// but with all dynamically-allocated buffers duplicated in new buffers.
+pub extern "C" fn CResult_RouteParametersDecodeErrorZ_clone(orig: &CResult_RouteParametersDecodeErrorZ) -> CResult_RouteParametersDecodeErrorZ { Clone::clone(&orig) }
+#[repr(C)]
+/// A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
+/// This corresponds to std::vector in C++
+pub struct CVec_RouteHintZ {
+       /// The elements in the array.
+       /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+       pub data: *mut crate::lightning::routing::router::RouteHint,
+       /// The number of elements pointed to by `data`.
+       pub datalen: usize
+}
+impl CVec_RouteHintZ {
+       #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHint> {
+               if self.datalen == 0 { return Vec::new(); }
+               let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
+               self.data = std::ptr::null_mut();
+               self.datalen = 0;
+               ret
+       }
+       #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHint] {
+               unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
+       }
+}
+impl From<Vec<crate::lightning::routing::router::RouteHint>> for CVec_RouteHintZ {
+       fn from(v: Vec<crate::lightning::routing::router::RouteHint>) -> Self {
+               let datalen = v.len();
+               let data = Box::into_raw(v.into_boxed_slice());
+               Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
+       }
+}
+#[no_mangle]
+/// Frees the buffer pointed to by `data` if `datalen` is non-0.
+pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
+impl Drop for CVec_RouteHintZ {
+       fn drop(&mut self) {
+               if self.datalen == 0 { return; }
+               unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
+       }
+}
+impl Clone for CVec_RouteHintZ {
+       fn clone(&self) -> Self {
+               let mut res = Vec::new();
+               if self.datalen == 0 { return Self::from(res); }
+               res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
+               Self::from(res)
+       }
+}
+#[repr(C)]
 #[derive(Clone)]
 /// An enum which can either contain a u64 or not
 pub enum COption_u64Z {
@@ -1856,29 +1993,120 @@ pub extern "C" fn COption_u64Z_free(_res: COption_u64Z) { }
 /// but with all dynamically-allocated buffers duplicated in new buffers.
 pub extern "C" fn COption_u64Z_clone(orig: &COption_u64Z) -> COption_u64Z { Clone::clone(&orig) }
 #[repr(C)]
-/// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
+/// The contents of CResult_PayeeDecodeErrorZ
+pub union CResult_PayeeDecodeErrorZPtr {
+       /// A pointer to the contents in the success state.
+       /// Reading from this pointer when `result_ok` is not set is undefined.
+       pub result: *mut crate::lightning::routing::router::Payee,
+       /// 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_PayeeDecodeErrorZ represents the result of a fallible operation,
+/// containing a crate::lightning::routing::router::Payee 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_PayeeDecodeErrorZ {
+       /// The contents of this CResult_PayeeDecodeErrorZ, accessible via either
+       /// `err` or `result` depending on the state of `result_ok`.
+       pub contents: CResult_PayeeDecodeErrorZPtr,
+       /// Whether this CResult_PayeeDecodeErrorZ represents a success state.
+       pub result_ok: bool,
+}
+#[no_mangle]
+/// Creates a new CResult_PayeeDecodeErrorZ in the success state.
+pub extern "C" fn CResult_PayeeDecodeErrorZ_ok(o: crate::lightning::routing::router::Payee) -> CResult_PayeeDecodeErrorZ {
+       CResult_PayeeDecodeErrorZ {
+               contents: CResult_PayeeDecodeErrorZPtr {
+                       result: Box::into_raw(Box::new(o)),
+               },
+               result_ok: true,
+       }
+}
+#[no_mangle]
+/// Creates a new CResult_PayeeDecodeErrorZ in the error state.
+pub extern "C" fn CResult_PayeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PayeeDecodeErrorZ {
+       CResult_PayeeDecodeErrorZ {
+               contents: CResult_PayeeDecodeErrorZPtr {
+                       err: Box::into_raw(Box::new(e)),
+               },
+               result_ok: false,
+       }
+}
+#[no_mangle]
+/// Frees any resources used by the CResult_PayeeDecodeErrorZ.
+pub extern "C" fn CResult_PayeeDecodeErrorZ_free(_res: CResult_PayeeDecodeErrorZ) { }
+impl Drop for CResult_PayeeDecodeErrorZ {
+       fn drop(&mut self) {
+               if self.result_ok {
+                       if unsafe { !(self.contents.result as *mut ()).is_null() } {
+                               let _ = unsafe { Box::from_raw(self.contents.result) };
+                       }
+               } else {
+                       if unsafe { !(self.contents.err as *mut ()).is_null() } {
+                               let _ = unsafe { Box::from_raw(self.contents.err) };
+                       }
+               }
+       }
+}
+impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Payee, crate::lightning::ln::msgs::DecodeError>> for CResult_PayeeDecodeErrorZ {
+       fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Payee, crate::lightning::ln::msgs::DecodeError>) -> Self {
+               let contents = if o.result_ok {
+                       let result = unsafe { o.contents.result };
+                       unsafe { o.contents.result = std::ptr::null_mut() };
+                       CResult_PayeeDecodeErrorZPtr { result }
+               } else {
+                       let err = unsafe { o.contents.err };
+                       unsafe { o.contents.err = std::ptr::null_mut(); }
+                       CResult_PayeeDecodeErrorZPtr { err }
+               };
+               Self {
+                       contents,
+                       result_ok: o.result_ok,
+               }
+       }
+}
+impl Clone for CResult_PayeeDecodeErrorZ {
+       fn clone(&self) -> Self {
+               if self.result_ok {
+                       Self { result_ok: true, contents: CResult_PayeeDecodeErrorZPtr {
+                               result: Box::into_raw(Box::new(<crate::lightning::routing::router::Payee>::clone(unsafe { &*self.contents.result })))
+                       } }
+               } else {
+                       Self { result_ok: false, contents: CResult_PayeeDecodeErrorZPtr {
+                               err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
+                       } }
+               }
+       }
+}
+#[no_mangle]
+/// Creates a new CResult_PayeeDecodeErrorZ which has the same data as `orig`
+/// but with all dynamically-allocated buffers duplicated in new buffers.
+pub extern "C" fn CResult_PayeeDecodeErrorZ_clone(orig: &CResult_PayeeDecodeErrorZ) -> CResult_PayeeDecodeErrorZ { Clone::clone(&orig) }
+#[repr(C)]
+/// A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
 /// This corresponds to std::vector in C++
-pub struct CVec_ChannelDetailsZ {
+pub struct CVec_RouteHintHopZ {
        /// The elements in the array.
        /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
-       pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
+       pub data: *mut crate::lightning::routing::router::RouteHintHop,
        /// The number of elements pointed to by `data`.
        pub datalen: usize
 }
-impl CVec_ChannelDetailsZ {
-       #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
+impl CVec_RouteHintHopZ {
+       #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHintHop> {
                if self.datalen == 0 { return Vec::new(); }
                let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
                self.data = std::ptr::null_mut();
                self.datalen = 0;
                ret
        }
-       #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
+       #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHintHop] {
                unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
        }
 }
-impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
-       fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
+impl From<Vec<crate::lightning::routing::router::RouteHintHop>> for CVec_RouteHintHopZ {
+       fn from(v: Vec<crate::lightning::routing::router::RouteHintHop>) -> Self {
                let datalen = v.len();
                let data = Box::into_raw(v.into_boxed_slice());
                Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
@@ -1886,14 +2114,14 @@ impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_Ch
 }
 #[no_mangle]
 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
-pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
-impl Drop for CVec_ChannelDetailsZ {
+pub extern "C" fn CVec_RouteHintHopZ_free(_res: CVec_RouteHintHopZ) { }
+impl Drop for CVec_RouteHintHopZ {
        fn drop(&mut self) {
                if self.datalen == 0 { return; }
                unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
        }
 }
-impl Clone for CVec_ChannelDetailsZ {
+impl Clone for CVec_RouteHintHopZ {
        fn clone(&self) -> Self {
                let mut res = Vec::new();
                if self.datalen == 0 { return Self::from(res); }
@@ -1902,29 +2130,211 @@ impl Clone for CVec_ChannelDetailsZ {
        }
 }
 #[repr(C)]
-/// A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
+/// The contents of CResult_RouteHintDecodeErrorZ
+pub union CResult_RouteHintDecodeErrorZPtr {
+       /// A pointer to the contents in the success state.
+       /// Reading from this pointer when `result_ok` is not set is undefined.
+       pub result: *mut crate::lightning::routing::router::RouteHint,
+       /// 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_RouteHintDecodeErrorZ represents the result of a fallible operation,
+/// containing a crate::lightning::routing::router::RouteHint 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_RouteHintDecodeErrorZ {
+       /// The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
+       /// `err` or `result` depending on the state of `result_ok`.
+       pub contents: CResult_RouteHintDecodeErrorZPtr,
+       /// Whether this CResult_RouteHintDecodeErrorZ represents a success state.
+       pub result_ok: bool,
+}
+#[no_mangle]
+/// Creates a new CResult_RouteHintDecodeErrorZ in the success state.
+pub extern "C" fn CResult_RouteHintDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHint) -> CResult_RouteHintDecodeErrorZ {
+       CResult_RouteHintDecodeErrorZ {
+               contents: CResult_RouteHintDecodeErrorZPtr {
+                       result: Box::into_raw(Box::new(o)),
+               },
+               result_ok: true,
+       }
+}
+#[no_mangle]
+/// Creates a new CResult_RouteHintDecodeErrorZ in the error state.
+pub extern "C" fn CResult_RouteHintDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintDecodeErrorZ {
+       CResult_RouteHintDecodeErrorZ {
+               contents: CResult_RouteHintDecodeErrorZPtr {
+                       err: Box::into_raw(Box::new(e)),
+               },
+               result_ok: false,
+       }
+}
+#[no_mangle]
+/// Frees any resources used by the CResult_RouteHintDecodeErrorZ.
+pub extern "C" fn CResult_RouteHintDecodeErrorZ_free(_res: CResult_RouteHintDecodeErrorZ) { }
+impl Drop for CResult_RouteHintDecodeErrorZ {
+       fn drop(&mut self) {
+               if self.result_ok {
+                       if unsafe { !(self.contents.result as *mut ()).is_null() } {
+                               let _ = unsafe { Box::from_raw(self.contents.result) };
+                       }
+               } else {
+                       if unsafe { !(self.contents.err as *mut ()).is_null() } {
+                               let _ = unsafe { Box::from_raw(self.contents.err) };
+                       }
+               }
+       }
+}
+impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintDecodeErrorZ {
+       fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>) -> Self {
+               let contents = if o.result_ok {
+                       let result = unsafe { o.contents.result };
+                       unsafe { o.contents.result = std::ptr::null_mut() };
+                       CResult_RouteHintDecodeErrorZPtr { result }
+               } else {
+                       let err = unsafe { o.contents.err };
+                       unsafe { o.contents.err = std::ptr::null_mut(); }
+                       CResult_RouteHintDecodeErrorZPtr { err }
+               };
+               Self {
+                       contents,
+                       result_ok: o.result_ok,
+               }
+       }
+}
+impl Clone for CResult_RouteHintDecodeErrorZ {
+       fn clone(&self) -> Self {
+               if self.result_ok {
+                       Self { result_ok: true, contents: CResult_RouteHintDecodeErrorZPtr {
+                               result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHint>::clone(unsafe { &*self.contents.result })))
+                       } }
+               } else {
+                       Self { result_ok: false, contents: CResult_RouteHintDecodeErrorZPtr {
+                               err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
+                       } }
+               }
+       }
+}
+#[no_mangle]
+/// Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
+/// but with all dynamically-allocated buffers duplicated in new buffers.
+pub extern "C" fn CResult_RouteHintDecodeErrorZ_clone(orig: &CResult_RouteHintDecodeErrorZ) -> CResult_RouteHintDecodeErrorZ { Clone::clone(&orig) }
+#[repr(C)]
+/// The contents of CResult_RouteHintHopDecodeErrorZ
+pub union CResult_RouteHintHopDecodeErrorZPtr {
+       /// A pointer to the contents in the success state.
+       /// Reading from this pointer when `result_ok` is not set is undefined.
+       pub result: *mut crate::lightning::routing::router::RouteHintHop,
+       /// 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_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
+/// containing a crate::lightning::routing::router::RouteHintHop 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_RouteHintHopDecodeErrorZ {
+       /// The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
+       /// `err` or `result` depending on the state of `result_ok`.
+       pub contents: CResult_RouteHintHopDecodeErrorZPtr,
+       /// Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
+       pub result_ok: bool,
+}
+#[no_mangle]
+/// Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
+pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHintHop) -> CResult_RouteHintHopDecodeErrorZ {
+       CResult_RouteHintHopDecodeErrorZ {
+               contents: CResult_RouteHintHopDecodeErrorZPtr {
+                       result: Box::into_raw(Box::new(o)),
+               },
+               result_ok: true,
+       }
+}
+#[no_mangle]
+/// Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
+pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintHopDecodeErrorZ {
+       CResult_RouteHintHopDecodeErrorZ {
+               contents: CResult_RouteHintHopDecodeErrorZPtr {
+                       err: Box::into_raw(Box::new(e)),
+               },
+               result_ok: false,
+       }
+}
+#[no_mangle]
+/// Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
+pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_free(_res: CResult_RouteHintHopDecodeErrorZ) { }
+impl Drop for CResult_RouteHintHopDecodeErrorZ {
+       fn drop(&mut self) {
+               if self.result_ok {
+                       if unsafe { !(self.contents.result as *mut ()).is_null() } {
+                               let _ = unsafe { Box::from_raw(self.contents.result) };
+                       }
+               } else {
+                       if unsafe { !(self.contents.err as *mut ()).is_null() } {
+                               let _ = unsafe { Box::from_raw(self.contents.err) };
+                       }
+               }
+       }
+}
+impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintHopDecodeErrorZ {
+       fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
+               let contents = if o.result_ok {
+                       let result = unsafe { o.contents.result };
+                       unsafe { o.contents.result = std::ptr::null_mut() };
+                       CResult_RouteHintHopDecodeErrorZPtr { result }
+               } else {
+                       let err = unsafe { o.contents.err };
+                       unsafe { o.contents.err = std::ptr::null_mut(); }
+                       CResult_RouteHintHopDecodeErrorZPtr { err }
+               };
+               Self {
+                       contents,
+                       result_ok: o.result_ok,
+               }
+       }
+}
+impl Clone for CResult_RouteHintHopDecodeErrorZ {
+       fn clone(&self) -> Self {
+               if self.result_ok {
+                       Self { result_ok: true, contents: CResult_RouteHintHopDecodeErrorZPtr {
+                               result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHintHop>::clone(unsafe { &*self.contents.result })))
+                       } }
+               } else {
+                       Self { result_ok: false, contents: CResult_RouteHintHopDecodeErrorZPtr {
+                               err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
+                       } }
+               }
+       }
+}
+#[no_mangle]
+/// Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
+/// but with all dynamically-allocated buffers duplicated in new buffers.
+pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_clone(orig: &CResult_RouteHintHopDecodeErrorZ) -> CResult_RouteHintHopDecodeErrorZ { Clone::clone(&orig) }
+#[repr(C)]
+/// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
 /// This corresponds to std::vector in C++
-pub struct CVec_RouteHintZ {
+pub struct CVec_ChannelDetailsZ {
        /// The elements in the array.
        /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
-       pub data: *mut crate::lightning::routing::router::RouteHint,
+       pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
        /// The number of elements pointed to by `data`.
        pub datalen: usize
 }
-impl CVec_RouteHintZ {
-       #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHint> {
+impl CVec_ChannelDetailsZ {
+       #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
                if self.datalen == 0 { return Vec::new(); }
                let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
                self.data = std::ptr::null_mut();
                self.datalen = 0;
                ret
        }
-       #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHint] {
+       #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
                unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
        }
 }
-impl From<Vec<crate::lightning::routing::router::RouteHint>> for CVec_RouteHintZ {
-       fn from(v: Vec<crate::lightning::routing::router::RouteHint>) -> Self {
+impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
+       fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
                let datalen = v.len();
                let data = Box::into_raw(v.into_boxed_slice());
                Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
@@ -1932,14 +2342,14 @@ impl From<Vec<crate::lightning::routing::router::RouteHint>> for CVec_RouteHintZ
 }
 #[no_mangle]
 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
-pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
-impl Drop for CVec_RouteHintZ {
+pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
+impl Drop for CVec_ChannelDetailsZ {
        fn drop(&mut self) {
                if self.datalen == 0 { return; }
                unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
        }
 }
-impl Clone for CVec_RouteHintZ {
+impl Clone for CVec_ChannelDetailsZ {
        fn clone(&self) -> Self {
                let mut res = Vec::new();
                if self.datalen == 0 { return Self::from(res); }
@@ -2826,9 +3236,157 @@ pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::l
        }
 }
 #[no_mangle]
-/// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
-pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
-impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
+/// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
+pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
+impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
+       fn drop(&mut self) {
+               if self.result_ok {
+                       if unsafe { !(self.contents.result as *mut ()).is_null() } {
+                               let _ = unsafe { Box::from_raw(self.contents.result) };
+                       }
+               } else {
+                       if unsafe { !(self.contents.err as *mut ()).is_null() } {
+                               let _ = unsafe { Box::from_raw(self.contents.err) };
+                       }
+               }
+       }
+}
+impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
+       fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
+               let contents = if o.result_ok {
+                       let result = unsafe { o.contents.result };
+                       unsafe { o.contents.result = std::ptr::null_mut() };
+                       CResult_InvoiceFeaturesDecodeErrorZPtr { result }
+               } else {
+                       let err = unsafe { o.contents.err };
+                       unsafe { o.contents.err = std::ptr::null_mut(); }
+                       CResult_InvoiceFeaturesDecodeErrorZPtr { err }
+               };
+               Self {
+                       contents,
+                       result_ok: o.result_ok,
+               }
+       }
+}
+#[repr(C)]
+/// The contents of CResult_ScoringParametersDecodeErrorZ
+pub union CResult_ScoringParametersDecodeErrorZPtr {
+       /// A pointer to the contents in the success state.
+       /// Reading from this pointer when `result_ok` is not set is undefined.
+       pub result: *mut crate::lightning::routing::scorer::ScoringParameters,
+       /// A pointer to the contents in the error state.
+       /// Reading from this pointer when `result_ok` is set is undefined.
+       pub err: *mut crate::lightning::ln::msgs::DecodeError,
+}
+#[repr(C)]
+/// A CResult_ScoringParametersDecodeErrorZ represents the result of a fallible operation,
+/// containing a crate::lightning::routing::scorer::ScoringParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
+/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
+pub struct CResult_ScoringParametersDecodeErrorZ {
+       /// The contents of this CResult_ScoringParametersDecodeErrorZ, accessible via either
+       /// `err` or `result` depending on the state of `result_ok`.
+       pub contents: CResult_ScoringParametersDecodeErrorZPtr,
+       /// Whether this CResult_ScoringParametersDecodeErrorZ represents a success state.
+       pub result_ok: bool,
+}
+#[no_mangle]
+/// Creates a new CResult_ScoringParametersDecodeErrorZ in the success state.
+pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_ok(o: crate::lightning::routing::scorer::ScoringParameters) -> CResult_ScoringParametersDecodeErrorZ {
+       CResult_ScoringParametersDecodeErrorZ {
+               contents: CResult_ScoringParametersDecodeErrorZPtr {
+                       result: Box::into_raw(Box::new(o)),
+               },
+               result_ok: true,
+       }
+}
+#[no_mangle]
+/// Creates a new CResult_ScoringParametersDecodeErrorZ in the error state.
+pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ScoringParametersDecodeErrorZ {
+       CResult_ScoringParametersDecodeErrorZ {
+               contents: CResult_ScoringParametersDecodeErrorZPtr {
+                       err: Box::into_raw(Box::new(e)),
+               },
+               result_ok: false,
+       }
+}
+#[no_mangle]
+/// Frees any resources used by the CResult_ScoringParametersDecodeErrorZ.
+pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_free(_res: CResult_ScoringParametersDecodeErrorZ) { }
+impl Drop for CResult_ScoringParametersDecodeErrorZ {
+       fn drop(&mut self) {
+               if self.result_ok {
+                       if unsafe { !(self.contents.result as *mut ()).is_null() } {
+                               let _ = unsafe { Box::from_raw(self.contents.result) };
+                       }
+               } else {
+                       if unsafe { !(self.contents.err as *mut ()).is_null() } {
+                               let _ = unsafe { Box::from_raw(self.contents.err) };
+                       }
+               }
+       }
+}
+impl From<crate::c_types::CResultTempl<crate::lightning::routing::scorer::ScoringParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ScoringParametersDecodeErrorZ {
+       fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scorer::ScoringParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
+               let contents = if o.result_ok {
+                       let result = unsafe { o.contents.result };
+                       unsafe { o.contents.result = std::ptr::null_mut() };
+                       CResult_ScoringParametersDecodeErrorZPtr { result }
+               } else {
+                       let err = unsafe { o.contents.err };
+                       unsafe { o.contents.err = std::ptr::null_mut(); }
+                       CResult_ScoringParametersDecodeErrorZPtr { err }
+               };
+               Self {
+                       contents,
+                       result_ok: o.result_ok,
+               }
+       }
+}
+#[repr(C)]
+/// The contents of CResult_ScorerDecodeErrorZ
+pub union CResult_ScorerDecodeErrorZPtr {
+       /// A pointer to the contents in the success state.
+       /// Reading from this pointer when `result_ok` is not set is undefined.
+       pub result: *mut crate::lightning::routing::scorer::Scorer,
+       /// A pointer to the contents in the error state.
+       /// Reading from this pointer when `result_ok` is set is undefined.
+       pub err: *mut crate::lightning::ln::msgs::DecodeError,
+}
+#[repr(C)]
+/// A CResult_ScorerDecodeErrorZ represents the result of a fallible operation,
+/// containing a crate::lightning::routing::scorer::Scorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
+/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
+pub struct CResult_ScorerDecodeErrorZ {
+       /// The contents of this CResult_ScorerDecodeErrorZ, accessible via either
+       /// `err` or `result` depending on the state of `result_ok`.
+       pub contents: CResult_ScorerDecodeErrorZPtr,
+       /// Whether this CResult_ScorerDecodeErrorZ represents a success state.
+       pub result_ok: bool,
+}
+#[no_mangle]
+/// Creates a new CResult_ScorerDecodeErrorZ in the success state.
+pub extern "C" fn CResult_ScorerDecodeErrorZ_ok(o: crate::lightning::routing::scorer::Scorer) -> CResult_ScorerDecodeErrorZ {
+       CResult_ScorerDecodeErrorZ {
+               contents: CResult_ScorerDecodeErrorZPtr {
+                       result: Box::into_raw(Box::new(o)),
+               },
+               result_ok: true,
+       }
+}
+#[no_mangle]
+/// Creates a new CResult_ScorerDecodeErrorZ in the error state.
+pub extern "C" fn CResult_ScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ScorerDecodeErrorZ {
+       CResult_ScorerDecodeErrorZ {
+               contents: CResult_ScorerDecodeErrorZPtr {
+                       err: Box::into_raw(Box::new(e)),
+               },
+               result_ok: false,
+       }
+}
+#[no_mangle]
+/// Frees any resources used by the CResult_ScorerDecodeErrorZ.
+pub extern "C" fn CResult_ScorerDecodeErrorZ_free(_res: CResult_ScorerDecodeErrorZ) { }
+impl Drop for CResult_ScorerDecodeErrorZ {
        fn drop(&mut self) {
                if self.result_ok {
                        if unsafe { !(self.contents.result as *mut ()).is_null() } {
@@ -2841,16 +3399,16 @@ impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
                }
        }
 }
-impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
-       fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::lightning::routing::scorer::Scorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ScorerDecodeErrorZ {
+       fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scorer::Scorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
                let contents = if o.result_ok {
                        let result = unsafe { o.contents.result };
                        unsafe { o.contents.result = std::ptr::null_mut() };
-                       CResult_InvoiceFeaturesDecodeErrorZPtr { result }
+                       CResult_ScorerDecodeErrorZPtr { result }
                } else {
                        let err = unsafe { o.contents.err };
                        unsafe { o.contents.err = std::ptr::null_mut(); }
-                       CResult_InvoiceFeaturesDecodeErrorZPtr { err }
+                       CResult_ScorerDecodeErrorZPtr { err }
                };
                Self {
                        contents,
@@ -4154,97 +4712,6 @@ impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_Blo
        }
 }
 #[repr(C)]
-/// The contents of CResult_PaymentIdDecodeErrorZ
-pub union CResult_PaymentIdDecodeErrorZPtr {
-       /// A pointer to the contents in the success state.
-       /// Reading from this pointer when `result_ok` is not set is undefined.
-       pub result: *mut crate::lightning::ln::channelmanager::PaymentId,
-       /// 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_PaymentIdDecodeErrorZ represents the result of a fallible operation,
-/// containing a crate::lightning::ln::channelmanager::PaymentId 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_PaymentIdDecodeErrorZ {
-       /// The contents of this CResult_PaymentIdDecodeErrorZ, accessible via either
-       /// `err` or `result` depending on the state of `result_ok`.
-       pub contents: CResult_PaymentIdDecodeErrorZPtr,
-       /// Whether this CResult_PaymentIdDecodeErrorZ represents a success state.
-       pub result_ok: bool,
-}
-#[no_mangle]
-/// Creates a new CResult_PaymentIdDecodeErrorZ in the success state.
-pub extern "C" fn CResult_PaymentIdDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PaymentId) -> CResult_PaymentIdDecodeErrorZ {
-       CResult_PaymentIdDecodeErrorZ {
-               contents: CResult_PaymentIdDecodeErrorZPtr {
-                       result: Box::into_raw(Box::new(o)),
-               },
-               result_ok: true,
-       }
-}
-#[no_mangle]
-/// Creates a new CResult_PaymentIdDecodeErrorZ in the error state.
-pub extern "C" fn CResult_PaymentIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentIdDecodeErrorZ {
-       CResult_PaymentIdDecodeErrorZ {
-               contents: CResult_PaymentIdDecodeErrorZPtr {
-                       err: Box::into_raw(Box::new(e)),
-               },
-               result_ok: false,
-       }
-}
-#[no_mangle]
-/// Frees any resources used by the CResult_PaymentIdDecodeErrorZ.
-pub extern "C" fn CResult_PaymentIdDecodeErrorZ_free(_res: CResult_PaymentIdDecodeErrorZ) { }
-impl Drop for CResult_PaymentIdDecodeErrorZ {
-       fn drop(&mut self) {
-               if self.result_ok {
-                       if unsafe { !(self.contents.result as *mut ()).is_null() } {
-                               let _ = unsafe { Box::from_raw(self.contents.result) };
-                       }
-               } else {
-                       if unsafe { !(self.contents.err as *mut ()).is_null() } {
-                               let _ = unsafe { Box::from_raw(self.contents.err) };
-                       }
-               }
-       }
-}
-impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PaymentId, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentIdDecodeErrorZ {
-       fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PaymentId, crate::lightning::ln::msgs::DecodeError>) -> Self {
-               let contents = if o.result_ok {
-                       let result = unsafe { o.contents.result };
-                       unsafe { o.contents.result = std::ptr::null_mut() };
-                       CResult_PaymentIdDecodeErrorZPtr { result }
-               } else {
-                       let err = unsafe { o.contents.err };
-                       unsafe { o.contents.err = std::ptr::null_mut(); }
-                       CResult_PaymentIdDecodeErrorZPtr { err }
-               };
-               Self {
-                       contents,
-                       result_ok: o.result_ok,
-               }
-       }
-}
-impl Clone for CResult_PaymentIdDecodeErrorZ {
-       fn clone(&self) -> Self {
-               if self.result_ok {
-                       Self { result_ok: true, contents: CResult_PaymentIdDecodeErrorZPtr {
-                               result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentId>::clone(unsafe { &*self.contents.result })))
-                       } }
-               } else {
-                       Self { result_ok: false, contents: CResult_PaymentIdDecodeErrorZPtr {
-                               err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
-                       } }
-               }
-       }
-}
-#[no_mangle]
-/// Creates a new CResult_PaymentIdDecodeErrorZ which has the same data as `orig`
-/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_PaymentIdDecodeErrorZ_clone(orig: &CResult_PaymentIdDecodeErrorZ) -> CResult_PaymentIdDecodeErrorZ { Clone::clone(&orig) }
-#[repr(C)]
 #[derive(Clone)]
 /// An enum which can either contain a u16 or not
 pub enum COption_u16Z {
@@ -4556,14 +5023,14 @@ pub extern "C" fn CResult__u832APIErrorZ_clone(orig: &CResult__u832APIErrorZ) ->
 pub union CResult_PaymentIdPaymentSendFailureZPtr {
        /// A pointer to the contents in the success state.
        /// Reading from this pointer when `result_ok` is not set is undefined.
-       pub result: *mut crate::lightning::ln::channelmanager::PaymentId,
+       pub result: *mut crate::c_types::ThirtyTwoBytes,
        /// A pointer to the contents in the error state.
        /// Reading from this pointer when `result_ok` is set is undefined.
        pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
 }
 #[repr(C)]
 /// A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation,
-/// containing a crate::lightning::ln::channelmanager::PaymentId on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
+/// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
 pub struct CResult_PaymentIdPaymentSendFailureZ {
        /// The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either
@@ -4574,7 +5041,7 @@ pub struct CResult_PaymentIdPaymentSendFailureZ {
 }
 #[no_mangle]
 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state.
-pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_ok(o: crate::lightning::ln::channelmanager::PaymentId) -> CResult_PaymentIdPaymentSendFailureZ {
+pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentSendFailureZ {
        CResult_PaymentIdPaymentSendFailureZ {
                contents: CResult_PaymentIdPaymentSendFailureZPtr {
                        result: Box::into_raw(Box::new(o)),
@@ -4608,8 +5075,8 @@ impl Drop for CResult_PaymentIdPaymentSendFailureZ {
                }
        }
 }
-impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PaymentId, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_PaymentIdPaymentSendFailureZ {
-       fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PaymentId, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_PaymentIdPaymentSendFailureZ {
+       fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
                let contents = if o.result_ok {
                        let result = unsafe { o.contents.result };
                        unsafe { o.contents.result = std::ptr::null_mut() };
@@ -4629,7 +5096,7 @@ impl Clone for CResult_PaymentIdPaymentSendFailureZ {
        fn clone(&self) -> Self {
                if self.result_ok {
                        Self { result_ok: true, contents: CResult_PaymentIdPaymentSendFailureZPtr {
-                               result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentId>::clone(unsafe { &*self.contents.result })))
+                               result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
                        } }
                } else {
                        Self { result_ok: false, contents: CResult_PaymentIdPaymentSendFailureZPtr {
@@ -4735,10 +5202,10 @@ pub struct C2Tuple_PaymentHashPaymentIdZ {
        /// The element at position 0
        pub a: crate::c_types::ThirtyTwoBytes,
        /// The element at position 1
-       pub b: crate::lightning::ln::channelmanager::PaymentId,
+       pub b: crate::c_types::ThirtyTwoBytes,
 }
-impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentId)> for C2Tuple_PaymentHashPaymentIdZ {
-       fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentId)) -> Self {
+impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentIdZ {
+       fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
                Self {
                        a: tup.0,
                        b: tup.1,
@@ -4746,7 +5213,7 @@ impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager:
        }
 }
 impl C2Tuple_PaymentHashPaymentIdZ {
-       #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentId) {
+       #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
                (self.a, self.b)
        }
 }
@@ -4764,7 +5231,7 @@ impl Clone for C2Tuple_PaymentHashPaymentIdZ {
 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_clone(orig: &C2Tuple_PaymentHashPaymentIdZ) -> C2Tuple_PaymentHashPaymentIdZ { Clone::clone(&orig) }
 /// Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
 #[no_mangle]
-pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::PaymentId) -> C2Tuple_PaymentHashPaymentIdZ {
+pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentIdZ {
        C2Tuple_PaymentHashPaymentIdZ { a, b, }
 }
 
@@ -5472,6 +5939,97 @@ impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, c
        }
 }
 #[repr(C)]
+/// The contents of CResult_PaymentIdPaymentErrorZ
+pub union CResult_PaymentIdPaymentErrorZPtr {
+       /// A pointer to the contents in the success state.
+       /// Reading from this pointer when `result_ok` is not set is undefined.
+       pub result: *mut crate::c_types::ThirtyTwoBytes,
+       /// A pointer to the contents in the error state.
+       /// Reading from this pointer when `result_ok` is set is undefined.
+       pub err: *mut crate::lightning_invoice::payment::PaymentError,
+}
+#[repr(C)]
+/// A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
+/// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
+/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
+pub struct CResult_PaymentIdPaymentErrorZ {
+       /// The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
+       /// `err` or `result` depending on the state of `result_ok`.
+       pub contents: CResult_PaymentIdPaymentErrorZPtr,
+       /// Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
+       pub result_ok: bool,
+}
+#[no_mangle]
+/// Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
+pub extern "C" fn CResult_PaymentIdPaymentErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentErrorZ {
+       CResult_PaymentIdPaymentErrorZ {
+               contents: CResult_PaymentIdPaymentErrorZPtr {
+                       result: Box::into_raw(Box::new(o)),
+               },
+               result_ok: true,
+       }
+}
+#[no_mangle]
+/// Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
+pub extern "C" fn CResult_PaymentIdPaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_PaymentIdPaymentErrorZ {
+       CResult_PaymentIdPaymentErrorZ {
+               contents: CResult_PaymentIdPaymentErrorZPtr {
+                       err: Box::into_raw(Box::new(e)),
+               },
+               result_ok: false,
+       }
+}
+#[no_mangle]
+/// Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
+pub extern "C" fn CResult_PaymentIdPaymentErrorZ_free(_res: CResult_PaymentIdPaymentErrorZ) { }
+impl Drop for CResult_PaymentIdPaymentErrorZ {
+       fn drop(&mut self) {
+               if self.result_ok {
+                       if unsafe { !(self.contents.result as *mut ()).is_null() } {
+                               let _ = unsafe { Box::from_raw(self.contents.result) };
+                       }
+               } else {
+                       if unsafe { !(self.contents.err as *mut ()).is_null() } {
+                               let _ = unsafe { Box::from_raw(self.contents.err) };
+                       }
+               }
+       }
+}
+impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>> for CResult_PaymentIdPaymentErrorZ {
+       fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>) -> Self {
+               let contents = if o.result_ok {
+                       let result = unsafe { o.contents.result };
+                       unsafe { o.contents.result = std::ptr::null_mut() };
+                       CResult_PaymentIdPaymentErrorZPtr { result }
+               } else {
+                       let err = unsafe { o.contents.err };
+                       unsafe { o.contents.err = std::ptr::null_mut(); }
+                       CResult_PaymentIdPaymentErrorZPtr { err }
+               };
+               Self {
+                       contents,
+                       result_ok: o.result_ok,
+               }
+       }
+}
+impl Clone for CResult_PaymentIdPaymentErrorZ {
+       fn clone(&self) -> Self {
+               if self.result_ok {
+                       Self { result_ok: true, contents: CResult_PaymentIdPaymentErrorZPtr {
+                               result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
+                       } }
+               } else {
+                       Self { result_ok: false, contents: CResult_PaymentIdPaymentErrorZPtr {
+                               err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
+                       } }
+               }
+       }
+}
+#[no_mangle]
+/// Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
+/// but with all dynamically-allocated buffers duplicated in new buffers.
+pub extern "C" fn CResult_PaymentIdPaymentErrorZ_clone(orig: &CResult_PaymentIdPaymentErrorZ) -> CResult_PaymentIdPaymentErrorZ { Clone::clone(&orig) }
+#[repr(C)]
 /// The contents of CResult_SiPrefixNoneZ
 pub union CResult_SiPrefixNoneZPtr {
        /// A pointer to the contents in the success state.
@@ -8858,188 +9416,6 @@ pub extern "C" fn COption_CVec_NetAddressZZ_free(_res: COption_CVec_NetAddressZZ
 /// but with all dynamically-allocated buffers duplicated in new buffers.
 pub extern "C" fn COption_CVec_NetAddressZZ_clone(orig: &COption_CVec_NetAddressZZ) -> COption_CVec_NetAddressZZ { Clone::clone(&orig) }
 #[repr(C)]
-/// The contents of CResult_NetAddressu8Z
-pub union CResult_NetAddressu8ZPtr {
-       /// A pointer to the contents in the success state.
-       /// Reading from this pointer when `result_ok` is not set is undefined.
-       pub result: *mut crate::lightning::ln::msgs::NetAddress,
-       /// A pointer to the contents in the error state.
-       /// Reading from this pointer when `result_ok` is set is undefined.
-       pub err: *mut u8,
-}
-#[repr(C)]
-/// A CResult_NetAddressu8Z represents the result of a fallible operation,
-/// containing a crate::lightning::ln::msgs::NetAddress on success and a u8 on failure.
-/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult_NetAddressu8Z {
-       /// The contents of this CResult_NetAddressu8Z, accessible via either
-       /// `err` or `result` depending on the state of `result_ok`.
-       pub contents: CResult_NetAddressu8ZPtr,
-       /// Whether this CResult_NetAddressu8Z represents a success state.
-       pub result_ok: bool,
-}
-#[no_mangle]
-/// Creates a new CResult_NetAddressu8Z in the success state.
-pub extern "C" fn CResult_NetAddressu8Z_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressu8Z {
-       CResult_NetAddressu8Z {
-               contents: CResult_NetAddressu8ZPtr {
-                       result: Box::into_raw(Box::new(o)),
-               },
-               result_ok: true,
-       }
-}
-#[no_mangle]
-/// Creates a new CResult_NetAddressu8Z in the error state.
-pub extern "C" fn CResult_NetAddressu8Z_err(e: u8) -> CResult_NetAddressu8Z {
-       CResult_NetAddressu8Z {
-               contents: CResult_NetAddressu8ZPtr {
-                       err: Box::into_raw(Box::new(e)),
-               },
-               result_ok: false,
-       }
-}
-#[no_mangle]
-/// Frees any resources used by the CResult_NetAddressu8Z.
-pub extern "C" fn CResult_NetAddressu8Z_free(_res: CResult_NetAddressu8Z) { }
-impl Drop for CResult_NetAddressu8Z {
-       fn drop(&mut self) {
-               if self.result_ok {
-                       if unsafe { !(self.contents.result as *mut ()).is_null() } {
-                               let _ = unsafe { Box::from_raw(self.contents.result) };
-                       }
-               } else {
-                       if unsafe { !(self.contents.err as *mut ()).is_null() } {
-                               let _ = unsafe { Box::from_raw(self.contents.err) };
-                       }
-               }
-       }
-}
-impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, u8>> for CResult_NetAddressu8Z {
-       fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, u8>) -> Self {
-               let contents = if o.result_ok {
-                       let result = unsafe { o.contents.result };
-                       unsafe { o.contents.result = std::ptr::null_mut() };
-                       CResult_NetAddressu8ZPtr { result }
-               } else {
-                       let err = unsafe { o.contents.err };
-                       unsafe { o.contents.err = std::ptr::null_mut(); }
-                       CResult_NetAddressu8ZPtr { err }
-               };
-               Self {
-                       contents,
-                       result_ok: o.result_ok,
-               }
-       }
-}
-impl Clone for CResult_NetAddressu8Z {
-       fn clone(&self) -> Self {
-               if self.result_ok {
-                       Self { result_ok: true, contents: CResult_NetAddressu8ZPtr {
-                               result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
-                       } }
-               } else {
-                       Self { result_ok: false, contents: CResult_NetAddressu8ZPtr {
-                               err: Box::into_raw(Box::new(<u8>::clone(unsafe { &*self.contents.err })))
-                       } }
-               }
-       }
-}
-#[no_mangle]
-/// Creates a new CResult_NetAddressu8Z which has the same data as `orig`
-/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_NetAddressu8Z_clone(orig: &CResult_NetAddressu8Z) -> CResult_NetAddressu8Z { Clone::clone(&orig) }
-#[repr(C)]
-/// The contents of CResult_CResult_NetAddressu8ZDecodeErrorZ
-pub union CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
-       /// 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::CResult_NetAddressu8Z,
-       /// 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_CResult_NetAddressu8ZDecodeErrorZ represents the result of a fallible operation,
-/// containing a crate::c_types::derived::CResult_NetAddressu8Z 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_CResult_NetAddressu8ZDecodeErrorZ {
-       /// The contents of this CResult_CResult_NetAddressu8ZDecodeErrorZ, accessible via either
-       /// `err` or `result` depending on the state of `result_ok`.
-       pub contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr,
-       /// Whether this CResult_CResult_NetAddressu8ZDecodeErrorZ represents a success state.
-       pub result_ok: bool,
-}
-#[no_mangle]
-/// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the success state.
-pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o: crate::c_types::derived::CResult_NetAddressu8Z) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
-       CResult_CResult_NetAddressu8ZDecodeErrorZ {
-               contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
-                       result: Box::into_raw(Box::new(o)),
-               },
-               result_ok: true,
-       }
-}
-#[no_mangle]
-/// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the error state.
-pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
-       CResult_CResult_NetAddressu8ZDecodeErrorZ {
-               contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
-                       err: Box::into_raw(Box::new(e)),
-               },
-               result_ok: false,
-       }
-}
-#[no_mangle]
-/// Frees any resources used by the CResult_CResult_NetAddressu8ZDecodeErrorZ.
-pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res: CResult_CResult_NetAddressu8ZDecodeErrorZ) { }
-impl Drop for CResult_CResult_NetAddressu8ZDecodeErrorZ {
-       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::CResult_NetAddressu8Z, crate::lightning::ln::msgs::DecodeError>> for CResult_CResult_NetAddressu8ZDecodeErrorZ {
-       fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CResult_NetAddressu8Z, crate::lightning::ln::msgs::DecodeError>) -> Self {
-               let contents = if o.result_ok {
-                       let result = unsafe { o.contents.result };
-                       unsafe { o.contents.result = std::ptr::null_mut() };
-                       CResult_CResult_NetAddressu8ZDecodeErrorZPtr { result }
-               } else {
-                       let err = unsafe { o.contents.err };
-                       unsafe { o.contents.err = std::ptr::null_mut(); }
-                       CResult_CResult_NetAddressu8ZDecodeErrorZPtr { err }
-               };
-               Self {
-                       contents,
-                       result_ok: o.result_ok,
-               }
-       }
-}
-impl Clone for CResult_CResult_NetAddressu8ZDecodeErrorZ {
-       fn clone(&self) -> Self {
-               if self.result_ok {
-                       Self { result_ok: true, contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
-                               result: Box::into_raw(Box::new(<crate::c_types::derived::CResult_NetAddressu8Z>::clone(unsafe { &*self.contents.result })))
-                       } }
-               } else {
-                       Self { result_ok: false, contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
-                               err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
-                       } }
-               }
-       }
-}
-#[no_mangle]
-/// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ which has the same data as `orig`
-/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig: &CResult_CResult_NetAddressu8ZDecodeErrorZ) -> CResult_CResult_NetAddressu8ZDecodeErrorZ { Clone::clone(&orig) }
-#[repr(C)]
 /// The contents of CResult_NetAddressDecodeErrorZ
 pub union CResult_NetAddressDecodeErrorZPtr {
        /// A pointer to the contents in the success state.
index 5c37216daf5d3e480a30f797ccfe534a731f7e95..0b00b5889c9f35040add1c21fb29540c670a6550 100644 (file)
@@ -28,40 +28,148 @@ use core::convert::Infallible;
 use bitcoin::hashes::Hash;
 use crate::c_types::*;
 
+
+use lightning::chain::chainmonitor::MonitorUpdateId as nativeMonitorUpdateIdImport;
+pub(crate) type nativeMonitorUpdateId = nativeMonitorUpdateIdImport;
+
+/// An opaque identifier describing a specific [`Persist`] method call.
+#[must_use]
+#[repr(C)]
+pub struct MonitorUpdateId {
+       /// 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 nativeMonitorUpdateId,
+       /// Indicates that this is the only struct which contains the same pointer.
+
+       /// Rust functions which take ownership of an object provided via an argument require
+       /// this to be true and invalidate the object pointed to by inner.
+       pub is_owned: bool,
+}
+
+impl Drop for MonitorUpdateId {
+       fn drop(&mut self) {
+               if self.is_owned && !<*mut nativeMonitorUpdateId>::is_null(self.inner) {
+                       let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+               }
+       }
+}
+/// Frees any resources used by the MonitorUpdateId, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn MonitorUpdateId_free(this_obj: MonitorUpdateId) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn MonitorUpdateId_free_void(this_ptr: *mut c_void) {
+       unsafe { let _ = Box::from_raw(this_ptr as *mut nativeMonitorUpdateId); }
+}
+#[allow(unused)]
+impl MonitorUpdateId {
+       pub(crate) fn get_native_ref(&self) -> &'static nativeMonitorUpdateId {
+               unsafe { &*ObjOps::untweak_ptr(self.inner) }
+       }
+       pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeMonitorUpdateId {
+               unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
+       }
+       /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
+       pub(crate) fn take_inner(mut self) -> *mut nativeMonitorUpdateId {
+               assert!(self.is_owned);
+               let ret = ObjOps::untweak_ptr(self.inner);
+               self.inner = std::ptr::null_mut();
+               ret
+       }
+}
+impl Clone for MonitorUpdateId {
+       fn clone(&self) -> Self {
+               Self {
+                       inner: if <*mut nativeMonitorUpdateId>::is_null(self.inner) { std::ptr::null_mut() } else {
+                               ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
+                       is_owned: true,
+               }
+       }
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn MonitorUpdateId_clone_void(this_ptr: *const c_void) -> *mut c_void {
+       Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeMonitorUpdateId)).clone() })) as *mut c_void
+}
+#[no_mangle]
+/// Creates a copy of the MonitorUpdateId
+pub extern "C" fn MonitorUpdateId_clone(orig: &MonitorUpdateId) -> MonitorUpdateId {
+       orig.clone()
+}
+/// Checks if two MonitorUpdateIds contain equal inner contents.
+#[no_mangle]
+pub extern "C" fn MonitorUpdateId_hash(o: &MonitorUpdateId) -> u64 {
+       if o.inner.is_null() { return 0; }
+       // Note that we'd love to use std::collections::hash_map::DefaultHasher but it's not in core
+       #[allow(deprecated)]
+       let mut hasher = core::hash::SipHasher::new();
+       std::hash::Hash::hash(o.get_native_ref(), &mut hasher);
+       std::hash::Hasher::finish(&hasher)
+}
+/// Checks if two MonitorUpdateIds 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 MonitorUpdateId_eq(a: &MonitorUpdateId, b: &MonitorUpdateId) -> 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 }
+}
 /// `Persist` defines behavior for persisting channel monitors: this could mean
 /// writing once to disk, and/or uploading to one or more backup services.
 ///
-/// Note that for every new monitor, you **must** persist the new `ChannelMonitor`
-/// to disk/backups. And, on every update, you **must** persist either the
-/// `ChannelMonitorUpdate` or the updated monitor itself. Otherwise, there is risk
-/// of situations such as revoking a transaction, then crashing before this
-/// revocation can be persisted, then unintentionally broadcasting a revoked
-/// transaction and losing money. This is a risk because previous channel states
-/// are toxic, so it's important that whatever channel state is persisted is
-/// kept up-to-date.
+/// 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.
+///  * 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`].
+///
+///    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
+///    closed without broadcasting the latest state. See
+///    [`ChannelMonitorUpdateErr::PermanentFailure`] for more details.
 #[repr(C)]
 pub struct Persist {
        /// An opaque pointer which is passed to your function implementations as an argument.
        /// This has no meaning in the LDK, and can be NULL or any other value.
        pub this_arg: *mut c_void,
-       /// Persist a new channel's data. The data can be stored any way you want, but
-       /// the identifier provided by Rust-Lightning is the channel's outpoint (and
-       /// it is up to you to maintain a correct mapping between the outpoint and the
-       /// stored channel data). Note that you **must** persist every new monitor to
-       /// disk. See the `Persist` trait documentation for more details.
+       /// Persist a new channel's data in response to a [`chain::Watch::watch_channel`] call. This is
+       /// called by [`ChannelManager`] for new channels, or may be called directly, e.g. on startup.
+       ///
+       /// The data can be stored any way you want, but the identifier provided by LDK is the
+       /// channel's outpoint (and it is up to you to maintain a correct mapping between the outpoint
+       /// and the stored channel data). Note that you **must** persist every new monitor to disk.
+       ///
+       /// The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`],
+       /// if you return [`ChannelMonitorUpdateErr::TemporaryFailure`].
        ///
        /// See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`
        /// and [`ChannelMonitorUpdateErr`] 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, id: crate::lightning::chain::transaction::OutPoint, data: &crate::lightning::chain::channelmonitor::ChannelMonitor) -> crate::c_types::derived::CResult_NoneChannelMonitorUpdateErrZ,
-       /// Update one channel's data. The provided `ChannelMonitor` has already
-       /// applied the given update.
+       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,
+       /// Update one channel's data. The provided [`ChannelMonitor`] has already applied the given
+       /// update.
+       ///
+       /// Note that on every update, you **must** persist either the [`ChannelMonitorUpdate`] or the
+       /// updated monitor itself to disk/backups. See the [`Persist`] trait documentation for more
+       /// details.
        ///
-       /// Note that on every update, you **must** persist either the
-       /// `ChannelMonitorUpdate` or the updated monitor itself to disk/backups. See
-       /// the `Persist` trait documentation for more details.
+       /// During blockchain synchronization operations, this may be called with no
+       /// [`ChannelMonitorUpdate`], in which case the full [`ChannelMonitor`] needs to be persisted.
+       /// Note that after the full [`ChannelMonitor`] is persisted any previous
+       /// [`ChannelMonitorUpdate`]s which were persisted should be discarded - they can no longer be
+       /// applied to the persisted [`ChannelMonitor`] as they were already applied.
        ///
        /// If an implementer chooses to persist the updates only, they need to make
        /// sure that all the updates are applied to the `ChannelMonitors` *before*
@@ -75,13 +183,18 @@ pub struct Persist {
        /// them in batches. The size of each monitor grows `O(number of state updates)`
        /// 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`].
+       ///
        /// 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.
        ///
        /// [`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, id: crate::lightning::chain::transaction::OutPoint, update: &crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, data: &crate::lightning::chain::channelmonitor::ChannelMonitor) -> 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::c_types::derived::CResult_NoneChannelMonitorUpdateErrZ,
        /// 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)>,
@@ -100,13 +213,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 id: lightning::chain::transaction::OutPoint, mut data: &lightning::chain::channelmonitor::ChannelMonitor<crate::lightning::chain::keysinterface::Sign>) -> Result<(), lightning::chain::ChannelMonitorUpdateErr> {
-               let mut ret = (self.persist_new_channel)(self.this_arg, crate::lightning::chain::transaction::OutPoint { inner: ObjOps::heap_alloc(id), is_owned: true }, &crate::lightning::chain::channelmonitor::ChannelMonitor { inner: unsafe { ObjOps::nonnull_ptr_to_inner((data as *const _) as *mut _) }, is_owned: false });
+       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> {
+               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
        }
-       fn update_persisted_channel(&self, mut id: lightning::chain::transaction::OutPoint, mut update: &lightning::chain::channelmonitor::ChannelMonitorUpdate, mut data: &lightning::chain::channelmonitor::ChannelMonitor<crate::lightning::chain::keysinterface::Sign>) -> Result<(), lightning::chain::ChannelMonitorUpdateErr> {
-               let mut ret = (self.update_persisted_channel)(self.this_arg, crate::lightning::chain::transaction::OutPoint { inner: ObjOps::heap_alloc(id), is_owned: true }, &crate::lightning::chain::channelmonitor::ChannelMonitorUpdate { inner: unsafe { ObjOps::nonnull_ptr_to_inner((update as *const _) as *mut _) }, is_owned: false }, &crate::lightning::chain::channelmonitor::ChannelMonitor { inner: unsafe { ObjOps::nonnull_ptr_to_inner((data as *const _) as *mut _) }, is_owned: false });
+       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> {
+               let mut local_update = &crate::lightning::chain::channelmonitor::ChannelMonitorUpdate { inner: unsafe { (if update.is_none() { std::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
        }
@@ -132,7 +246,7 @@ impl Drop for Persist {
 }
 
 use lightning::chain::chainmonitor::LockedChannelMonitor as nativeLockedChannelMonitorImport;
-type nativeLockedChannelMonitor = nativeLockedChannelMonitorImport<'static, crate::lightning::chain::keysinterface::Sign>;
+pub(crate) type nativeLockedChannelMonitor = nativeLockedChannelMonitorImport<'static, crate::lightning::chain::keysinterface::Sign>;
 
 /// A read-only reference to a current ChannelMonitor.
 ///
@@ -165,7 +279,7 @@ impl Drop for LockedChannelMonitor {
 pub extern "C" fn LockedChannelMonitor_free(this_obj: LockedChannelMonitor) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn LockedChannelMonitor_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn LockedChannelMonitor_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeLockedChannelMonitor); }
 }
 #[allow(unused)]
@@ -186,7 +300,7 @@ impl LockedChannelMonitor {
 }
 
 use lightning::chain::chainmonitor::ChainMonitor as nativeChainMonitorImport;
-type nativeChainMonitor = nativeChainMonitorImport<crate::lightning::chain::keysinterface::Sign, crate::lightning::chain::Filter, crate::lightning::chain::chaininterface::BroadcasterInterface, crate::lightning::chain::chaininterface::FeeEstimator, crate::lightning::util::logger::Logger, crate::lightning::chain::chainmonitor::Persist>;
+pub(crate) type nativeChainMonitor = nativeChainMonitorImport<crate::lightning::chain::keysinterface::Sign, crate::lightning::chain::Filter, crate::lightning::chain::chaininterface::BroadcasterInterface, crate::lightning::chain::chaininterface::FeeEstimator, crate::lightning::util::logger::Logger, crate::lightning::chain::chainmonitor::Persist>;
 
 /// An implementation of [`chain::Watch`] for monitoring channels.
 ///
@@ -224,7 +338,7 @@ impl Drop for ChainMonitor {
 pub extern "C" fn ChainMonitor_free(this_obj: ChainMonitor) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn ChainMonitor_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn ChainMonitor_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChainMonitor); }
 }
 #[allow(unused)]
@@ -301,6 +415,27 @@ pub extern "C" fn ChainMonitor_list_monitors(this_arg: &ChainMonitor) -> crate::
        local_ret.into()
 }
 
+/// Indicates the persistence of a [`ChannelMonitor`] has completed after
+/// [`ChannelMonitorUpdateErr::TemporaryFailure`] 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`],
+///  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.
+///
+/// Returns an [`APIError::APIMisuseError`] if `funding_txo` does not match any currently
+/// registered [`ChannelMonitor`]s.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn ChainMonitor_channel_monitor_updated(this_arg: &ChainMonitor, mut funding_txo: crate::lightning::chain::transaction::OutPoint, mut completed_update_id: crate::lightning::chain::chainmonitor::MonitorUpdateId) -> crate::c_types::derived::CResult_NoneAPIErrorZ {
+       let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.channel_monitor_updated(*unsafe { Box::from_raw(funding_txo.take_inner()) }, *unsafe { Box::from_raw(completed_update_id.take_inner()) });
+       let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::util::errors::APIError::native_into(e) }).into() };
+       local_ret
+}
+
 impl From<nativeChainMonitor> for crate::lightning::chain::Listen {
        fn from(obj: nativeChainMonitor) -> Self {
                let mut rust_obj = ChainMonitor { inner: ObjOps::heap_alloc(obj), is_owned: true };
index 31c4f9e2d4af3f07a7ee3fa9c65ecf70425fced5..dcf6d132a4e65aa63ac3e9510c41249a96627c0c 100644 (file)
@@ -27,7 +27,7 @@ use crate::c_types::*;
 
 
 use lightning::chain::channelmonitor::ChannelMonitorUpdate as nativeChannelMonitorUpdateImport;
-type nativeChannelMonitorUpdate = nativeChannelMonitorUpdateImport;
+pub(crate) type nativeChannelMonitorUpdate = nativeChannelMonitorUpdateImport;
 
 /// An update generated by the underlying Channel itself which contains some new information the
 /// ChannelMonitor should be made aware of.
@@ -58,7 +58,7 @@ impl Drop for ChannelMonitorUpdate {
 pub extern "C" fn ChannelMonitorUpdate_free(this_obj: ChannelMonitorUpdate) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn ChannelMonitorUpdate_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn ChannelMonitorUpdate_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelMonitorUpdate); }
 }
 #[allow(unused)]
@@ -155,7 +155,7 @@ pub extern "C" fn ChannelMonitorUpdate_read(ser: crate::c_types::u8slice) -> cra
 }
 
 use lightning::chain::channelmonitor::MonitorUpdateError as nativeMonitorUpdateErrorImport;
-type nativeMonitorUpdateError = nativeMonitorUpdateErrorImport;
+pub(crate) type nativeMonitorUpdateError = nativeMonitorUpdateErrorImport;
 
 /// General Err type for ChannelMonitor actions. Generally, this implies that the data provided is
 /// inconsistent with the ChannelMonitor being called. eg for ChannelMonitor::update_monitor this
@@ -189,7 +189,7 @@ impl Drop for MonitorUpdateError {
 pub extern "C" fn MonitorUpdateError_free(this_obj: MonitorUpdateError) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn MonitorUpdateError_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn MonitorUpdateError_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeMonitorUpdateError); }
 }
 #[allow(unused)]
@@ -208,6 +208,23 @@ impl MonitorUpdateError {
                ret
        }
 }
+#[no_mangle]
+pub extern "C" fn MonitorUpdateError_get_a(this_ptr: &MonitorUpdateError) -> crate::c_types::Str {
+       let mut inner_val = &mut this_ptr.get_native_mut_ref().0;
+       inner_val.into()
+}
+#[no_mangle]
+pub extern "C" fn MonitorUpdateError_set_a(this_ptr: &mut MonitorUpdateError, mut val: crate::c_types::Str) {
+       unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.0 = val.into_str();
+}
+/// Constructs a new MonitorUpdateError given each field
+#[must_use]
+#[no_mangle]
+pub extern "C" fn MonitorUpdateError_new(mut a_arg: crate::c_types::Str) -> MonitorUpdateError {
+       MonitorUpdateError { inner: ObjOps::heap_alloc(lightning::chain::channelmonitor::MonitorUpdateError (
+               a_arg.into_str(),
+       )), is_owned: true }
+}
 impl Clone for MonitorUpdateError {
        fn clone(&self) -> Self {
                Self {
@@ -236,6 +253,25 @@ pub enum MonitorEvent {
        HTLCEvent(crate::lightning::chain::channelmonitor::HTLCUpdate),
        /// A monitor event that the Channel's commitment transaction was confirmed.
        CommitmentTxConfirmed(crate::lightning::chain::transaction::OutPoint),
+       /// Indicates a [`ChannelMonitor`] update has completed. See
+       /// [`ChannelMonitorUpdateErr::TemporaryFailure`] for more information on how this is used.
+       ///
+       /// [`ChannelMonitorUpdateErr::TemporaryFailure`]: super::ChannelMonitorUpdateErr::TemporaryFailure
+       UpdateCompleted {
+               /// 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
+               /// [`ChannelMonitor::get_latest_update_id`].
+               ///
+               /// Note that this should only be set to a given update's ID if all previous updates for the
+               /// same [`ChannelMonitor`] have been applied and persisted.
+               monitor_update_id: u64,
+       },
+       /// Indicates a [`ChannelMonitor`] update has failed. See
+       /// [`ChannelMonitorUpdateErr::PermanentFailure`] for more information on how this is used.
+       ///
+       /// [`ChannelMonitorUpdateErr::PermanentFailure`]: super::ChannelMonitorUpdateErr::PermanentFailure
+       UpdateFailed(crate::lightning::chain::transaction::OutPoint),
 }
 use lightning::chain::channelmonitor::MonitorEvent as nativeMonitorEvent;
 impl MonitorEvent {
@@ -254,6 +290,20 @@ impl MonitorEvent {
                                        *unsafe { Box::from_raw(a_nonref.take_inner()) },
                                )
                        },
+                       MonitorEvent::UpdateCompleted {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 {
+                                       funding_txo: *unsafe { Box::from_raw(funding_txo_nonref.take_inner()) },
+                                       monitor_update_id: monitor_update_id_nonref,
+                               }
+                       },
+                       MonitorEvent::UpdateFailed (ref a, ) => {
+                               let mut a_nonref = (*a).clone();
+                               nativeMonitorEvent::UpdateFailed (
+                                       *unsafe { Box::from_raw(a_nonref.take_inner()) },
+                               )
+                       },
                }
        }
        #[allow(unused)]
@@ -269,6 +319,17 @@ impl MonitorEvent {
                                        *unsafe { Box::from_raw(a.take_inner()) },
                                )
                        },
+                       MonitorEvent::UpdateCompleted {mut funding_txo, mut monitor_update_id, } => {
+                               nativeMonitorEvent::UpdateCompleted {
+                                       funding_txo: *unsafe { Box::from_raw(funding_txo.take_inner()) },
+                                       monitor_update_id: monitor_update_id,
+                               }
+                       },
+                       MonitorEvent::UpdateFailed (mut a, ) => {
+                               nativeMonitorEvent::UpdateFailed (
+                                       *unsafe { Box::from_raw(a.take_inner()) },
+                               )
+                       },
                }
        }
        #[allow(unused)]
@@ -286,6 +347,20 @@ 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, } => {
+                               let mut funding_txo_nonref = (*funding_txo).clone();
+                               let mut monitor_update_id_nonref = (*monitor_update_id).clone();
+                               MonitorEvent::UpdateCompleted {
+                                       funding_txo: crate::lightning::chain::transaction::OutPoint { inner: ObjOps::heap_alloc(funding_txo_nonref), is_owned: true },
+                                       monitor_update_id: monitor_update_id_nonref,
+                               }
+                       },
+                       nativeMonitorEvent::UpdateFailed (ref a, ) => {
+                               let mut a_nonref = (*a).clone();
+                               MonitorEvent::UpdateFailed (
+                                       crate::lightning::chain::transaction::OutPoint { inner: ObjOps::heap_alloc(a_nonref), is_owned: true },
+                               )
+                       },
                }
        }
        #[allow(unused)]
@@ -301,6 +376,17 @@ 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 {
+                                       funding_txo: crate::lightning::chain::transaction::OutPoint { inner: ObjOps::heap_alloc(funding_txo), is_owned: true },
+                                       monitor_update_id: monitor_update_id,
+                               }
+                       },
+                       nativeMonitorEvent::UpdateFailed (mut a, ) => {
+                               MonitorEvent::UpdateFailed (
+                                       crate::lightning::chain::transaction::OutPoint { inner: ObjOps::heap_alloc(a), is_owned: true },
+                               )
+                       },
                }
        }
 }
@@ -322,9 +408,27 @@ pub extern "C" fn MonitorEvent_htlcevent(a: crate::lightning::chain::channelmoni
 pub extern "C" fn MonitorEvent_commitment_tx_confirmed(a: crate::lightning::chain::transaction::OutPoint) -> MonitorEvent {
        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 {
+               funding_txo,
+               monitor_update_id,
+       }
+}
+#[no_mangle]
+/// Utility method to constructs a new UpdateFailed-variant MonitorEvent
+pub extern "C" fn MonitorEvent_update_failed(a: crate::lightning::chain::transaction::OutPoint) -> MonitorEvent {
+       MonitorEvent::UpdateFailed(a, )
+}
+#[no_mangle]
+/// Serialize the MonitorEvent object into a byte array which can be read by MonitorEvent_read
+pub extern "C" fn MonitorEvent_write(obj: &MonitorEvent) -> crate::c_types::derived::CVec_u8Z {
+       crate::c_types::serialize_obj(&unsafe { &*obj }.to_native())
+}
 
 use lightning::chain::channelmonitor::HTLCUpdate as nativeHTLCUpdateImport;
-type nativeHTLCUpdate = nativeHTLCUpdateImport;
+pub(crate) type nativeHTLCUpdate = nativeHTLCUpdateImport;
 
 /// Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on
 /// chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the
@@ -356,7 +460,7 @@ impl Drop for HTLCUpdate {
 pub extern "C" fn HTLCUpdate_free(this_obj: HTLCUpdate) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn HTLCUpdate_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn HTLCUpdate_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeHTLCUpdate); }
 }
 #[allow(unused)]
@@ -649,7 +753,7 @@ pub extern "C" fn Balance_eq(a: &Balance, b: &Balance) -> bool {
 }
 
 use lightning::chain::channelmonitor::ChannelMonitor as nativeChannelMonitorImport;
-type nativeChannelMonitor = nativeChannelMonitorImport<crate::lightning::chain::keysinterface::Sign>;
+pub(crate) type nativeChannelMonitor = nativeChannelMonitorImport<crate::lightning::chain::keysinterface::Sign>;
 
 /// A ChannelMonitor handles chain events (blocks connected and disconnected) and generates
 /// on-chain transactions to ensure no loss of funds occurs.
@@ -694,7 +798,7 @@ impl Drop for ChannelMonitor {
 pub extern "C" fn ChannelMonitor_free(this_obj: ChannelMonitor) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn ChannelMonitor_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn ChannelMonitor_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelMonitor); }
 }
 #[allow(unused)]
index 1472582811b1bc3d0b3de9ed99b7cf2cedcb8660..ca5d47ee8520153c6476daf12918485cdd48b493 100644 (file)
@@ -18,7 +18,7 @@ use crate::c_types::*;
 
 
 use lightning::chain::keysinterface::DelayedPaymentOutputDescriptor as nativeDelayedPaymentOutputDescriptorImport;
-type nativeDelayedPaymentOutputDescriptor = nativeDelayedPaymentOutputDescriptorImport;
+pub(crate) type nativeDelayedPaymentOutputDescriptor = nativeDelayedPaymentOutputDescriptorImport;
 
 /// Information about a spendable output to a P2WSH script. See
 /// SpendableOutputDescriptor::DelayedPaymentOutput for more details on how to spend this.
@@ -49,7 +49,7 @@ impl Drop for DelayedPaymentOutputDescriptor {
 pub extern "C" fn DelayedPaymentOutputDescriptor_free(this_obj: DelayedPaymentOutputDescriptor) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn DelayedPaymentOutputDescriptor_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn DelayedPaymentOutputDescriptor_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeDelayedPaymentOutputDescriptor); }
 }
 #[allow(unused)]
@@ -72,7 +72,7 @@ impl DelayedPaymentOutputDescriptor {
 #[no_mangle]
 pub extern "C" fn DelayedPaymentOutputDescriptor_get_outpoint(this_ptr: &DelayedPaymentOutputDescriptor) -> crate::lightning::chain::transaction::OutPoint {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().outpoint;
-       crate::lightning::chain::transaction::OutPoint { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const _) as *mut _) }, is_owned: false }
+       crate::lightning::chain::transaction::OutPoint { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::chain::transaction::OutPoint<>) as *mut _) }, is_owned: false }
 }
 /// The outpoint which is spendable
 #[no_mangle]
@@ -198,7 +198,7 @@ pub extern "C" fn DelayedPaymentOutputDescriptor_read(ser: crate::c_types::u8sli
 }
 
 use lightning::chain::keysinterface::StaticPaymentOutputDescriptor as nativeStaticPaymentOutputDescriptorImport;
-type nativeStaticPaymentOutputDescriptor = nativeStaticPaymentOutputDescriptorImport;
+pub(crate) type nativeStaticPaymentOutputDescriptor = nativeStaticPaymentOutputDescriptorImport;
 
 /// Information about a spendable output to our \"payment key\". See
 /// SpendableOutputDescriptor::StaticPaymentOutput for more details on how to spend this.
@@ -229,7 +229,7 @@ impl Drop for StaticPaymentOutputDescriptor {
 pub extern "C" fn StaticPaymentOutputDescriptor_free(this_obj: StaticPaymentOutputDescriptor) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn StaticPaymentOutputDescriptor_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn StaticPaymentOutputDescriptor_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeStaticPaymentOutputDescriptor); }
 }
 #[allow(unused)]
@@ -252,7 +252,7 @@ impl StaticPaymentOutputDescriptor {
 #[no_mangle]
 pub extern "C" fn StaticPaymentOutputDescriptor_get_outpoint(this_ptr: &StaticPaymentOutputDescriptor) -> crate::lightning::chain::transaction::OutPoint {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().outpoint;
-       crate::lightning::chain::transaction::OutPoint { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const _) as *mut _) }, is_owned: false }
+       crate::lightning::chain::transaction::OutPoint { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::chain::transaction::OutPoint<>) as *mut _) }, is_owned: false }
 }
 /// The outpoint which is spendable
 #[no_mangle]
@@ -729,7 +729,7 @@ impl rustBaseSign for BaseSign {
                ret.data
        }
        fn validate_holder_commitment(&self, mut holder_tx: &lightning::ln::chan_utils::HolderCommitmentTransaction) -> Result<(), ()> {
-               let mut ret = (self.validate_holder_commitment)(self.this_arg, &crate::lightning::ln::chan_utils::HolderCommitmentTransaction { inner: unsafe { ObjOps::nonnull_ptr_to_inner((holder_tx as *const _) as *mut _) }, is_owned: false });
+               let mut ret = (self.validate_holder_commitment)(self.this_arg, &crate::lightning::ln::chan_utils::HolderCommitmentTransaction { inner: unsafe { ObjOps::nonnull_ptr_to_inner((holder_tx as *const lightning::ln::chan_utils::HolderCommitmentTransaction<>) 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
        }
@@ -744,7 +744,7 @@ impl rustBaseSign for BaseSign {
                ret.data
        }
        fn sign_counterparty_commitment(&self, mut commitment_tx: &lightning::ln::chan_utils::CommitmentTransaction, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1<bitcoin::secp256k1::All>) -> Result<(bitcoin::secp256k1::Signature, Vec<bitcoin::secp256k1::Signature>), ()> {
-               let mut ret = (self.sign_counterparty_commitment)(self.this_arg, &crate::lightning::ln::chan_utils::CommitmentTransaction { inner: unsafe { ObjOps::nonnull_ptr_to_inner((commitment_tx as *const _) as *mut _) }, is_owned: false });
+               let mut ret = (self.sign_counterparty_commitment)(self.this_arg, &crate::lightning::ln::chan_utils::CommitmentTransaction { inner: unsafe { ObjOps::nonnull_ptr_to_inner((commitment_tx as *const lightning::ln::chan_utils::CommitmentTransaction<>) as *mut _) }, is_owned: false });
                let mut local_ret = match ret.result_ok { true => Ok( { let (mut orig_ret_0_0, mut orig_ret_0_1) = (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).to_rust(); let mut local_orig_ret_0_1 = Vec::new(); for mut item in orig_ret_0_1.into_rust().drain(..) { local_orig_ret_0_1.push( { item.into_rust() }); }; let mut local_ret_0 = (orig_ret_0_0.into_rust(), local_orig_ret_0_1); local_ret_0 }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })};
                local_ret
        }
@@ -754,7 +754,7 @@ impl rustBaseSign for BaseSign {
                local_ret
        }
        fn sign_holder_commitment_and_htlcs(&self, mut commitment_tx: &lightning::ln::chan_utils::HolderCommitmentTransaction, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1<bitcoin::secp256k1::All>) -> Result<(bitcoin::secp256k1::Signature, Vec<bitcoin::secp256k1::Signature>), ()> {
-               let mut ret = (self.sign_holder_commitment_and_htlcs)(self.this_arg, &crate::lightning::ln::chan_utils::HolderCommitmentTransaction { inner: unsafe { ObjOps::nonnull_ptr_to_inner((commitment_tx as *const _) as *mut _) }, is_owned: false });
+               let mut ret = (self.sign_holder_commitment_and_htlcs)(self.this_arg, &crate::lightning::ln::chan_utils::HolderCommitmentTransaction { inner: unsafe { ObjOps::nonnull_ptr_to_inner((commitment_tx as *const lightning::ln::chan_utils::HolderCommitmentTransaction<>) as *mut _) }, is_owned: false });
                let mut local_ret = match ret.result_ok { true => Ok( { let (mut orig_ret_0_0, mut orig_ret_0_1) = (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).to_rust(); let mut local_orig_ret_0_1 = Vec::new(); for mut item in orig_ret_0_1.into_rust().drain(..) { local_orig_ret_0_1.push( { item.into_rust() }); }; let mut local_ret_0 = (orig_ret_0_0.into_rust(), local_orig_ret_0_1); local_ret_0 }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })};
                local_ret
        }
@@ -764,27 +764,27 @@ impl rustBaseSign for BaseSign {
                local_ret
        }
        fn sign_justice_revoked_htlc(&self, mut justice_tx: &bitcoin::blockdata::transaction::Transaction, mut input: usize, mut amount: u64, mut per_commitment_key: &bitcoin::secp256k1::key::SecretKey, mut htlc: &lightning::ln::chan_utils::HTLCOutputInCommitment, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1<bitcoin::secp256k1::All>) -> Result<bitcoin::secp256k1::Signature, ()> {
-               let mut ret = (self.sign_justice_revoked_htlc)(self.this_arg, crate::c_types::Transaction::from_bitcoin(justice_tx), input, amount, per_commitment_key.as_ref(), &crate::lightning::ln::chan_utils::HTLCOutputInCommitment { inner: unsafe { ObjOps::nonnull_ptr_to_inner((htlc as *const _) as *mut _) }, is_owned: false });
+               let mut ret = (self.sign_justice_revoked_htlc)(self.this_arg, crate::c_types::Transaction::from_bitcoin(justice_tx), input, amount, per_commitment_key.as_ref(), &crate::lightning::ln::chan_utils::HTLCOutputInCommitment { inner: unsafe { ObjOps::nonnull_ptr_to_inner((htlc as *const lightning::ln::chan_utils::HTLCOutputInCommitment<>) as *mut _) }, is_owned: false });
                let mut local_ret = match ret.result_ok { true => Ok( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).into_rust() }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })};
                local_ret
        }
        fn sign_counterparty_htlc_transaction(&self, mut htlc_tx: &bitcoin::blockdata::transaction::Transaction, mut input: usize, mut amount: u64, mut per_commitment_point: &bitcoin::secp256k1::key::PublicKey, mut htlc: &lightning::ln::chan_utils::HTLCOutputInCommitment, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1<bitcoin::secp256k1::All>) -> Result<bitcoin::secp256k1::Signature, ()> {
-               let mut ret = (self.sign_counterparty_htlc_transaction)(self.this_arg, crate::c_types::Transaction::from_bitcoin(htlc_tx), input, amount, crate::c_types::PublicKey::from_rust(&per_commitment_point), &crate::lightning::ln::chan_utils::HTLCOutputInCommitment { inner: unsafe { ObjOps::nonnull_ptr_to_inner((htlc as *const _) as *mut _) }, is_owned: false });
+               let mut ret = (self.sign_counterparty_htlc_transaction)(self.this_arg, crate::c_types::Transaction::from_bitcoin(htlc_tx), input, amount, crate::c_types::PublicKey::from_rust(&per_commitment_point), &crate::lightning::ln::chan_utils::HTLCOutputInCommitment { inner: unsafe { ObjOps::nonnull_ptr_to_inner((htlc as *const lightning::ln::chan_utils::HTLCOutputInCommitment<>) as *mut _) }, is_owned: false });
                let mut local_ret = match ret.result_ok { true => Ok( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).into_rust() }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })};
                local_ret
        }
        fn sign_closing_transaction(&self, mut closing_tx: &lightning::ln::chan_utils::ClosingTransaction, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1<bitcoin::secp256k1::All>) -> Result<bitcoin::secp256k1::Signature, ()> {
-               let mut ret = (self.sign_closing_transaction)(self.this_arg, &crate::lightning::ln::chan_utils::ClosingTransaction { inner: unsafe { ObjOps::nonnull_ptr_to_inner((closing_tx as *const _) as *mut _) }, is_owned: false });
+               let mut ret = (self.sign_closing_transaction)(self.this_arg, &crate::lightning::ln::chan_utils::ClosingTransaction { inner: unsafe { ObjOps::nonnull_ptr_to_inner((closing_tx as *const lightning::ln::chan_utils::ClosingTransaction<>) as *mut _) }, is_owned: false });
                let mut local_ret = match ret.result_ok { true => Ok( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).into_rust() }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })};
                local_ret
        }
        fn sign_channel_announcement(&self, mut msg: &lightning::ln::msgs::UnsignedChannelAnnouncement, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1<bitcoin::secp256k1::All>) -> Result<bitcoin::secp256k1::Signature, ()> {
-               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 _) as *mut _) }, is_owned: false });
+               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( { (*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 ready_channel(&mut self, mut channel_parameters: &lightning::ln::chan_utils::ChannelTransactionParameters) {
-               (self.ready_channel)(self.this_arg, &crate::lightning::ln::chan_utils::ChannelTransactionParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((channel_parameters as *const _) as *mut _) }, is_owned: false })
+               (self.ready_channel)(self.this_arg, &crate::lightning::ln::chan_utils::ChannelTransactionParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((channel_parameters as *const lightning::ln::chan_utils::ChannelTransactionParameters<>) as *mut _) }, is_owned: false })
        }
 }
 
@@ -850,7 +850,7 @@ impl lightning::chain::keysinterface::BaseSign for Sign {
                ret.data
        }
        fn validate_holder_commitment(&self, mut holder_tx: &lightning::ln::chan_utils::HolderCommitmentTransaction) -> Result<(), ()> {
-               let mut ret = (self.BaseSign.validate_holder_commitment)(self.BaseSign.this_arg, &crate::lightning::ln::chan_utils::HolderCommitmentTransaction { inner: unsafe { ObjOps::nonnull_ptr_to_inner((holder_tx as *const _) as *mut _) }, is_owned: false });
+               let mut ret = (self.BaseSign.validate_holder_commitment)(self.BaseSign.this_arg, &crate::lightning::ln::chan_utils::HolderCommitmentTransaction { inner: unsafe { ObjOps::nonnull_ptr_to_inner((holder_tx as *const lightning::ln::chan_utils::HolderCommitmentTransaction<>) 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
        }
@@ -865,7 +865,7 @@ impl lightning::chain::keysinterface::BaseSign for Sign {
                ret.data
        }
        fn sign_counterparty_commitment(&self, mut commitment_tx: &lightning::ln::chan_utils::CommitmentTransaction, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1<bitcoin::secp256k1::All>) -> Result<(bitcoin::secp256k1::Signature, Vec<bitcoin::secp256k1::Signature>), ()> {
-               let mut ret = (self.BaseSign.sign_counterparty_commitment)(self.BaseSign.this_arg, &crate::lightning::ln::chan_utils::CommitmentTransaction { inner: unsafe { ObjOps::nonnull_ptr_to_inner((commitment_tx as *const _) as *mut _) }, is_owned: false });
+               let mut ret = (self.BaseSign.sign_counterparty_commitment)(self.BaseSign.this_arg, &crate::lightning::ln::chan_utils::CommitmentTransaction { inner: unsafe { ObjOps::nonnull_ptr_to_inner((commitment_tx as *const lightning::ln::chan_utils::CommitmentTransaction<>) as *mut _) }, is_owned: false });
                let mut local_ret = match ret.result_ok { true => Ok( { let (mut orig_ret_0_0, mut orig_ret_0_1) = (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).to_rust(); let mut local_orig_ret_0_1 = Vec::new(); for mut item in orig_ret_0_1.into_rust().drain(..) { local_orig_ret_0_1.push( { item.into_rust() }); }; let mut local_ret_0 = (orig_ret_0_0.into_rust(), local_orig_ret_0_1); local_ret_0 }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })};
                local_ret
        }
@@ -875,7 +875,7 @@ impl lightning::chain::keysinterface::BaseSign for Sign {
                local_ret
        }
        fn sign_holder_commitment_and_htlcs(&self, mut commitment_tx: &lightning::ln::chan_utils::HolderCommitmentTransaction, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1<bitcoin::secp256k1::All>) -> Result<(bitcoin::secp256k1::Signature, Vec<bitcoin::secp256k1::Signature>), ()> {
-               let mut ret = (self.BaseSign.sign_holder_commitment_and_htlcs)(self.BaseSign.this_arg, &crate::lightning::ln::chan_utils::HolderCommitmentTransaction { inner: unsafe { ObjOps::nonnull_ptr_to_inner((commitment_tx as *const _) as *mut _) }, is_owned: false });
+               let mut ret = (self.BaseSign.sign_holder_commitment_and_htlcs)(self.BaseSign.this_arg, &crate::lightning::ln::chan_utils::HolderCommitmentTransaction { inner: unsafe { ObjOps::nonnull_ptr_to_inner((commitment_tx as *const lightning::ln::chan_utils::HolderCommitmentTransaction<>) as *mut _) }, is_owned: false });
                let mut local_ret = match ret.result_ok { true => Ok( { let (mut orig_ret_0_0, mut orig_ret_0_1) = (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).to_rust(); let mut local_orig_ret_0_1 = Vec::new(); for mut item in orig_ret_0_1.into_rust().drain(..) { local_orig_ret_0_1.push( { item.into_rust() }); }; let mut local_ret_0 = (orig_ret_0_0.into_rust(), local_orig_ret_0_1); local_ret_0 }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })};
                local_ret
        }
@@ -885,27 +885,27 @@ impl lightning::chain::keysinterface::BaseSign for Sign {
                local_ret
        }
        fn sign_justice_revoked_htlc(&self, mut justice_tx: &bitcoin::blockdata::transaction::Transaction, mut input: usize, mut amount: u64, mut per_commitment_key: &bitcoin::secp256k1::key::SecretKey, mut htlc: &lightning::ln::chan_utils::HTLCOutputInCommitment, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1<bitcoin::secp256k1::All>) -> Result<bitcoin::secp256k1::Signature, ()> {
-               let mut ret = (self.BaseSign.sign_justice_revoked_htlc)(self.BaseSign.this_arg, crate::c_types::Transaction::from_bitcoin(justice_tx), input, amount, per_commitment_key.as_ref(), &crate::lightning::ln::chan_utils::HTLCOutputInCommitment { inner: unsafe { ObjOps::nonnull_ptr_to_inner((htlc as *const _) as *mut _) }, is_owned: false });
+               let mut ret = (self.BaseSign.sign_justice_revoked_htlc)(self.BaseSign.this_arg, crate::c_types::Transaction::from_bitcoin(justice_tx), input, amount, per_commitment_key.as_ref(), &crate::lightning::ln::chan_utils::HTLCOutputInCommitment { inner: unsafe { ObjOps::nonnull_ptr_to_inner((htlc as *const lightning::ln::chan_utils::HTLCOutputInCommitment<>) as *mut _) }, is_owned: false });
                let mut local_ret = match ret.result_ok { true => Ok( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).into_rust() }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })};
                local_ret
        }
        fn sign_counterparty_htlc_transaction(&self, mut htlc_tx: &bitcoin::blockdata::transaction::Transaction, mut input: usize, mut amount: u64, mut per_commitment_point: &bitcoin::secp256k1::key::PublicKey, mut htlc: &lightning::ln::chan_utils::HTLCOutputInCommitment, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1<bitcoin::secp256k1::All>) -> Result<bitcoin::secp256k1::Signature, ()> {
-               let mut ret = (self.BaseSign.sign_counterparty_htlc_transaction)(self.BaseSign.this_arg, crate::c_types::Transaction::from_bitcoin(htlc_tx), input, amount, crate::c_types::PublicKey::from_rust(&per_commitment_point), &crate::lightning::ln::chan_utils::HTLCOutputInCommitment { inner: unsafe { ObjOps::nonnull_ptr_to_inner((htlc as *const _) as *mut _) }, is_owned: false });
+               let mut ret = (self.BaseSign.sign_counterparty_htlc_transaction)(self.BaseSign.this_arg, crate::c_types::Transaction::from_bitcoin(htlc_tx), input, amount, crate::c_types::PublicKey::from_rust(&per_commitment_point), &crate::lightning::ln::chan_utils::HTLCOutputInCommitment { inner: unsafe { ObjOps::nonnull_ptr_to_inner((htlc as *const lightning::ln::chan_utils::HTLCOutputInCommitment<>) as *mut _) }, is_owned: false });
                let mut local_ret = match ret.result_ok { true => Ok( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).into_rust() }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })};
                local_ret
        }
        fn sign_closing_transaction(&self, mut closing_tx: &lightning::ln::chan_utils::ClosingTransaction, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1<bitcoin::secp256k1::All>) -> Result<bitcoin::secp256k1::Signature, ()> {
-               let mut ret = (self.BaseSign.sign_closing_transaction)(self.BaseSign.this_arg, &crate::lightning::ln::chan_utils::ClosingTransaction { inner: unsafe { ObjOps::nonnull_ptr_to_inner((closing_tx as *const _) as *mut _) }, is_owned: false });
+               let mut ret = (self.BaseSign.sign_closing_transaction)(self.BaseSign.this_arg, &crate::lightning::ln::chan_utils::ClosingTransaction { inner: unsafe { ObjOps::nonnull_ptr_to_inner((closing_tx as *const lightning::ln::chan_utils::ClosingTransaction<>) as *mut _) }, is_owned: false });
                let mut local_ret = match ret.result_ok { true => Ok( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).into_rust() }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })};
                local_ret
        }
        fn sign_channel_announcement(&self, mut msg: &lightning::ln::msgs::UnsignedChannelAnnouncement, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1<bitcoin::secp256k1::All>) -> Result<bitcoin::secp256k1::Signature, ()> {
-               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 _) as *mut _) }, is_owned: false });
+               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( { (*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 ready_channel(&mut self, mut channel_parameters: &lightning::ln::chan_utils::ChannelTransactionParameters) {
-               (self.BaseSign.ready_channel)(self.BaseSign.this_arg, &crate::lightning::ln::chan_utils::ChannelTransactionParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((channel_parameters as *const _) as *mut _) }, is_owned: false })
+               (self.BaseSign.ready_channel)(self.BaseSign.this_arg, &crate::lightning::ln::chan_utils::ChannelTransactionParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((channel_parameters as *const lightning::ln::chan_utils::ChannelTransactionParameters<>) as *mut _) }, is_owned: false })
        }
 }
 impl lightning::util::ser::Writeable for Sign {
@@ -1077,7 +1077,7 @@ impl Drop for KeysInterface {
 }
 
 use lightning::chain::keysinterface::InMemorySigner as nativeInMemorySignerImport;
-type nativeInMemorySigner = nativeInMemorySignerImport;
+pub(crate) type nativeInMemorySigner = nativeInMemorySignerImport;
 
 /// A simple implementation of Sign that just keeps the private keys in memory.
 ///
@@ -1110,7 +1110,7 @@ impl Drop for InMemorySigner {
 pub extern "C" fn InMemorySigner_free(this_obj: InMemorySigner) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn InMemorySigner_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn InMemorySigner_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeInMemorySigner); }
 }
 #[allow(unused)]
@@ -1228,7 +1228,7 @@ pub extern "C" fn InMemorySigner_new(mut funding_key: crate::c_types::SecretKey,
 #[no_mangle]
 pub extern "C" fn InMemorySigner_counterparty_pubkeys(this_arg: &InMemorySigner) -> crate::lightning::ln::chan_utils::ChannelPublicKeys {
        let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.counterparty_pubkeys();
-       crate::lightning::ln::chan_utils::ChannelPublicKeys { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const _) as *mut _) }, is_owned: false }
+       crate::lightning::ln::chan_utils::ChannelPublicKeys { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::ln::chan_utils::ChannelPublicKeys<>) as *mut _) }, is_owned: false }
 }
 
 /// The contest_delay value specified by our counterparty and applied on holder-broadcastable
@@ -1268,7 +1268,7 @@ pub extern "C" fn InMemorySigner_is_outbound(this_arg: &InMemorySigner) -> bool
 #[no_mangle]
 pub extern "C" fn InMemorySigner_funding_outpoint(this_arg: &InMemorySigner) -> crate::lightning::chain::transaction::OutPoint {
        let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.funding_outpoint();
-       crate::lightning::chain::transaction::OutPoint { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const _) as *mut _) }, is_owned: false }
+       crate::lightning::chain::transaction::OutPoint { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::chain::transaction::OutPoint<>) as *mut _) }, is_owned: false }
 }
 
 /// Obtain a ChannelTransactionParameters for this channel, to be used when verifying or
@@ -1279,7 +1279,7 @@ pub extern "C" fn InMemorySigner_funding_outpoint(this_arg: &InMemorySigner) ->
 #[no_mangle]
 pub extern "C" fn InMemorySigner_get_channel_parameters(this_arg: &InMemorySigner) -> crate::lightning::ln::chan_utils::ChannelTransactionParameters {
        let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_channel_parameters();
-       crate::lightning::ln::chan_utils::ChannelTransactionParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const _) as *mut _) }, is_owned: false }
+       crate::lightning::ln::chan_utils::ChannelTransactionParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::ln::chan_utils::ChannelTransactionParameters<>) as *mut _) }, is_owned: false }
 }
 
 /// Sign the single input of spend_tx at index `input_idx` which spends the output
@@ -1364,7 +1364,7 @@ extern "C" fn InMemorySigner_BaseSign_validate_holder_commitment(this_arg: *cons
 #[must_use]
 extern "C" fn InMemorySigner_BaseSign_pubkeys(this_arg: *const c_void) -> crate::lightning::ln::chan_utils::ChannelPublicKeys {
        let mut ret = <nativeInMemorySigner as lightning::chain::keysinterface::BaseSign<>>::pubkeys(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, );
-       crate::lightning::ln::chan_utils::ChannelPublicKeys { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const _) as *mut _) }, is_owned: false }
+       crate::lightning::ln::chan_utils::ChannelPublicKeys { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::ln::chan_utils::ChannelPublicKeys<>) as *mut _) }, is_owned: false }
 }
 extern "C" fn InMemorySigner_BaseSign_set_pubkeys(trait_self_arg: &BaseSign) {
        // This is a bit race-y in the general case, but for our specific use-cases today, we're safe
@@ -1497,7 +1497,7 @@ pub extern "C" fn InMemorySigner_read(ser: crate::c_types::u8slice) -> crate::c_
 }
 
 use lightning::chain::keysinterface::KeysManager as nativeKeysManagerImport;
-type nativeKeysManager = nativeKeysManagerImport;
+pub(crate) type nativeKeysManager = nativeKeysManagerImport;
 
 /// Simple KeysInterface implementor that takes a 32-byte seed for use as a BIP 32 extended key
 /// and derives keys from that.
@@ -1533,7 +1533,7 @@ impl Drop for KeysManager {
 pub extern "C" fn KeysManager_free(this_obj: KeysManager) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn KeysManager_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn KeysManager_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeKeysManager); }
 }
 #[allow(unused)]
index bfed80c0bd2011057a772fd1850fb10f33b401cb..33bc264576fe609a0980ecc95f5c5f61e63dd550 100644 (file)
@@ -39,7 +39,7 @@ use crate::c_types::*;
 }
 
 use lightning::chain::BestBlock as nativeBestBlockImport;
-type nativeBestBlock = nativeBestBlockImport;
+pub(crate) type nativeBestBlock = nativeBestBlockImport;
 
 /// The best known block as identified by its hash and height.
 #[must_use]
@@ -69,7 +69,7 @@ impl Drop for BestBlock {
 pub extern "C" fn BestBlock_free(this_obj: BestBlock) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn BestBlock_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn BestBlock_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeBestBlock); }
 }
 #[allow(unused)]
@@ -458,9 +458,10 @@ pub enum ChannelMonitorUpdateErr {
        /// our state failed, but is expected to succeed at some point in the future).
        ///
        /// Such a failure will \"freeze\" a channel, preventing us from revoking old states or
-       /// submitting new commitment transactions to the counterparty. Once the update(s) which failed
-       /// have been successfully applied, ChannelManager::channel_monitor_updated can be used to
-       /// restore the channel to an operational state.
+       /// 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
@@ -474,13 +475,14 @@ pub enum ChannelMonitorUpdateErr {
        /// the channel which would invalidate previous ChannelMonitors are not made when a channel has
        /// been \"frozen\".
        ///
-       /// Note that even if updates made after TemporaryFailure succeed you must still call
-       /// channel_monitor_updated to ensure you have the latest monitor and re-enable normal channel
-       /// operation.
+       /// Note that 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 call
-       /// ChannelManager::channel_monitor_updated, so you must store the update itself along
-       /// with the persisted ChannelMonitor on your own local disk prior to returning a
+       /// 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.
@@ -488,6 +490,8 @@ pub enum ChannelMonitorUpdateErr {
        /// 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.
+       ///
+       /// [`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
@@ -603,6 +607,13 @@ pub struct Watch {
        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,
        /// Returns any monitor events since the last call. Subsequent calls must only return new
        /// events.
+       ///
+       /// Note that after any block- or transaction-connection calls to a [`ChannelMonitor`], no
+       /// further events may be returned here until the [`ChannelMonitor`] has been fully persisted
+       /// to disk.
+       ///
+       /// For details on asynchronous [`ChannelMonitor`] updating and returning
+       /// [`MonitorEvent::UpdateCompleted`] here, see [`ChannelMonitorUpdateErr::TemporaryFailure`].
        #[must_use]
        pub release_pending_monitor_events: extern "C" fn (this_arg: *const c_void) -> crate::c_types::derived::CVec_MonitorEventZ,
        /// Frees any resources associated with this object given its this_arg pointer.
@@ -746,7 +757,7 @@ impl Drop for Filter {
 }
 
 use lightning::chain::WatchedOutput as nativeWatchedOutputImport;
-type nativeWatchedOutput = nativeWatchedOutputImport;
+pub(crate) type nativeWatchedOutput = nativeWatchedOutputImport;
 
 /// A transaction output watched by a [`ChannelMonitor`] for spends on-chain.
 ///
@@ -786,7 +797,7 @@ impl Drop for WatchedOutput {
 pub extern "C" fn WatchedOutput_free(this_obj: WatchedOutput) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn WatchedOutput_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn WatchedOutput_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeWatchedOutput); }
 }
 #[allow(unused)]
@@ -826,7 +837,7 @@ pub extern "C" fn WatchedOutput_set_block_hash(this_ptr: &mut WatchedOutput, mut
 #[no_mangle]
 pub extern "C" fn WatchedOutput_get_outpoint(this_ptr: &WatchedOutput) -> crate::lightning::chain::transaction::OutPoint {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().outpoint;
-       crate::lightning::chain::transaction::OutPoint { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const _) as *mut _) }, is_owned: false }
+       crate::lightning::chain::transaction::OutPoint { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::chain::transaction::OutPoint<>) as *mut _) }, is_owned: false }
 }
 /// Outpoint identifying the transaction output.
 #[no_mangle]
index 6971d5e80e0eea57e339d3b5b3f6bf602ebd565f..bc59dd0866c54703764161ed0ed39706b362c59d 100644 (file)
@@ -16,7 +16,7 @@ use crate::c_types::*;
 
 
 use lightning::chain::transaction::OutPoint as nativeOutPointImport;
-type nativeOutPoint = nativeOutPointImport;
+pub(crate) type nativeOutPoint = nativeOutPointImport;
 
 /// A reference to a transaction output.
 ///
@@ -49,7 +49,7 @@ impl Drop for OutPoint {
 pub extern "C" fn OutPoint_free(this_obj: OutPoint) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn OutPoint_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn OutPoint_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeOutPoint); }
 }
 #[allow(unused)]
index daaede48ea294b4b8c7233c45315a72a17a67b13..8228a8a5492832b3ee31289b25ea35850881fbc4 100644 (file)
@@ -90,7 +90,7 @@ pub extern "C" fn derive_public_revocation_key(mut per_commitment_point: crate::
 
 
 use lightning::ln::chan_utils::TxCreationKeys as nativeTxCreationKeysImport;
-type nativeTxCreationKeys = nativeTxCreationKeysImport;
+pub(crate) type nativeTxCreationKeys = nativeTxCreationKeysImport;
 
 /// The set of public keys which are used in the creation of one commitment transaction.
 /// These are derived from the channel base keys and per-commitment data.
@@ -130,7 +130,7 @@ impl Drop for TxCreationKeys {
 pub extern "C" fn TxCreationKeys_free(this_obj: TxCreationKeys) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn TxCreationKeys_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn TxCreationKeys_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeTxCreationKeys); }
 }
 #[allow(unused)]
@@ -257,7 +257,7 @@ pub extern "C" fn TxCreationKeys_read(ser: crate::c_types::u8slice) -> crate::c_
 }
 
 use lightning::ln::chan_utils::ChannelPublicKeys as nativeChannelPublicKeysImport;
-type nativeChannelPublicKeys = nativeChannelPublicKeysImport;
+pub(crate) type nativeChannelPublicKeys = nativeChannelPublicKeysImport;
 
 /// One counterparty's public keys which do not change over the life of a channel.
 #[must_use]
@@ -287,7 +287,7 @@ impl Drop for ChannelPublicKeys {
 pub extern "C" fn ChannelPublicKeys_free(this_obj: ChannelPublicKeys) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn ChannelPublicKeys_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn ChannelPublicKeys_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelPublicKeys); }
 }
 #[allow(unused)]
@@ -461,7 +461,7 @@ pub extern "C" fn get_revokeable_redeemscript(mut revocation_key: crate::c_types
 
 
 use lightning::ln::chan_utils::HTLCOutputInCommitment as nativeHTLCOutputInCommitmentImport;
-type nativeHTLCOutputInCommitment = nativeHTLCOutputInCommitmentImport;
+pub(crate) type nativeHTLCOutputInCommitment = nativeHTLCOutputInCommitmentImport;
 
 /// Information about an HTLC as it appears in a commitment transaction
 #[must_use]
@@ -491,7 +491,7 @@ impl Drop for HTLCOutputInCommitment {
 pub extern "C" fn HTLCOutputInCommitment_free(this_obj: HTLCOutputInCommitment) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn HTLCOutputInCommitment_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn HTLCOutputInCommitment_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeHTLCOutputInCommitment); }
 }
 #[allow(unused)]
@@ -658,7 +658,7 @@ pub extern "C" fn build_htlc_transaction(commitment_txid: *const [u8; 32], mut f
 
 
 use lightning::ln::chan_utils::ChannelTransactionParameters as nativeChannelTransactionParametersImport;
-type nativeChannelTransactionParameters = nativeChannelTransactionParametersImport;
+pub(crate) type nativeChannelTransactionParameters = nativeChannelTransactionParametersImport;
 
 /// Per-channel data used to build transactions in conjunction with the per-commitment data (CommitmentTransaction).
 /// The fields are organized by holder/counterparty.
@@ -692,7 +692,7 @@ impl Drop for ChannelTransactionParameters {
 pub extern "C" fn ChannelTransactionParameters_free(this_obj: ChannelTransactionParameters) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn ChannelTransactionParameters_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn ChannelTransactionParameters_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelTransactionParameters); }
 }
 #[allow(unused)]
@@ -715,7 +715,7 @@ impl ChannelTransactionParameters {
 #[no_mangle]
 pub extern "C" fn ChannelTransactionParameters_get_holder_pubkeys(this_ptr: &ChannelTransactionParameters) -> crate::lightning::ln::chan_utils::ChannelPublicKeys {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().holder_pubkeys;
-       crate::lightning::ln::chan_utils::ChannelPublicKeys { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const _) as *mut _) }, is_owned: false }
+       crate::lightning::ln::chan_utils::ChannelPublicKeys { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::chan_utils::ChannelPublicKeys<>) as *mut _) }, is_owned: false }
 }
 /// Holder public keys
 #[no_mangle]
@@ -753,7 +753,7 @@ pub extern "C" fn ChannelTransactionParameters_set_is_outbound_from_holder(this_
 #[no_mangle]
 pub extern "C" fn ChannelTransactionParameters_get_counterparty_parameters(this_ptr: &ChannelTransactionParameters) -> crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().counterparty_parameters;
-       let mut local_inner_val = crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters { inner: unsafe { (if inner_val.is_none() { std::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const _) as *mut _ }, is_owned: false };
+       let mut local_inner_val = crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters { inner: unsafe { (if inner_val.is_none() { std::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::ln::chan_utils::CounterpartyChannelTransactionParameters<>) as *mut _ }, is_owned: false };
        local_inner_val
 }
 /// The late-bound counterparty channel transaction parameters.
@@ -771,7 +771,7 @@ pub extern "C" fn ChannelTransactionParameters_set_counterparty_parameters(this_
 #[no_mangle]
 pub extern "C" fn ChannelTransactionParameters_get_funding_outpoint(this_ptr: &ChannelTransactionParameters) -> crate::lightning::chain::transaction::OutPoint {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().funding_outpoint;
-       let mut local_inner_val = crate::lightning::chain::transaction::OutPoint { inner: unsafe { (if inner_val.is_none() { std::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const _) as *mut _ }, is_owned: false };
+       let mut local_inner_val = crate::lightning::chain::transaction::OutPoint { inner: unsafe { (if inner_val.is_none() { std::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::chain::transaction::OutPoint<>) as *mut _ }, is_owned: false };
        local_inner_val
 }
 /// The late-bound funding outpoint
@@ -817,7 +817,7 @@ pub extern "C" fn ChannelTransactionParameters_clone(orig: &ChannelTransactionPa
 }
 
 use lightning::ln::chan_utils::CounterpartyChannelTransactionParameters as nativeCounterpartyChannelTransactionParametersImport;
-type nativeCounterpartyChannelTransactionParameters = nativeCounterpartyChannelTransactionParametersImport;
+pub(crate) type nativeCounterpartyChannelTransactionParameters = nativeCounterpartyChannelTransactionParametersImport;
 
 /// Late-bound per-channel counterparty data used to build transactions.
 #[must_use]
@@ -847,7 +847,7 @@ impl Drop for CounterpartyChannelTransactionParameters {
 pub extern "C" fn CounterpartyChannelTransactionParameters_free(this_obj: CounterpartyChannelTransactionParameters) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn CounterpartyChannelTransactionParameters_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn CounterpartyChannelTransactionParameters_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeCounterpartyChannelTransactionParameters); }
 }
 #[allow(unused)]
@@ -870,7 +870,7 @@ impl CounterpartyChannelTransactionParameters {
 #[no_mangle]
 pub extern "C" fn CounterpartyChannelTransactionParameters_get_pubkeys(this_ptr: &CounterpartyChannelTransactionParameters) -> crate::lightning::ln::chan_utils::ChannelPublicKeys {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().pubkeys;
-       crate::lightning::ln::chan_utils::ChannelPublicKeys { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const _) as *mut _) }, is_owned: false }
+       crate::lightning::ln::chan_utils::ChannelPublicKeys { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::chan_utils::ChannelPublicKeys<>) as *mut _) }, is_owned: false }
 }
 /// Counter-party public keys
 #[no_mangle]
@@ -980,7 +980,7 @@ pub extern "C" fn ChannelTransactionParameters_read(ser: crate::c_types::u8slice
 }
 
 use lightning::ln::chan_utils::DirectedChannelTransactionParameters as nativeDirectedChannelTransactionParametersImport;
-type nativeDirectedChannelTransactionParameters = nativeDirectedChannelTransactionParametersImport<'static>;
+pub(crate) type nativeDirectedChannelTransactionParameters = nativeDirectedChannelTransactionParametersImport<'static>;
 
 /// Static channel fields used to build transactions given per-commitment fields, organized by
 /// broadcaster/countersignatory.
@@ -1014,7 +1014,7 @@ impl Drop for DirectedChannelTransactionParameters {
 pub extern "C" fn DirectedChannelTransactionParameters_free(this_obj: DirectedChannelTransactionParameters) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn DirectedChannelTransactionParameters_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn DirectedChannelTransactionParameters_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeDirectedChannelTransactionParameters); }
 }
 #[allow(unused)]
@@ -1038,7 +1038,7 @@ impl DirectedChannelTransactionParameters {
 #[no_mangle]
 pub extern "C" fn DirectedChannelTransactionParameters_broadcaster_pubkeys(this_arg: &DirectedChannelTransactionParameters) -> crate::lightning::ln::chan_utils::ChannelPublicKeys {
        let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.broadcaster_pubkeys();
-       crate::lightning::ln::chan_utils::ChannelPublicKeys { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const _) as *mut _) }, is_owned: false }
+       crate::lightning::ln::chan_utils::ChannelPublicKeys { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::ln::chan_utils::ChannelPublicKeys<>) as *mut _) }, is_owned: false }
 }
 
 /// Get the channel pubkeys for the countersignatory
@@ -1046,7 +1046,7 @@ pub extern "C" fn DirectedChannelTransactionParameters_broadcaster_pubkeys(this_
 #[no_mangle]
 pub extern "C" fn DirectedChannelTransactionParameters_countersignatory_pubkeys(this_arg: &DirectedChannelTransactionParameters) -> crate::lightning::ln::chan_utils::ChannelPublicKeys {
        let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.countersignatory_pubkeys();
-       crate::lightning::ln::chan_utils::ChannelPublicKeys { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const _) as *mut _) }, is_owned: false }
+       crate::lightning::ln::chan_utils::ChannelPublicKeys { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::ln::chan_utils::ChannelPublicKeys<>) as *mut _) }, is_owned: false }
 }
 
 /// Get the contest delay applicable to the transactions.
@@ -1079,7 +1079,7 @@ pub extern "C" fn DirectedChannelTransactionParameters_funding_outpoint(this_arg
 
 
 use lightning::ln::chan_utils::HolderCommitmentTransaction as nativeHolderCommitmentTransactionImport;
-type nativeHolderCommitmentTransaction = nativeHolderCommitmentTransactionImport;
+pub(crate) type nativeHolderCommitmentTransaction = nativeHolderCommitmentTransactionImport;
 
 /// Information needed to build and sign a holder's commitment transaction.
 ///
@@ -1111,7 +1111,7 @@ impl Drop for HolderCommitmentTransaction {
 pub extern "C" fn HolderCommitmentTransaction_free(this_obj: HolderCommitmentTransaction) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn HolderCommitmentTransaction_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn HolderCommitmentTransaction_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeHolderCommitmentTransaction); }
 }
 #[allow(unused)]
@@ -1194,7 +1194,7 @@ pub extern "C" fn HolderCommitmentTransaction_new(mut commitment_tx: crate::ligh
 
 
 use lightning::ln::chan_utils::BuiltCommitmentTransaction as nativeBuiltCommitmentTransactionImport;
-type nativeBuiltCommitmentTransaction = nativeBuiltCommitmentTransactionImport;
+pub(crate) type nativeBuiltCommitmentTransaction = nativeBuiltCommitmentTransactionImport;
 
 /// A pre-built Bitcoin commitment transaction and its txid.
 #[must_use]
@@ -1224,7 +1224,7 @@ impl Drop for BuiltCommitmentTransaction {
 pub extern "C" fn BuiltCommitmentTransaction_free(this_obj: BuiltCommitmentTransaction) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn BuiltCommitmentTransaction_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn BuiltCommitmentTransaction_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeBuiltCommitmentTransaction); }
 }
 #[allow(unused)]
@@ -1336,7 +1336,7 @@ pub extern "C" fn BuiltCommitmentTransaction_sign(this_arg: &BuiltCommitmentTran
 
 
 use lightning::ln::chan_utils::ClosingTransaction as nativeClosingTransactionImport;
-type nativeClosingTransaction = nativeClosingTransactionImport;
+pub(crate) type nativeClosingTransaction = nativeClosingTransactionImport;
 
 /// This class tracks the per-transaction information needed to build a closing transaction and will
 /// actually build it and sign.
@@ -1370,7 +1370,7 @@ impl Drop for ClosingTransaction {
 pub extern "C" fn ClosingTransaction_free(this_obj: ClosingTransaction) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn ClosingTransaction_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn ClosingTransaction_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeClosingTransaction); }
 }
 #[allow(unused)]
@@ -1458,7 +1458,7 @@ pub extern "C" fn ClosingTransaction_to_counterparty_script(this_arg: &ClosingTr
 
 
 use lightning::ln::chan_utils::TrustedClosingTransaction as nativeTrustedClosingTransactionImport;
-type nativeTrustedClosingTransaction = nativeTrustedClosingTransactionImport<'static>;
+pub(crate) type nativeTrustedClosingTransaction = nativeTrustedClosingTransactionImport<'static>;
 
 /// A wrapper on ClosingTransaction indicating that the built bitcoin
 /// transaction is trusted.
@@ -1493,7 +1493,7 @@ impl Drop for TrustedClosingTransaction {
 pub extern "C" fn TrustedClosingTransaction_free(this_obj: TrustedClosingTransaction) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn TrustedClosingTransaction_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn TrustedClosingTransaction_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeTrustedClosingTransaction); }
 }
 #[allow(unused)]
@@ -1541,7 +1541,7 @@ pub extern "C" fn TrustedClosingTransaction_sign(this_arg: &TrustedClosingTransa
 
 
 use lightning::ln::chan_utils::CommitmentTransaction as nativeCommitmentTransactionImport;
-type nativeCommitmentTransaction = nativeCommitmentTransactionImport;
+pub(crate) type nativeCommitmentTransaction = nativeCommitmentTransactionImport;
 
 /// This class tracks the per-transaction information needed to build a commitment transaction and will
 /// actually build it and sign.  It is used for holder transactions that we sign only when needed
@@ -1576,7 +1576,7 @@ impl Drop for CommitmentTransaction {
 pub extern "C" fn CommitmentTransaction_free(this_obj: CommitmentTransaction) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn CommitmentTransaction_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn CommitmentTransaction_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeCommitmentTransaction); }
 }
 #[allow(unused)]
@@ -1691,7 +1691,7 @@ pub extern "C" fn CommitmentTransaction_verify(this_arg: &CommitmentTransaction,
 
 
 use lightning::ln::chan_utils::TrustedCommitmentTransaction as nativeTrustedCommitmentTransactionImport;
-type nativeTrustedCommitmentTransaction = nativeTrustedCommitmentTransactionImport<'static>;
+pub(crate) type nativeTrustedCommitmentTransaction = nativeTrustedCommitmentTransactionImport<'static>;
 
 /// A wrapper on CommitmentTransaction indicating that the derived fields (the built bitcoin
 /// transaction and the transaction creation keys) are trusted.
@@ -1726,7 +1726,7 @@ impl Drop for TrustedCommitmentTransaction {
 pub extern "C" fn TrustedCommitmentTransaction_free(this_obj: TrustedCommitmentTransaction) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn TrustedCommitmentTransaction_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn TrustedCommitmentTransaction_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeTrustedCommitmentTransaction); }
 }
 #[allow(unused)]
@@ -1758,7 +1758,7 @@ pub extern "C" fn TrustedCommitmentTransaction_txid(this_arg: &TrustedCommitment
 #[no_mangle]
 pub extern "C" fn TrustedCommitmentTransaction_built_transaction(this_arg: &TrustedCommitmentTransaction) -> crate::lightning::ln::chan_utils::BuiltCommitmentTransaction {
        let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.built_transaction();
-       crate::lightning::ln::chan_utils::BuiltCommitmentTransaction { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const _) as *mut _) }, is_owned: false }
+       crate::lightning::ln::chan_utils::BuiltCommitmentTransaction { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::ln::chan_utils::BuiltCommitmentTransaction<>) as *mut _) }, is_owned: false }
 }
 
 /// The pre-calculated transaction creation public keys.
@@ -1766,7 +1766,7 @@ pub extern "C" fn TrustedCommitmentTransaction_built_transaction(this_arg: &Trus
 #[no_mangle]
 pub extern "C" fn TrustedCommitmentTransaction_keys(this_arg: &TrustedCommitmentTransaction) -> crate::lightning::ln::chan_utils::TxCreationKeys {
        let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.keys();
-       crate::lightning::ln::chan_utils::TxCreationKeys { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const _) as *mut _) }, is_owned: false }
+       crate::lightning::ln::chan_utils::TxCreationKeys { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::ln::chan_utils::TxCreationKeys<>) as *mut _) }, is_owned: false }
 }
 
 /// Get a signature for each HTLC which was included in the commitment transaction (ie for
index 871d9e523902ea46a203f9eeefad3c4884237969..3141dd484bb73fcdb627b1b240f7cef576264752 100644 (file)
@@ -24,113 +24,8 @@ use bitcoin::hashes::Hash;
 use crate::c_types::*;
 
 
-use lightning::ln::channelmanager::PaymentId as nativePaymentIdImport;
-type nativePaymentId = nativePaymentIdImport;
-
-/// A payment identifier used to uniquely identify a payment to LDK.
-#[must_use]
-#[repr(C)]
-pub struct PaymentId {
-       /// 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 nativePaymentId,
-       /// Indicates that this is the only struct which contains the same pointer.
-
-       /// Rust functions which take ownership of an object provided via an argument require
-       /// this to be true and invalidate the object pointed to by inner.
-       pub is_owned: bool,
-}
-
-impl Drop for PaymentId {
-       fn drop(&mut self) {
-               if self.is_owned && !<*mut nativePaymentId>::is_null(self.inner) {
-                       let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
-               }
-       }
-}
-/// Frees any resources used by the PaymentId, if is_owned is set and inner is non-NULL.
-#[no_mangle]
-pub extern "C" fn PaymentId_free(this_obj: PaymentId) { }
-#[allow(unused)]
-/// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn PaymentId_free_void(this_ptr: *mut c_void) {
-       unsafe { let _ = Box::from_raw(this_ptr as *mut nativePaymentId); }
-}
-#[allow(unused)]
-impl PaymentId {
-       pub(crate) fn get_native_ref(&self) -> &'static nativePaymentId {
-               unsafe { &*ObjOps::untweak_ptr(self.inner) }
-       }
-       pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativePaymentId {
-               unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
-       }
-       /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
-       pub(crate) fn take_inner(mut self) -> *mut nativePaymentId {
-               assert!(self.is_owned);
-               let ret = ObjOps::untweak_ptr(self.inner);
-               self.inner = std::ptr::null_mut();
-               ret
-       }
-}
-/// Checks if two PaymentIds contain equal inner contents.
-#[no_mangle]
-pub extern "C" fn PaymentId_hash(o: &PaymentId) -> u64 {
-       if o.inner.is_null() { return 0; }
-       // Note that we'd love to use std::collections::hash_map::DefaultHasher but it's not in core
-       #[allow(deprecated)]
-       let mut hasher = core::hash::SipHasher::new();
-       std::hash::Hash::hash(o.get_native_ref(), &mut hasher);
-       std::hash::Hasher::finish(&hasher)
-}
-impl Clone for PaymentId {
-       fn clone(&self) -> Self {
-               Self {
-                       inner: if <*mut nativePaymentId>::is_null(self.inner) { std::ptr::null_mut() } else {
-                               ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
-                       is_owned: true,
-               }
-       }
-}
-#[allow(unused)]
-/// Used only if an object of this type is returned as a trait impl by a method
-pub(crate) extern "C" fn PaymentId_clone_void(this_ptr: *const c_void) -> *mut c_void {
-       Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativePaymentId)).clone() })) as *mut c_void
-}
-#[no_mangle]
-/// Creates a copy of the PaymentId
-pub extern "C" fn PaymentId_clone(orig: &PaymentId) -> PaymentId {
-       orig.clone()
-}
-/// Checks if two PaymentIds 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 PaymentId_eq(a: &PaymentId, b: &PaymentId) -> 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 PaymentId object into a byte array which can be read by PaymentId_read
-pub extern "C" fn PaymentId_write(obj: &PaymentId) -> crate::c_types::derived::CVec_u8Z {
-       crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
-}
-#[no_mangle]
-pub(crate) extern "C" fn PaymentId_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
-       crate::c_types::serialize_obj(unsafe { &*(obj as *const nativePaymentId) })
-}
-#[no_mangle]
-/// Read a PaymentId from a byte array, created by PaymentId_write
-pub extern "C" fn PaymentId_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_PaymentIdDecodeErrorZ {
-       let res = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::channelmanager::PaymentId { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
-       local_res
-}
-
 use lightning::ln::channelmanager::ChannelManager as nativeChannelManagerImport;
-type nativeChannelManager = nativeChannelManagerImport<crate::lightning::chain::keysinterface::Sign, crate::lightning::chain::Watch, crate::lightning::chain::chaininterface::BroadcasterInterface, crate::lightning::chain::keysinterface::KeysInterface, crate::lightning::chain::chaininterface::FeeEstimator, crate::lightning::util::logger::Logger>;
+pub(crate) type nativeChannelManager = nativeChannelManagerImport<crate::lightning::chain::keysinterface::Sign, crate::lightning::chain::Watch, crate::lightning::chain::chaininterface::BroadcasterInterface, crate::lightning::chain::keysinterface::KeysInterface, crate::lightning::chain::chaininterface::FeeEstimator, crate::lightning::util::logger::Logger>;
 
 /// Manager which keeps track of a number of channels and sends messages to the appropriate
 /// channel, also tracking HTLC preimages and forwarding onion packets appropriately.
@@ -195,7 +90,7 @@ impl Drop for ChannelManager {
 pub extern "C" fn ChannelManager_free(this_obj: ChannelManager) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn ChannelManager_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn ChannelManager_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelManager); }
 }
 #[allow(unused)]
@@ -216,7 +111,7 @@ impl ChannelManager {
 }
 
 use lightning::ln::channelmanager::ChainParameters as nativeChainParametersImport;
-type nativeChainParameters = nativeChainParametersImport;
+pub(crate) type nativeChainParameters = nativeChainParametersImport;
 
 /// Chain-related parameters used to construct a new `ChannelManager`.
 ///
@@ -250,7 +145,7 @@ impl Drop for ChainParameters {
 pub extern "C" fn ChainParameters_free(this_obj: ChainParameters) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn ChainParameters_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn ChainParameters_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChainParameters); }
 }
 #[allow(unused)]
@@ -286,7 +181,7 @@ pub extern "C" fn ChainParameters_set_network(this_ptr: &mut ChainParameters, mu
 #[no_mangle]
 pub extern "C" fn ChainParameters_get_best_block(this_ptr: &ChainParameters) -> crate::lightning::chain::BestBlock {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().best_block;
-       crate::lightning::chain::BestBlock { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const _) as *mut _) }, is_owned: false }
+       crate::lightning::chain::BestBlock { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::chain::BestBlock<>) as *mut _) }, is_owned: false }
 }
 /// The hash and height of the latest block successfully connected.
 ///
@@ -349,7 +244,7 @@ pub static MIN_CLTV_EXPIRY_DELTA: u16 = lightning::ln::channelmanager::MIN_CLTV_
 pub static MIN_FINAL_CLTV_EXPIRY: u32 = lightning::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY;
 
 use lightning::ln::channelmanager::CounterpartyForwardingInfo as nativeCounterpartyForwardingInfoImport;
-type nativeCounterpartyForwardingInfo = nativeCounterpartyForwardingInfoImport;
+pub(crate) type nativeCounterpartyForwardingInfo = nativeCounterpartyForwardingInfoImport;
 
 /// Information needed for constructing an invoice route hint for this channel.
 #[must_use]
@@ -379,7 +274,7 @@ impl Drop for CounterpartyForwardingInfo {
 pub extern "C" fn CounterpartyForwardingInfo_free(this_obj: CounterpartyForwardingInfo) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn CounterpartyForwardingInfo_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn CounterpartyForwardingInfo_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeCounterpartyForwardingInfo); }
 }
 #[allow(unused)]
@@ -466,7 +361,7 @@ pub extern "C" fn CounterpartyForwardingInfo_clone(orig: &CounterpartyForwarding
 }
 
 use lightning::ln::channelmanager::ChannelCounterparty as nativeChannelCounterpartyImport;
-type nativeChannelCounterparty = nativeChannelCounterpartyImport;
+pub(crate) type nativeChannelCounterparty = nativeChannelCounterpartyImport;
 
 /// Channel parameters which apply to our counterparty. These are split out from [`ChannelDetails`]
 /// to better separate parameters.
@@ -497,7 +392,7 @@ impl Drop for ChannelCounterparty {
 pub extern "C" fn ChannelCounterparty_free(this_obj: ChannelCounterparty) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn ChannelCounterparty_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn ChannelCounterparty_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelCounterparty); }
 }
 #[allow(unused)]
@@ -533,7 +428,7 @@ pub extern "C" fn ChannelCounterparty_set_node_id(this_ptr: &mut ChannelCounterp
 #[no_mangle]
 pub extern "C" fn ChannelCounterparty_get_features(this_ptr: &ChannelCounterparty) -> crate::lightning::ln::features::InitFeatures {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().features;
-       crate::lightning::ln::features::InitFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const _) as *mut _) }, is_owned: false }
+       crate::lightning::ln::features::InitFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::features::InitFeatures<>) as *mut _) }, is_owned: false }
 }
 /// The Features the channel counterparty provided upon last connection.
 /// Useful for routing as it is the most up-to-date copy of the counterparty's features and
@@ -572,7 +467,7 @@ pub extern "C" fn ChannelCounterparty_set_unspendable_punishment_reserve(this_pt
 #[no_mangle]
 pub extern "C" fn ChannelCounterparty_get_forwarding_info(this_ptr: &ChannelCounterparty) -> crate::lightning::ln::channelmanager::CounterpartyForwardingInfo {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().forwarding_info;
-       let mut local_inner_val = crate::lightning::ln::channelmanager::CounterpartyForwardingInfo { inner: unsafe { (if inner_val.is_none() { std::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const _) as *mut _ }, is_owned: false };
+       let mut local_inner_val = crate::lightning::ln::channelmanager::CounterpartyForwardingInfo { inner: unsafe { (if inner_val.is_none() { std::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::ln::channelmanager::CounterpartyForwardingInfo<>) as *mut _ }, is_owned: false };
        local_inner_val
 }
 /// Information on the fees and requirements that the counterparty requires when forwarding
@@ -617,7 +512,7 @@ pub extern "C" fn ChannelCounterparty_clone(orig: &ChannelCounterparty) -> Chann
 }
 
 use lightning::ln::channelmanager::ChannelDetails as nativeChannelDetailsImport;
-type nativeChannelDetails = nativeChannelDetailsImport;
+pub(crate) type nativeChannelDetails = nativeChannelDetailsImport;
 
 /// Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels
 #[must_use]
@@ -647,7 +542,7 @@ impl Drop for ChannelDetails {
 pub extern "C" fn ChannelDetails_free(this_obj: ChannelDetails) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn ChannelDetails_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn ChannelDetails_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelDetails); }
 }
 #[allow(unused)]
@@ -687,7 +582,7 @@ pub extern "C" fn ChannelDetails_set_channel_id(this_ptr: &mut ChannelDetails, m
 #[no_mangle]
 pub extern "C" fn ChannelDetails_get_counterparty(this_ptr: &ChannelDetails) -> crate::lightning::ln::channelmanager::ChannelCounterparty {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().counterparty;
-       crate::lightning::ln::channelmanager::ChannelCounterparty { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const _) as *mut _) }, is_owned: false }
+       crate::lightning::ln::channelmanager::ChannelCounterparty { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::channelmanager::ChannelCounterparty<>) as *mut _) }, is_owned: false }
 }
 /// Parameters which apply to our counterparty. See individual fields for more information.
 #[no_mangle]
@@ -704,7 +599,7 @@ pub extern "C" fn ChannelDetails_set_counterparty(this_ptr: &mut ChannelDetails,
 #[no_mangle]
 pub extern "C" fn ChannelDetails_get_funding_txo(this_ptr: &ChannelDetails) -> crate::lightning::chain::transaction::OutPoint {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().funding_txo;
-       let mut local_inner_val = crate::lightning::chain::transaction::OutPoint { inner: unsafe { (if inner_val.is_none() { std::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const _) as *mut _ }, is_owned: false };
+       let mut local_inner_val = crate::lightning::chain::transaction::OutPoint { inner: unsafe { (if inner_val.is_none() { std::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::chain::transaction::OutPoint<>) as *mut _ }, is_owned: false };
        local_inner_val
 }
 /// The Channel's funding transaction output, if we've negotiated the funding transaction with
@@ -1038,7 +933,18 @@ pub enum PaymentSendFailure {
        /// 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.
-       PartialFailure(crate::c_types::derived::CVec_CResult_NoneAPIErrorZZ),
+       PartialFailure {
+               /// The errors themselves, in the same order as the route hops.
+               results: crate::c_types::derived::CVec_CResult_NoneAPIErrorZZ,
+               /// If some paths failed without irrevocably committing to the new HTLC(s), this will
+               /// contain a [`RouteParameters`] object which can be used to calculate a new route that
+               /// will pay all remaining unpaid balance.
+               ///
+               /// Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
+               failed_paths_retry: crate::lightning::routing::router::RouteParameters,
+               /// The payment id for the payment, which is now at least partially pending.
+               payment_id: crate::c_types::ThirtyTwoBytes,
+       },
 }
 use lightning::ln::channelmanager::PaymentSendFailure as nativePaymentSendFailure;
 impl PaymentSendFailure {
@@ -1065,12 +971,17 @@ impl PaymentSendFailure {
                                        local_a_nonref,
                                )
                        },
-                       PaymentSendFailure::PartialFailure (ref a, ) => {
-                               let mut a_nonref = (*a).clone();
-                               let mut local_a_nonref = Vec::new(); for mut item in a_nonref.into_rust().drain(..) { local_a_nonref.push( { let mut local_a_nonref_0 = match item.result_ok { true => Ok( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut item.contents.result)) })*/ }), false => Err( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut item.contents.err)) }).into_native() })}; local_a_nonref_0 }); };
-                               nativePaymentSendFailure::PartialFailure (
-                                       local_a_nonref,
-                               )
+                       PaymentSendFailure::PartialFailure {ref results, ref failed_paths_retry, ref payment_id, } => {
+                               let mut results_nonref = (*results).clone();
+                               let mut local_results_nonref = Vec::new(); for mut item in results_nonref.into_rust().drain(..) { local_results_nonref.push( { let mut local_results_nonref_0 = match item.result_ok { true => Ok( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut item.contents.result)) })*/ }), false => Err( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut item.contents.err)) }).into_native() })}; local_results_nonref_0 }); };
+                               let mut failed_paths_retry_nonref = (*failed_paths_retry).clone();
+                               let mut local_failed_paths_retry_nonref = if failed_paths_retry_nonref.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(failed_paths_retry_nonref.take_inner()) } }) };
+                               let mut payment_id_nonref = (*payment_id).clone();
+                               nativePaymentSendFailure::PartialFailure {
+                                       results: local_results_nonref,
+                                       failed_paths_retry: local_failed_paths_retry_nonref,
+                                       payment_id: ::lightning::ln::channelmanager::PaymentId(payment_id_nonref.data),
+                               }
                        },
                }
        }
@@ -1094,11 +1005,14 @@ impl PaymentSendFailure {
                                        local_a,
                                )
                        },
-                       PaymentSendFailure::PartialFailure (mut a, ) => {
-                               let mut local_a = Vec::new(); for mut item in a.into_rust().drain(..) { local_a.push( { let mut local_a_0 = match item.result_ok { true => Ok( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut item.contents.result)) })*/ }), false => Err( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut item.contents.err)) }).into_native() })}; local_a_0 }); };
-                               nativePaymentSendFailure::PartialFailure (
-                                       local_a,
-                               )
+                       PaymentSendFailure::PartialFailure {mut results, mut failed_paths_retry, mut payment_id, } => {
+                               let mut local_results = Vec::new(); for mut item in results.into_rust().drain(..) { local_results.push( { let mut local_results_0 = match item.result_ok { true => Ok( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut item.contents.result)) })*/ }), false => Err( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut item.contents.err)) }).into_native() })}; local_results_0 }); };
+                               let mut local_failed_paths_retry = if failed_paths_retry.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(failed_paths_retry.take_inner()) } }) };
+                               nativePaymentSendFailure::PartialFailure {
+                                       results: local_results,
+                                       failed_paths_retry: local_failed_paths_retry,
+                                       payment_id: ::lightning::ln::channelmanager::PaymentId(payment_id.data),
+                               }
                        },
                }
        }
@@ -1125,12 +1039,17 @@ impl PaymentSendFailure {
                                        local_a_nonref.into(),
                                )
                        },
-                       nativePaymentSendFailure::PartialFailure (ref a, ) => {
-                               let mut a_nonref = (*a).clone();
-                               let mut local_a_nonref = Vec::new(); for mut item in a_nonref.drain(..) { local_a_nonref.push( { let mut local_a_nonref_0 = match item { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::util::errors::APIError::native_into(e) }).into() }; local_a_nonref_0 }); };
-                               PaymentSendFailure::PartialFailure (
-                                       local_a_nonref.into(),
-                               )
+                       nativePaymentSendFailure::PartialFailure {ref results, ref failed_paths_retry, ref payment_id, } => {
+                               let mut results_nonref = (*results).clone();
+                               let mut local_results_nonref = Vec::new(); for mut item in results_nonref.drain(..) { local_results_nonref.push( { let mut local_results_nonref_0 = match item { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::util::errors::APIError::native_into(e) }).into() }; local_results_nonref_0 }); };
+                               let mut failed_paths_retry_nonref = (*failed_paths_retry).clone();
+                               let mut local_failed_paths_retry_nonref = crate::lightning::routing::router::RouteParameters { inner: if failed_paths_retry_nonref.is_none() { std::ptr::null_mut() } else {  { ObjOps::heap_alloc((failed_paths_retry_nonref.unwrap())) } }, is_owned: true };
+                               let mut payment_id_nonref = (*payment_id).clone();
+                               PaymentSendFailure::PartialFailure {
+                                       results: local_results_nonref.into(),
+                                       failed_paths_retry: local_failed_paths_retry_nonref,
+                                       payment_id: crate::c_types::ThirtyTwoBytes { data: payment_id_nonref.0 },
+                               }
                        },
                }
        }
@@ -1154,11 +1073,14 @@ impl PaymentSendFailure {
                                        local_a.into(),
                                )
                        },
-                       nativePaymentSendFailure::PartialFailure (mut a, ) => {
-                               let mut local_a = Vec::new(); for mut item in a.drain(..) { local_a.push( { let mut local_a_0 = match item { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::util::errors::APIError::native_into(e) }).into() }; local_a_0 }); };
-                               PaymentSendFailure::PartialFailure (
-                                       local_a.into(),
-                               )
+                       nativePaymentSendFailure::PartialFailure {mut results, mut failed_paths_retry, mut payment_id, } => {
+                               let mut local_results = Vec::new(); for mut item in results.drain(..) { local_results.push( { let mut local_results_0 = match item { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::util::errors::APIError::native_into(e) }).into() }; local_results_0 }); };
+                               let mut local_failed_paths_retry = crate::lightning::routing::router::RouteParameters { inner: if failed_paths_retry.is_none() { std::ptr::null_mut() } else {  { ObjOps::heap_alloc((failed_paths_retry.unwrap())) } }, is_owned: true };
+                               PaymentSendFailure::PartialFailure {
+                                       results: local_results.into(),
+                                       failed_paths_retry: local_failed_paths_retry,
+                                       payment_id: crate::c_types::ThirtyTwoBytes { data: payment_id.0 },
+                               }
                        },
                }
        }
@@ -1188,8 +1110,12 @@ pub extern "C" fn PaymentSendFailure_all_failed_retry_safe(a: crate::c_types::de
 }
 #[no_mangle]
 /// Utility method to constructs a new PartialFailure-variant PaymentSendFailure
-pub extern "C" fn PaymentSendFailure_partial_failure(a: crate::c_types::derived::CVec_CResult_NoneAPIErrorZZ) -> PaymentSendFailure {
-       PaymentSendFailure::PartialFailure(a, )
+pub extern "C" fn PaymentSendFailure_partial_failure(results: crate::c_types::derived::CVec_CResult_NoneAPIErrorZZ, failed_paths_retry: crate::lightning::routing::router::RouteParameters, payment_id: crate::c_types::ThirtyTwoBytes) -> PaymentSendFailure {
+       PaymentSendFailure::PartialFailure {
+               results,
+               failed_paths_retry,
+               payment_id,
+       }
 }
 /// Constructs a new ChannelManager to hold several channels and route between them.
 ///
@@ -1215,7 +1141,7 @@ pub extern "C" fn ChannelManager_new(mut fee_est: crate::lightning::chain::chain
 #[no_mangle]
 pub extern "C" fn ChannelManager_get_current_default_configuration(this_arg: &ChannelManager) -> crate::lightning::util::config::UserConfig {
        let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_current_default_configuration();
-       crate::lightning::util::config::UserConfig { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const _) as *mut _) }, is_owned: false }
+       crate::lightning::util::config::UserConfig { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::util::config::UserConfig<>) as *mut _) }, is_owned: false }
 }
 
 /// Creates a new outbound channel to the given remote node and with the given value.
@@ -1394,7 +1320,7 @@ pub extern "C" fn ChannelManager_force_close_all_channels(this_arg: &ChannelMana
 pub extern "C" fn ChannelManager_send_payment(this_arg: &ChannelManager, route: &crate::lightning::routing::router::Route, mut payment_hash: crate::c_types::ThirtyTwoBytes, mut payment_secret: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_PaymentIdPaymentSendFailureZ {
        let mut local_payment_secret = if payment_secret.data == [0; 32] { None } else { Some( { ::lightning::ln::PaymentSecret(payment_secret.data) }) };
        let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.send_payment(route.get_native_ref(), ::lightning::ln::PaymentHash(payment_hash.data), &local_payment_secret);
-       let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::channelmanager::PaymentId { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::channelmanager::PaymentSendFailure::native_into(e) }).into() };
+       let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::ThirtyTwoBytes { data: o.0 } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::channelmanager::PaymentSendFailure::native_into(e) }).into() };
        local_ret
 }
 
@@ -1408,8 +1334,8 @@ pub extern "C" fn ChannelManager_send_payment(this_arg: &ChannelManager, route:
 /// [`send_payment`]: [`ChannelManager::send_payment`]
 #[must_use]
 #[no_mangle]
-pub extern "C" fn ChannelManager_retry_payment(this_arg: &ChannelManager, route: &crate::lightning::routing::router::Route, mut payment_id: crate::lightning::ln::channelmanager::PaymentId) -> crate::c_types::derived::CResult_NonePaymentSendFailureZ {
-       let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.retry_payment(route.get_native_ref(), *unsafe { Box::from_raw(payment_id.take_inner()) });
+pub extern "C" fn ChannelManager_retry_payment(this_arg: &ChannelManager, route: &crate::lightning::routing::router::Route, mut payment_id: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_NonePaymentSendFailureZ {
+       let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.retry_payment(route.get_native_ref(), ::lightning::ln::channelmanager::PaymentId(payment_id.data));
        let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::channelmanager::PaymentSendFailure::native_into(e) }).into() };
        local_ret
 }
@@ -1435,7 +1361,7 @@ pub extern "C" fn ChannelManager_retry_payment(this_arg: &ChannelManager, route:
 pub extern "C" fn ChannelManager_send_spontaneous_payment(this_arg: &ChannelManager, route: &crate::lightning::routing::router::Route, mut payment_preimage: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
        let mut local_payment_preimage = if payment_preimage.data == [0; 32] { None } else { Some( { ::lightning::ln::PaymentPreimage(payment_preimage.data) }) };
        let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.send_spontaneous_payment(route.get_native_ref(), local_payment_preimage);
-       let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { let (mut orig_ret_0_0, mut orig_ret_0_1) = o; let mut local_ret_0 = (crate::c_types::ThirtyTwoBytes { data: orig_ret_0_0.0 }, crate::lightning::ln::channelmanager::PaymentId { inner: ObjOps::heap_alloc(orig_ret_0_1), is_owned: true }).into(); local_ret_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::channelmanager::PaymentSendFailure::native_into(e) }).into() };
+       let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { let (mut orig_ret_0_0, mut orig_ret_0_1) = o; let mut local_ret_0 = (crate::c_types::ThirtyTwoBytes { data: orig_ret_0_0.0 }, crate::c_types::ThirtyTwoBytes { data: orig_ret_0_1.0 }).into(); local_ret_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::channelmanager::PaymentSendFailure::native_into(e) }).into() };
        local_ret
 }
 
@@ -1555,31 +1481,6 @@ pub extern "C" fn ChannelManager_get_our_node_id(this_arg: &ChannelManager) -> c
        crate::c_types::PublicKey::from_rust(&ret)
 }
 
-/// Restores a single, given channel to normal operation after a
-/// ChannelMonitorUpdateErr::TemporaryFailure was returned from a channel monitor update
-/// operation.
-///
-/// All ChannelMonitor updates up to and including highest_applied_update_id must have been
-/// fully committed in every copy of the given channels' ChannelMonitors.
-///
-/// Note that there is no effect to calling with a highest_applied_update_id other than the
-/// current latest ChannelMonitorUpdate and one call to this function after multiple
-/// ChannelMonitorUpdateErr::TemporaryFailures is fine. The highest_applied_update_id field
-/// exists largely only to prevent races between this and concurrent update_monitor calls.
-///
-/// Thus, the anticipated use is, at a high level:
-///  1) You register a chain::Watch with this ChannelManager,
-///  2) it stores each update to disk, and begins updating any remote (eg watchtower) copies of
-///     said ChannelMonitors as it can, returning ChannelMonitorUpdateErr::TemporaryFailures
-///     any time it cannot do so instantly,
-///  3) update(s) are applied to each remote copy of a ChannelMonitor,
-///  4) once all remote copies are updated, you call this function with the update_id that
-///     completed, and once it is the latest the Channel will be re-enabled.
-#[no_mangle]
-pub extern "C" fn ChannelManager_channel_monitor_updated(this_arg: &ChannelManager, funding_txo: &crate::lightning::chain::transaction::OutPoint, mut highest_applied_update_id: u64) {
-       unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.channel_monitor_updated(funding_txo.get_native_ref(), highest_applied_update_id)
-}
-
 /// Gets a payment secret and payment hash for use in an invoice given to a third party wishing
 /// to pay us.
 ///
@@ -1928,26 +1829,31 @@ pub(crate) extern "C" fn ChannelManager_write_void(obj: *const c_void) -> crate:
 }
 
 use lightning::ln::channelmanager::ChannelManagerReadArgs as nativeChannelManagerReadArgsImport;
-type nativeChannelManagerReadArgs = nativeChannelManagerReadArgsImport<'static, 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>;
+pub(crate) type nativeChannelManagerReadArgs = nativeChannelManagerReadArgsImport<'static, 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>;
 
 /// Arguments for the creation of a ChannelManager that are not deserialized.
 ///
 /// At a high-level, the process for deserializing a ChannelManager and resuming normal operation
 /// is:
-/// 1) Deserialize all stored ChannelMonitors.
-/// 2) Deserialize the ChannelManager by filling in this struct and calling:
-///    <(BlockHash, ChannelManager)>::read(reader, args)
-///    This may result in closing some Channels if the ChannelMonitor is newer than the stored
-///    ChannelManager state to ensure no loss of funds. Thus, transactions may be broadcasted.
-/// 3) If you are not fetching full blocks, register all relevant ChannelMonitor outpoints the same
-///    way you would handle a `chain::Filter` call using ChannelMonitor::get_outputs_to_watch() and
-///    ChannelMonitor::get_funding_txo().
-/// 4) Reconnect blocks on your ChannelMonitors.
-/// 5) Disconnect/connect blocks on the ChannelManager.
-/// 6) Move the ChannelMonitors into your local chain::Watch.
-///
-/// Note that the ordering of #4-6 is not of importance, however all three must occur before you
-/// call any other methods on the newly-deserialized ChannelManager.
+/// 1) Deserialize all stored [`ChannelMonitor`]s.
+/// 2) Deserialize the [`ChannelManager`] by filling in this struct and calling:
+///    `<(BlockHash, ChannelManager)>::read(reader, args)`
+///    This may result in closing some channels if the [`ChannelMonitor`] is newer than the stored
+///    [`ChannelManager`] state to ensure no loss of funds. Thus, transactions may be broadcasted.
+/// 3) If you are not fetching full blocks, register all relevant [`ChannelMonitor`] outpoints the
+///    same way you would handle a [`chain::Filter`] call using
+///    [`ChannelMonitor::get_outputs_to_watch`] and [`ChannelMonitor::get_funding_txo`].
+/// 4) Reconnect blocks on your [`ChannelMonitor`]s.
+/// 5) Disconnect/connect blocks on the [`ChannelManager`].
+/// 6) Re-persist the [`ChannelMonitor`]s to ensure the latest state is on disk.
+///    Note that if you're using a [`ChainMonitor`] for your [`chain::Watch`] implementation, you
+///    will likely accomplish this as a side-effect of calling [`chain::Watch::watch_channel`] in
+///    the next step.
+/// 7) Move the [`ChannelMonitor`]s into your local [`chain::Watch`]. If you're using a
+///    [`ChainMonitor`], this is done by calling [`chain::Watch::watch_channel`].
+///
+/// Note that the ordering of #4-7 is not of importance, however all four must occur before you
+/// call any other methods on the newly-deserialized [`ChannelManager`].
 ///
 /// Note that because some channels may be closed during deserialization, it is critical that you
 /// always deserialize only the latest version of a ChannelManager and ChannelMonitors available to
@@ -1955,6 +1861,8 @@ type nativeChannelManagerReadArgs = nativeChannelManagerReadArgsImport<'static,
 /// broadcast), and then later deserialize a newer version of the same ChannelManager (which will
 /// not force-close the same channels but consider them live), you may end up revoking a state for
 /// which you've already broadcasted the transaction.
+///
+/// [`ChainMonitor`]: crate::chain::chainmonitor::ChainMonitor
 #[must_use]
 #[repr(C)]
 pub struct ChannelManagerReadArgs {
@@ -1982,7 +1890,7 @@ impl Drop for ChannelManagerReadArgs {
 pub extern "C" fn ChannelManagerReadArgs_free(this_obj: ChannelManagerReadArgs) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn ChannelManagerReadArgs_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn ChannelManagerReadArgs_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelManagerReadArgs); }
 }
 #[allow(unused)]
@@ -2083,7 +1991,7 @@ pub extern "C" fn ChannelManagerReadArgs_set_logger(this_ptr: &mut ChannelManage
 #[no_mangle]
 pub extern "C" fn ChannelManagerReadArgs_get_default_config(this_ptr: &ChannelManagerReadArgs) -> crate::lightning::util::config::UserConfig {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().default_config;
-       crate::lightning::util::config::UserConfig { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const _) as *mut _) }, is_owned: false }
+       crate::lightning::util::config::UserConfig { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::util::config::UserConfig<>) as *mut _) }, is_owned: false }
 }
 /// Default settings used for new channels. Any existing channels will continue to use the
 /// runtime settings which were stored when the ChannelManager was serialized.
index f74b3909f1ee7e66949336936717ff253c38d00d..7bee3b0d7a0c5d1fe85607570479e0621eaefecd 100644 (file)
@@ -150,7 +150,7 @@ pub extern "C" fn InvoiceFeatures_clone(orig: &InvoiceFeatures) -> InvoiceFeatur
 }
 
 use lightning::ln::features::InitFeatures as nativeInitFeaturesImport;
-type nativeInitFeatures = nativeInitFeaturesImport;
+pub(crate) type nativeInitFeatures = nativeInitFeaturesImport;
 
 /// Features used within an `init` message.
 #[must_use]
@@ -180,7 +180,7 @@ impl Drop for InitFeatures {
 pub extern "C" fn InitFeatures_free(this_obj: InitFeatures) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn InitFeatures_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn InitFeatures_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeInitFeatures); }
 }
 #[allow(unused)]
@@ -201,7 +201,7 @@ impl InitFeatures {
 }
 
 use lightning::ln::features::NodeFeatures as nativeNodeFeaturesImport;
-type nativeNodeFeatures = nativeNodeFeaturesImport;
+pub(crate) type nativeNodeFeatures = nativeNodeFeaturesImport;
 
 /// Features used within a `node_announcement` message.
 #[must_use]
@@ -231,7 +231,7 @@ impl Drop for NodeFeatures {
 pub extern "C" fn NodeFeatures_free(this_obj: NodeFeatures) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn NodeFeatures_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn NodeFeatures_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeNodeFeatures); }
 }
 #[allow(unused)]
@@ -252,7 +252,7 @@ impl NodeFeatures {
 }
 
 use lightning::ln::features::ChannelFeatures as nativeChannelFeaturesImport;
-type nativeChannelFeatures = nativeChannelFeaturesImport;
+pub(crate) type nativeChannelFeatures = nativeChannelFeaturesImport;
 
 /// Features used within a `channel_announcement` message.
 #[must_use]
@@ -282,7 +282,7 @@ impl Drop for ChannelFeatures {
 pub extern "C" fn ChannelFeatures_free(this_obj: ChannelFeatures) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn ChannelFeatures_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn ChannelFeatures_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelFeatures); }
 }
 #[allow(unused)]
@@ -303,7 +303,7 @@ impl ChannelFeatures {
 }
 
 use lightning::ln::features::InvoiceFeatures as nativeInvoiceFeaturesImport;
-type nativeInvoiceFeatures = nativeInvoiceFeaturesImport;
+pub(crate) type nativeInvoiceFeatures = nativeInvoiceFeaturesImport;
 
 /// Features used within an invoice.
 #[must_use]
@@ -333,7 +333,7 @@ impl Drop for InvoiceFeatures {
 pub extern "C" fn InvoiceFeatures_free(this_obj: InvoiceFeatures) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn InvoiceFeatures_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn InvoiceFeatures_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeInvoiceFeatures); }
 }
 #[allow(unused)]
index a4fe3a7ad1b41a9b462c0ee8d200bb6e48562e6e..8c20bdd8c13c8d23c2db5dd07deba759b7e762ac 100644 (file)
@@ -31,7 +31,7 @@ use crate::c_types::*;
 
 
 use lightning::ln::msgs::DecodeError as nativeDecodeErrorImport;
-type nativeDecodeError = nativeDecodeErrorImport;
+pub(crate) type nativeDecodeError = nativeDecodeErrorImport;
 
 /// An error in decoding a message or struct.
 #[must_use]
@@ -61,7 +61,7 @@ impl Drop for DecodeError {
 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
-extern "C" fn DecodeError_free_void(this_ptr: *mut c_void) {
+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)]
@@ -101,7 +101,7 @@ pub extern "C" fn DecodeError_clone(orig: &DecodeError) -> DecodeError {
 }
 
 use lightning::ln::msgs::Init as nativeInitImport;
-type nativeInit = nativeInitImport;
+pub(crate) type nativeInit = nativeInitImport;
 
 /// An init message to be sent or received from a peer
 #[must_use]
@@ -131,7 +131,7 @@ impl Drop for Init {
 pub extern "C" fn Init_free(this_obj: Init) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn Init_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn Init_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeInit); }
 }
 #[allow(unused)]
@@ -154,7 +154,7 @@ impl Init {
 #[no_mangle]
 pub extern "C" fn Init_get_features(this_ptr: &Init) -> crate::lightning::ln::features::InitFeatures {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().features;
-       crate::lightning::ln::features::InitFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const _) as *mut _) }, is_owned: false }
+       crate::lightning::ln::features::InitFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::features::InitFeatures<>) as *mut _) }, is_owned: false }
 }
 /// The relevant features which the sender supports
 #[no_mangle]
@@ -190,7 +190,7 @@ pub extern "C" fn Init_clone(orig: &Init) -> Init {
 }
 
 use lightning::ln::msgs::ErrorMessage as nativeErrorMessageImport;
-type nativeErrorMessage = nativeErrorMessageImport;
+pub(crate) type nativeErrorMessage = nativeErrorMessageImport;
 
 /// An error message to be sent or received from a peer
 #[must_use]
@@ -220,7 +220,7 @@ impl Drop for ErrorMessage {
 pub extern "C" fn ErrorMessage_free(this_obj: ErrorMessage) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn ErrorMessage_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn ErrorMessage_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeErrorMessage); }
 }
 #[allow(unused)]
@@ -297,7 +297,7 @@ pub extern "C" fn ErrorMessage_clone(orig: &ErrorMessage) -> ErrorMessage {
 }
 
 use lightning::ln::msgs::Ping as nativePingImport;
-type nativePing = nativePingImport;
+pub(crate) type nativePing = nativePingImport;
 
 /// A ping message to be sent or received from a peer
 #[must_use]
@@ -327,7 +327,7 @@ impl Drop for Ping {
 pub extern "C" fn Ping_free(this_obj: Ping) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn Ping_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn Ping_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativePing); }
 }
 #[allow(unused)]
@@ -400,7 +400,7 @@ pub extern "C" fn Ping_clone(orig: &Ping) -> Ping {
 }
 
 use lightning::ln::msgs::Pong as nativePongImport;
-type nativePong = nativePongImport;
+pub(crate) type nativePong = nativePongImport;
 
 /// A pong message to be sent or received from a peer
 #[must_use]
@@ -430,7 +430,7 @@ impl Drop for Pong {
 pub extern "C" fn Pong_free(this_obj: Pong) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn Pong_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn Pong_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativePong); }
 }
 #[allow(unused)]
@@ -491,7 +491,7 @@ pub extern "C" fn Pong_clone(orig: &Pong) -> Pong {
 }
 
 use lightning::ln::msgs::OpenChannel as nativeOpenChannelImport;
-type nativeOpenChannel = nativeOpenChannelImport;
+pub(crate) type nativeOpenChannel = nativeOpenChannelImport;
 
 /// An open_channel message to be sent or received from a peer
 #[must_use]
@@ -521,7 +521,7 @@ impl Drop for OpenChannel {
 pub extern "C" fn OpenChannel_free(this_obj: OpenChannel) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn OpenChannel_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn OpenChannel_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeOpenChannel); }
 }
 #[allow(unused)]
@@ -759,7 +759,7 @@ pub extern "C" fn OpenChannel_clone(orig: &OpenChannel) -> OpenChannel {
 }
 
 use lightning::ln::msgs::AcceptChannel as nativeAcceptChannelImport;
-type nativeAcceptChannel = nativeAcceptChannelImport;
+pub(crate) type nativeAcceptChannel = nativeAcceptChannelImport;
 
 /// An accept_channel message to be sent or received from a peer
 #[must_use]
@@ -789,7 +789,7 @@ impl Drop for AcceptChannel {
 pub extern "C" fn AcceptChannel_free(this_obj: AcceptChannel) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn AcceptChannel_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn AcceptChannel_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeAcceptChannel); }
 }
 #[allow(unused)]
@@ -983,7 +983,7 @@ pub extern "C" fn AcceptChannel_clone(orig: &AcceptChannel) -> AcceptChannel {
 }
 
 use lightning::ln::msgs::FundingCreated as nativeFundingCreatedImport;
-type nativeFundingCreated = nativeFundingCreatedImport;
+pub(crate) type nativeFundingCreated = nativeFundingCreatedImport;
 
 /// A funding_created message to be sent or received from a peer
 #[must_use]
@@ -1013,7 +1013,7 @@ impl Drop for FundingCreated {
 pub extern "C" fn FundingCreated_free(this_obj: FundingCreated) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn FundingCreated_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn FundingCreated_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeFundingCreated); }
 }
 #[allow(unused)]
@@ -1108,7 +1108,7 @@ pub extern "C" fn FundingCreated_clone(orig: &FundingCreated) -> FundingCreated
 }
 
 use lightning::ln::msgs::FundingSigned as nativeFundingSignedImport;
-type nativeFundingSigned = nativeFundingSignedImport;
+pub(crate) type nativeFundingSigned = nativeFundingSignedImport;
 
 /// A funding_signed message to be sent or received from a peer
 #[must_use]
@@ -1138,7 +1138,7 @@ impl Drop for FundingSigned {
 pub extern "C" fn FundingSigned_free(this_obj: FundingSigned) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn FundingSigned_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn FundingSigned_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeFundingSigned); }
 }
 #[allow(unused)]
@@ -1209,7 +1209,7 @@ pub extern "C" fn FundingSigned_clone(orig: &FundingSigned) -> FundingSigned {
 }
 
 use lightning::ln::msgs::FundingLocked as nativeFundingLockedImport;
-type nativeFundingLocked = nativeFundingLockedImport;
+pub(crate) type nativeFundingLocked = nativeFundingLockedImport;
 
 /// A funding_locked message to be sent or received from a peer
 #[must_use]
@@ -1239,7 +1239,7 @@ impl Drop for FundingLocked {
 pub extern "C" fn FundingLocked_free(this_obj: FundingLocked) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn FundingLocked_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn FundingLocked_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeFundingLocked); }
 }
 #[allow(unused)]
@@ -1310,7 +1310,7 @@ pub extern "C" fn FundingLocked_clone(orig: &FundingLocked) -> FundingLocked {
 }
 
 use lightning::ln::msgs::Shutdown as nativeShutdownImport;
-type nativeShutdown = nativeShutdownImport;
+pub(crate) type nativeShutdown = nativeShutdownImport;
 
 /// A shutdown message to be sent or received from a peer
 #[must_use]
@@ -1340,7 +1340,7 @@ impl Drop for Shutdown {
 pub extern "C" fn Shutdown_free(this_obj: Shutdown) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn Shutdown_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn Shutdown_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeShutdown); }
 }
 #[allow(unused)]
@@ -1413,7 +1413,7 @@ pub extern "C" fn Shutdown_clone(orig: &Shutdown) -> Shutdown {
 }
 
 use lightning::ln::msgs::ClosingSignedFeeRange as nativeClosingSignedFeeRangeImport;
-type nativeClosingSignedFeeRange = nativeClosingSignedFeeRangeImport;
+pub(crate) type nativeClosingSignedFeeRange = nativeClosingSignedFeeRangeImport;
 
 /// The minimum and maximum fees which the sender is willing to place on the closing transaction.
 /// This is provided in [`ClosingSigned`] by both sides to indicate the fee range they are willing
@@ -1445,7 +1445,7 @@ impl Drop for ClosingSignedFeeRange {
 pub extern "C" fn ClosingSignedFeeRange_free(this_obj: ClosingSignedFeeRange) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn ClosingSignedFeeRange_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn ClosingSignedFeeRange_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeClosingSignedFeeRange); }
 }
 #[allow(unused)]
@@ -1520,7 +1520,7 @@ pub extern "C" fn ClosingSignedFeeRange_clone(orig: &ClosingSignedFeeRange) -> C
 }
 
 use lightning::ln::msgs::ClosingSigned as nativeClosingSignedImport;
-type nativeClosingSigned = nativeClosingSignedImport;
+pub(crate) type nativeClosingSigned = nativeClosingSignedImport;
 
 /// A closing_signed message to be sent or received from a peer
 #[must_use]
@@ -1550,7 +1550,7 @@ impl Drop for ClosingSigned {
 pub extern "C" fn ClosingSigned_free(this_obj: ClosingSigned) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn ClosingSigned_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn ClosingSigned_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeClosingSigned); }
 }
 #[allow(unused)]
@@ -1609,7 +1609,7 @@ pub extern "C" fn ClosingSigned_set_signature(this_ptr: &mut ClosingSigned, mut
 #[no_mangle]
 pub extern "C" fn ClosingSigned_get_fee_range(this_ptr: &ClosingSigned) -> crate::lightning::ln::msgs::ClosingSignedFeeRange {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().fee_range;
-       let mut local_inner_val = crate::lightning::ln::msgs::ClosingSignedFeeRange { inner: unsafe { (if inner_val.is_none() { std::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const _) as *mut _ }, is_owned: false };
+       let mut local_inner_val = crate::lightning::ln::msgs::ClosingSignedFeeRange { inner: unsafe { (if inner_val.is_none() { std::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::ln::msgs::ClosingSignedFeeRange<>) as *mut _ }, is_owned: false };
        local_inner_val
 }
 /// The minimum and maximum fees which the sender is willing to accept, provided only by new
@@ -1654,7 +1654,7 @@ pub extern "C" fn ClosingSigned_clone(orig: &ClosingSigned) -> ClosingSigned {
 }
 
 use lightning::ln::msgs::UpdateAddHTLC as nativeUpdateAddHTLCImport;
-type nativeUpdateAddHTLC = nativeUpdateAddHTLCImport;
+pub(crate) type nativeUpdateAddHTLC = nativeUpdateAddHTLCImport;
 
 /// An update_add_htlc message to be sent or received from a peer
 #[must_use]
@@ -1684,7 +1684,7 @@ impl Drop for UpdateAddHTLC {
 pub extern "C" fn UpdateAddHTLC_free(this_obj: UpdateAddHTLC) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn UpdateAddHTLC_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn UpdateAddHTLC_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeUpdateAddHTLC); }
 }
 #[allow(unused)]
@@ -1779,7 +1779,7 @@ pub extern "C" fn UpdateAddHTLC_clone(orig: &UpdateAddHTLC) -> UpdateAddHTLC {
 }
 
 use lightning::ln::msgs::UpdateFulfillHTLC as nativeUpdateFulfillHTLCImport;
-type nativeUpdateFulfillHTLC = nativeUpdateFulfillHTLCImport;
+pub(crate) type nativeUpdateFulfillHTLC = nativeUpdateFulfillHTLCImport;
 
 /// An update_fulfill_htlc message to be sent or received from a peer
 #[must_use]
@@ -1809,7 +1809,7 @@ impl Drop for UpdateFulfillHTLC {
 pub extern "C" fn UpdateFulfillHTLC_free(this_obj: UpdateFulfillHTLC) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn UpdateFulfillHTLC_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn UpdateFulfillHTLC_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeUpdateFulfillHTLC); }
 }
 #[allow(unused)]
@@ -1892,7 +1892,7 @@ pub extern "C" fn UpdateFulfillHTLC_clone(orig: &UpdateFulfillHTLC) -> UpdateFul
 }
 
 use lightning::ln::msgs::UpdateFailHTLC as nativeUpdateFailHTLCImport;
-type nativeUpdateFailHTLC = nativeUpdateFailHTLCImport;
+pub(crate) type nativeUpdateFailHTLC = nativeUpdateFailHTLCImport;
 
 /// An update_fail_htlc message to be sent or received from a peer
 #[must_use]
@@ -1922,7 +1922,7 @@ impl Drop for UpdateFailHTLC {
 pub extern "C" fn UpdateFailHTLC_free(this_obj: UpdateFailHTLC) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn UpdateFailHTLC_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn UpdateFailHTLC_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeUpdateFailHTLC); }
 }
 #[allow(unused)]
@@ -1984,7 +1984,7 @@ pub extern "C" fn UpdateFailHTLC_clone(orig: &UpdateFailHTLC) -> UpdateFailHTLC
 }
 
 use lightning::ln::msgs::UpdateFailMalformedHTLC as nativeUpdateFailMalformedHTLCImport;
-type nativeUpdateFailMalformedHTLC = nativeUpdateFailMalformedHTLCImport;
+pub(crate) type nativeUpdateFailMalformedHTLC = nativeUpdateFailMalformedHTLCImport;
 
 /// An update_fail_malformed_htlc message to be sent or received from a peer
 #[must_use]
@@ -2014,7 +2014,7 @@ impl Drop for UpdateFailMalformedHTLC {
 pub extern "C" fn UpdateFailMalformedHTLC_free(this_obj: UpdateFailMalformedHTLC) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn UpdateFailMalformedHTLC_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn UpdateFailMalformedHTLC_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeUpdateFailMalformedHTLC); }
 }
 #[allow(unused)]
@@ -2087,7 +2087,7 @@ pub extern "C" fn UpdateFailMalformedHTLC_clone(orig: &UpdateFailMalformedHTLC)
 }
 
 use lightning::ln::msgs::CommitmentSigned as nativeCommitmentSignedImport;
-type nativeCommitmentSigned = nativeCommitmentSignedImport;
+pub(crate) type nativeCommitmentSigned = nativeCommitmentSignedImport;
 
 /// A commitment_signed message to be sent or received from a peer
 #[must_use]
@@ -2117,7 +2117,7 @@ impl Drop for CommitmentSigned {
 pub extern "C" fn CommitmentSigned_free(this_obj: CommitmentSigned) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn CommitmentSigned_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn CommitmentSigned_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeCommitmentSigned); }
 }
 #[allow(unused)]
@@ -2196,7 +2196,7 @@ pub extern "C" fn CommitmentSigned_clone(orig: &CommitmentSigned) -> CommitmentS
 }
 
 use lightning::ln::msgs::RevokeAndACK as nativeRevokeAndACKImport;
-type nativeRevokeAndACK = nativeRevokeAndACKImport;
+pub(crate) type nativeRevokeAndACK = nativeRevokeAndACKImport;
 
 /// A revoke_and_ack message to be sent or received from a peer
 #[must_use]
@@ -2226,7 +2226,7 @@ impl Drop for RevokeAndACK {
 pub extern "C" fn RevokeAndACK_free(this_obj: RevokeAndACK) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn RevokeAndACK_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn RevokeAndACK_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeRevokeAndACK); }
 }
 #[allow(unused)]
@@ -2309,7 +2309,7 @@ pub extern "C" fn RevokeAndACK_clone(orig: &RevokeAndACK) -> RevokeAndACK {
 }
 
 use lightning::ln::msgs::UpdateFee as nativeUpdateFeeImport;
-type nativeUpdateFee = nativeUpdateFeeImport;
+pub(crate) type nativeUpdateFee = nativeUpdateFeeImport;
 
 /// An update_fee message to be sent or received from a peer
 #[must_use]
@@ -2339,7 +2339,7 @@ impl Drop for UpdateFee {
 pub extern "C" fn UpdateFee_free(this_obj: UpdateFee) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn UpdateFee_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn UpdateFee_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeUpdateFee); }
 }
 #[allow(unused)]
@@ -2410,7 +2410,7 @@ pub extern "C" fn UpdateFee_clone(orig: &UpdateFee) -> UpdateFee {
 }
 
 use lightning::ln::msgs::DataLossProtect as nativeDataLossProtectImport;
-type nativeDataLossProtect = nativeDataLossProtectImport;
+pub(crate) type nativeDataLossProtect = nativeDataLossProtectImport;
 
 /// Proof that the sender knows the per-commitment secret of the previous commitment transaction.
 /// This is used to convince the recipient that the channel is at a certain commitment
@@ -2443,7 +2443,7 @@ impl Drop for DataLossProtect {
 pub extern "C" fn DataLossProtect_free(this_obj: DataLossProtect) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn DataLossProtect_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn DataLossProtect_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeDataLossProtect); }
 }
 #[allow(unused)]
@@ -2516,7 +2516,7 @@ pub extern "C" fn DataLossProtect_clone(orig: &DataLossProtect) -> DataLossProte
 }
 
 use lightning::ln::msgs::ChannelReestablish as nativeChannelReestablishImport;
-type nativeChannelReestablish = nativeChannelReestablishImport;
+pub(crate) type nativeChannelReestablish = nativeChannelReestablishImport;
 
 /// A channel_reestablish message to be sent or received from a peer
 #[must_use]
@@ -2546,7 +2546,7 @@ impl Drop for ChannelReestablish {
 pub extern "C" fn ChannelReestablish_free(this_obj: ChannelReestablish) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn ChannelReestablish_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn ChannelReestablish_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelReestablish); }
 }
 #[allow(unused)]
@@ -2619,7 +2619,7 @@ pub extern "C" fn ChannelReestablish_clone(orig: &ChannelReestablish) -> Channel
 }
 
 use lightning::ln::msgs::AnnouncementSignatures as nativeAnnouncementSignaturesImport;
-type nativeAnnouncementSignatures = nativeAnnouncementSignaturesImport;
+pub(crate) type nativeAnnouncementSignatures = nativeAnnouncementSignaturesImport;
 
 /// An announcement_signatures message to be sent or received from a peer
 #[must_use]
@@ -2649,7 +2649,7 @@ impl Drop for AnnouncementSignatures {
 pub extern "C" fn AnnouncementSignatures_free(this_obj: AnnouncementSignatures) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn AnnouncementSignatures_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn AnnouncementSignatures_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeAnnouncementSignatures); }
 }
 #[allow(unused)]
@@ -2977,13 +2977,6 @@ pub extern "C" fn NetAddress_write(obj: &NetAddress) -> crate::c_types::derived:
        crate::c_types::serialize_obj(&unsafe { &*obj }.to_native())
 }
 #[no_mangle]
-/// Read a Result from a byte array, created by Result_write
-pub extern "C" fn Result_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_CResult_NetAddressu8ZDecodeErrorZ {
-       let res = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { let mut local_res_0 = match o { 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( { e }).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() };
-       local_res
-}
-#[no_mangle]
 /// 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 = crate::c_types::deserialize_obj(ser);
@@ -2992,7 +2985,7 @@ pub extern "C" fn NetAddress_read(ser: crate::c_types::u8slice) -> crate::c_type
 }
 
 use lightning::ln::msgs::UnsignedNodeAnnouncement as nativeUnsignedNodeAnnouncementImport;
-type nativeUnsignedNodeAnnouncement = nativeUnsignedNodeAnnouncementImport;
+pub(crate) type nativeUnsignedNodeAnnouncement = nativeUnsignedNodeAnnouncementImport;
 
 /// The unsigned part of a node_announcement
 #[must_use]
@@ -3022,7 +3015,7 @@ impl Drop for UnsignedNodeAnnouncement {
 pub extern "C" fn UnsignedNodeAnnouncement_free(this_obj: UnsignedNodeAnnouncement) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn UnsignedNodeAnnouncement_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn UnsignedNodeAnnouncement_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeUnsignedNodeAnnouncement); }
 }
 #[allow(unused)]
@@ -3045,7 +3038,7 @@ impl UnsignedNodeAnnouncement {
 #[no_mangle]
 pub extern "C" fn UnsignedNodeAnnouncement_get_features(this_ptr: &UnsignedNodeAnnouncement) -> crate::lightning::ln::features::NodeFeatures {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().features;
-       crate::lightning::ln::features::NodeFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const _) as *mut _) }, is_owned: false }
+       crate::lightning::ln::features::NodeFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::features::NodeFeatures<>) as *mut _) }, is_owned: false }
 }
 /// The advertised features
 #[no_mangle]
@@ -3127,7 +3120,7 @@ pub extern "C" fn UnsignedNodeAnnouncement_clone(orig: &UnsignedNodeAnnouncement
 }
 
 use lightning::ln::msgs::NodeAnnouncement as nativeNodeAnnouncementImport;
-type nativeNodeAnnouncement = nativeNodeAnnouncementImport;
+pub(crate) type nativeNodeAnnouncement = nativeNodeAnnouncementImport;
 
 /// A node_announcement message to be sent or received from a peer
 #[must_use]
@@ -3157,7 +3150,7 @@ impl Drop for NodeAnnouncement {
 pub extern "C" fn NodeAnnouncement_free(this_obj: NodeAnnouncement) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn NodeAnnouncement_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn NodeAnnouncement_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeNodeAnnouncement); }
 }
 #[allow(unused)]
@@ -3191,7 +3184,7 @@ pub extern "C" fn NodeAnnouncement_set_signature(this_ptr: &mut NodeAnnouncement
 #[no_mangle]
 pub extern "C" fn NodeAnnouncement_get_contents(this_ptr: &NodeAnnouncement) -> crate::lightning::ln::msgs::UnsignedNodeAnnouncement {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().contents;
-       crate::lightning::ln::msgs::UnsignedNodeAnnouncement { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const _) as *mut _) }, is_owned: false }
+       crate::lightning::ln::msgs::UnsignedNodeAnnouncement { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::msgs::UnsignedNodeAnnouncement<>) as *mut _) }, is_owned: false }
 }
 /// The actual content of the announcement
 #[no_mangle]
@@ -3228,7 +3221,7 @@ pub extern "C" fn NodeAnnouncement_clone(orig: &NodeAnnouncement) -> NodeAnnounc
 }
 
 use lightning::ln::msgs::UnsignedChannelAnnouncement as nativeUnsignedChannelAnnouncementImport;
-type nativeUnsignedChannelAnnouncement = nativeUnsignedChannelAnnouncementImport;
+pub(crate) type nativeUnsignedChannelAnnouncement = nativeUnsignedChannelAnnouncementImport;
 
 /// The unsigned part of a channel_announcement
 #[must_use]
@@ -3258,7 +3251,7 @@ impl Drop for UnsignedChannelAnnouncement {
 pub extern "C" fn UnsignedChannelAnnouncement_free(this_obj: UnsignedChannelAnnouncement) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn UnsignedChannelAnnouncement_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn UnsignedChannelAnnouncement_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeUnsignedChannelAnnouncement); }
 }
 #[allow(unused)]
@@ -3281,7 +3274,7 @@ impl UnsignedChannelAnnouncement {
 #[no_mangle]
 pub extern "C" fn UnsignedChannelAnnouncement_get_features(this_ptr: &UnsignedChannelAnnouncement) -> crate::lightning::ln::features::ChannelFeatures {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().features;
-       crate::lightning::ln::features::ChannelFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const _) as *mut _) }, is_owned: false }
+       crate::lightning::ln::features::ChannelFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::features::ChannelFeatures<>) as *mut _) }, is_owned: false }
 }
 /// The advertised channel features
 #[no_mangle]
@@ -3375,7 +3368,7 @@ pub extern "C" fn UnsignedChannelAnnouncement_clone(orig: &UnsignedChannelAnnoun
 }
 
 use lightning::ln::msgs::ChannelAnnouncement as nativeChannelAnnouncementImport;
-type nativeChannelAnnouncement = nativeChannelAnnouncementImport;
+pub(crate) type nativeChannelAnnouncement = nativeChannelAnnouncementImport;
 
 /// A channel_announcement message to be sent or received from a peer
 #[must_use]
@@ -3405,7 +3398,7 @@ impl Drop for ChannelAnnouncement {
 pub extern "C" fn ChannelAnnouncement_free(this_obj: ChannelAnnouncement) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn ChannelAnnouncement_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn ChannelAnnouncement_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelAnnouncement); }
 }
 #[allow(unused)]
@@ -3472,7 +3465,7 @@ pub extern "C" fn ChannelAnnouncement_set_bitcoin_signature_2(this_ptr: &mut Cha
 #[no_mangle]
 pub extern "C" fn ChannelAnnouncement_get_contents(this_ptr: &ChannelAnnouncement) -> crate::lightning::ln::msgs::UnsignedChannelAnnouncement {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().contents;
-       crate::lightning::ln::msgs::UnsignedChannelAnnouncement { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const _) as *mut _) }, is_owned: false }
+       crate::lightning::ln::msgs::UnsignedChannelAnnouncement { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::msgs::UnsignedChannelAnnouncement<>) as *mut _) }, is_owned: false }
 }
 /// The actual announcement
 #[no_mangle]
@@ -3512,7 +3505,7 @@ pub extern "C" fn ChannelAnnouncement_clone(orig: &ChannelAnnouncement) -> Chann
 }
 
 use lightning::ln::msgs::UnsignedChannelUpdate as nativeUnsignedChannelUpdateImport;
-type nativeUnsignedChannelUpdate = nativeUnsignedChannelUpdateImport;
+pub(crate) type nativeUnsignedChannelUpdate = nativeUnsignedChannelUpdateImport;
 
 /// The unsigned part of a channel_update
 #[must_use]
@@ -3542,7 +3535,7 @@ impl Drop for UnsignedChannelUpdate {
 pub extern "C" fn UnsignedChannelUpdate_free(this_obj: UnsignedChannelUpdate) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn UnsignedChannelUpdate_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn UnsignedChannelUpdate_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeUnsignedChannelUpdate); }
 }
 #[allow(unused)]
@@ -3684,7 +3677,7 @@ pub extern "C" fn UnsignedChannelUpdate_clone(orig: &UnsignedChannelUpdate) -> U
 }
 
 use lightning::ln::msgs::ChannelUpdate as nativeChannelUpdateImport;
-type nativeChannelUpdate = nativeChannelUpdateImport;
+pub(crate) type nativeChannelUpdate = nativeChannelUpdateImport;
 
 /// A channel_update message to be sent or received from a peer
 #[must_use]
@@ -3714,7 +3707,7 @@ impl Drop for ChannelUpdate {
 pub extern "C" fn ChannelUpdate_free(this_obj: ChannelUpdate) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn ChannelUpdate_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn ChannelUpdate_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelUpdate); }
 }
 #[allow(unused)]
@@ -3748,7 +3741,7 @@ pub extern "C" fn ChannelUpdate_set_signature(this_ptr: &mut ChannelUpdate, mut
 #[no_mangle]
 pub extern "C" fn ChannelUpdate_get_contents(this_ptr: &ChannelUpdate) -> crate::lightning::ln::msgs::UnsignedChannelUpdate {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().contents;
-       crate::lightning::ln::msgs::UnsignedChannelUpdate { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const _) as *mut _) }, is_owned: false }
+       crate::lightning::ln::msgs::UnsignedChannelUpdate { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::msgs::UnsignedChannelUpdate<>) as *mut _) }, is_owned: false }
 }
 /// The actual channel update
 #[no_mangle]
@@ -3785,7 +3778,7 @@ pub extern "C" fn ChannelUpdate_clone(orig: &ChannelUpdate) -> ChannelUpdate {
 }
 
 use lightning::ln::msgs::QueryChannelRange as nativeQueryChannelRangeImport;
-type nativeQueryChannelRange = nativeQueryChannelRangeImport;
+pub(crate) type nativeQueryChannelRange = nativeQueryChannelRangeImport;
 
 /// A query_channel_range message is used to query a peer for channel
 /// UTXOs in a range of blocks. The recipient of a query makes a best
@@ -3818,7 +3811,7 @@ impl Drop for QueryChannelRange {
 pub extern "C" fn QueryChannelRange_free(this_obj: QueryChannelRange) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn QueryChannelRange_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn QueryChannelRange_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeQueryChannelRange); }
 }
 #[allow(unused)]
@@ -3901,7 +3894,7 @@ pub extern "C" fn QueryChannelRange_clone(orig: &QueryChannelRange) -> QueryChan
 }
 
 use lightning::ln::msgs::ReplyChannelRange as nativeReplyChannelRangeImport;
-type nativeReplyChannelRange = nativeReplyChannelRangeImport;
+pub(crate) type nativeReplyChannelRange = nativeReplyChannelRangeImport;
 
 /// A reply_channel_range message is a reply to a query_channel_range
 /// message. Multiple reply_channel_range messages can be sent in reply
@@ -3937,7 +3930,7 @@ impl Drop for ReplyChannelRange {
 pub extern "C" fn ReplyChannelRange_free(this_obj: ReplyChannelRange) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn ReplyChannelRange_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn ReplyChannelRange_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeReplyChannelRange); }
 }
 #[allow(unused)]
@@ -4040,7 +4033,7 @@ pub extern "C" fn ReplyChannelRange_clone(orig: &ReplyChannelRange) -> ReplyChan
 }
 
 use lightning::ln::msgs::QueryShortChannelIds as nativeQueryShortChannelIdsImport;
-type nativeQueryShortChannelIds = nativeQueryShortChannelIdsImport;
+pub(crate) type nativeQueryShortChannelIds = nativeQueryShortChannelIdsImport;
 
 /// A query_short_channel_ids message is used to query a peer for
 /// routing gossip messages related to one or more short_channel_ids.
@@ -4077,7 +4070,7 @@ impl Drop for QueryShortChannelIds {
 pub extern "C" fn QueryShortChannelIds_free(this_obj: QueryShortChannelIds) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn QueryShortChannelIds_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn QueryShortChannelIds_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeQueryShortChannelIds); }
 }
 #[allow(unused)]
@@ -4144,7 +4137,7 @@ pub extern "C" fn QueryShortChannelIds_clone(orig: &QueryShortChannelIds) -> Que
 }
 
 use lightning::ln::msgs::ReplyShortChannelIdsEnd as nativeReplyShortChannelIdsEndImport;
-type nativeReplyShortChannelIdsEnd = nativeReplyShortChannelIdsEndImport;
+pub(crate) type nativeReplyShortChannelIdsEnd = nativeReplyShortChannelIdsEndImport;
 
 /// A reply_short_channel_ids_end message is sent as a reply to a
 /// query_short_channel_ids message. The query recipient makes a best
@@ -4177,7 +4170,7 @@ impl Drop for ReplyShortChannelIdsEnd {
 pub extern "C" fn ReplyShortChannelIdsEnd_free(this_obj: ReplyShortChannelIdsEnd) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn ReplyShortChannelIdsEnd_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn ReplyShortChannelIdsEnd_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeReplyShortChannelIdsEnd); }
 }
 #[allow(unused)]
@@ -4250,7 +4243,7 @@ pub extern "C" fn ReplyShortChannelIdsEnd_clone(orig: &ReplyShortChannelIdsEnd)
 }
 
 use lightning::ln::msgs::GossipTimestampFilter as nativeGossipTimestampFilterImport;
-type nativeGossipTimestampFilter = nativeGossipTimestampFilterImport;
+pub(crate) type nativeGossipTimestampFilter = nativeGossipTimestampFilterImport;
 
 /// A gossip_timestamp_filter message is used by a node to request
 /// gossip relay for messages in the requested time range when the
@@ -4282,7 +4275,7 @@ impl Drop for GossipTimestampFilter {
 pub extern "C" fn GossipTimestampFilter_free(this_obj: GossipTimestampFilter) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn GossipTimestampFilter_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn GossipTimestampFilter_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeGossipTimestampFilter); }
 }
 #[allow(unused)]
@@ -4516,7 +4509,7 @@ pub extern "C" fn ErrorAction_send_error_message(msg: crate::lightning::ln::msgs
 }
 
 use lightning::ln::msgs::LightningError as nativeLightningErrorImport;
-type nativeLightningError = nativeLightningErrorImport;
+pub(crate) type nativeLightningError = nativeLightningErrorImport;
 
 /// An Err type for failure to process messages.
 #[must_use]
@@ -4546,7 +4539,7 @@ impl Drop for LightningError {
 pub extern "C" fn LightningError_free(this_obj: LightningError) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn LightningError_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn LightningError_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeLightningError); }
 }
 #[allow(unused)]
@@ -4617,7 +4610,7 @@ pub extern "C" fn LightningError_clone(orig: &LightningError) -> LightningError
 }
 
 use lightning::ln::msgs::CommitmentUpdate as nativeCommitmentUpdateImport;
-type nativeCommitmentUpdate = nativeCommitmentUpdateImport;
+pub(crate) type nativeCommitmentUpdate = nativeCommitmentUpdateImport;
 
 /// Struct used to return values from revoke_and_ack messages, containing a bunch of commitment
 /// transaction updates if they were pending.
@@ -4648,7 +4641,7 @@ impl Drop for CommitmentUpdate {
 pub extern "C" fn CommitmentUpdate_free(this_obj: CommitmentUpdate) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn CommitmentUpdate_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn CommitmentUpdate_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeCommitmentUpdate); }
 }
 #[allow(unused)]
@@ -4671,7 +4664,7 @@ impl CommitmentUpdate {
 #[no_mangle]
 pub extern "C" fn CommitmentUpdate_get_update_add_htlcs(this_ptr: &CommitmentUpdate) -> crate::c_types::derived::CVec_UpdateAddHTLCZ {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().update_add_htlcs;
-       let mut local_inner_val = Vec::new(); for item in inner_val.iter() { local_inner_val.push( { crate::lightning::ln::msgs::UpdateAddHTLC { inner: unsafe { ObjOps::nonnull_ptr_to_inner((item as *const _) as *mut _) }, is_owned: false } }); };
+       let mut local_inner_val = Vec::new(); for item in inner_val.iter() { local_inner_val.push( { crate::lightning::ln::msgs::UpdateAddHTLC { inner: unsafe { ObjOps::nonnull_ptr_to_inner((item as *const lightning::ln::msgs::UpdateAddHTLC<>) as *mut _) }, is_owned: false } }); };
        local_inner_val.into()
 }
 /// update_add_htlc messages which should be sent
@@ -4684,7 +4677,7 @@ pub extern "C" fn CommitmentUpdate_set_update_add_htlcs(this_ptr: &mut Commitmen
 #[no_mangle]
 pub extern "C" fn CommitmentUpdate_get_update_fulfill_htlcs(this_ptr: &CommitmentUpdate) -> crate::c_types::derived::CVec_UpdateFulfillHTLCZ {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().update_fulfill_htlcs;
-       let mut local_inner_val = Vec::new(); for item in inner_val.iter() { local_inner_val.push( { crate::lightning::ln::msgs::UpdateFulfillHTLC { inner: unsafe { ObjOps::nonnull_ptr_to_inner((item as *const _) as *mut _) }, is_owned: false } }); };
+       let mut local_inner_val = Vec::new(); for item in inner_val.iter() { local_inner_val.push( { crate::lightning::ln::msgs::UpdateFulfillHTLC { inner: unsafe { ObjOps::nonnull_ptr_to_inner((item as *const lightning::ln::msgs::UpdateFulfillHTLC<>) as *mut _) }, is_owned: false } }); };
        local_inner_val.into()
 }
 /// update_fulfill_htlc messages which should be sent
@@ -4697,7 +4690,7 @@ pub extern "C" fn CommitmentUpdate_set_update_fulfill_htlcs(this_ptr: &mut Commi
 #[no_mangle]
 pub extern "C" fn CommitmentUpdate_get_update_fail_htlcs(this_ptr: &CommitmentUpdate) -> crate::c_types::derived::CVec_UpdateFailHTLCZ {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().update_fail_htlcs;
-       let mut local_inner_val = Vec::new(); for item in inner_val.iter() { local_inner_val.push( { crate::lightning::ln::msgs::UpdateFailHTLC { inner: unsafe { ObjOps::nonnull_ptr_to_inner((item as *const _) as *mut _) }, is_owned: false } }); };
+       let mut local_inner_val = Vec::new(); for item in inner_val.iter() { local_inner_val.push( { crate::lightning::ln::msgs::UpdateFailHTLC { inner: unsafe { ObjOps::nonnull_ptr_to_inner((item as *const lightning::ln::msgs::UpdateFailHTLC<>) as *mut _) }, is_owned: false } }); };
        local_inner_val.into()
 }
 /// update_fail_htlc messages which should be sent
@@ -4710,7 +4703,7 @@ pub extern "C" fn CommitmentUpdate_set_update_fail_htlcs(this_ptr: &mut Commitme
 #[no_mangle]
 pub extern "C" fn CommitmentUpdate_get_update_fail_malformed_htlcs(this_ptr: &CommitmentUpdate) -> crate::c_types::derived::CVec_UpdateFailMalformedHTLCZ {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().update_fail_malformed_htlcs;
-       let mut local_inner_val = Vec::new(); for item in inner_val.iter() { local_inner_val.push( { crate::lightning::ln::msgs::UpdateFailMalformedHTLC { inner: unsafe { ObjOps::nonnull_ptr_to_inner((item as *const _) as *mut _) }, is_owned: false } }); };
+       let mut local_inner_val = Vec::new(); for item in inner_val.iter() { local_inner_val.push( { crate::lightning::ln::msgs::UpdateFailMalformedHTLC { inner: unsafe { ObjOps::nonnull_ptr_to_inner((item as *const lightning::ln::msgs::UpdateFailMalformedHTLC<>) as *mut _) }, is_owned: false } }); };
        local_inner_val.into()
 }
 /// update_fail_malformed_htlc messages which should be sent
@@ -4725,7 +4718,7 @@ pub extern "C" fn CommitmentUpdate_set_update_fail_malformed_htlcs(this_ptr: &mu
 #[no_mangle]
 pub extern "C" fn CommitmentUpdate_get_update_fee(this_ptr: &CommitmentUpdate) -> crate::lightning::ln::msgs::UpdateFee {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().update_fee;
-       let mut local_inner_val = crate::lightning::ln::msgs::UpdateFee { inner: unsafe { (if inner_val.is_none() { std::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const _) as *mut _ }, is_owned: false };
+       let mut local_inner_val = crate::lightning::ln::msgs::UpdateFee { inner: unsafe { (if inner_val.is_none() { std::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::ln::msgs::UpdateFee<>) as *mut _ }, is_owned: false };
        local_inner_val
 }
 /// An update_fee message which should be sent
@@ -4740,7 +4733,7 @@ pub extern "C" fn CommitmentUpdate_set_update_fee(this_ptr: &mut CommitmentUpdat
 #[no_mangle]
 pub extern "C" fn CommitmentUpdate_get_commitment_signed(this_ptr: &CommitmentUpdate) -> crate::lightning::ln::msgs::CommitmentSigned {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().commitment_signed;
-       crate::lightning::ln::msgs::CommitmentSigned { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const _) as *mut _) }, is_owned: false }
+       crate::lightning::ln::msgs::CommitmentSigned { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::msgs::CommitmentSigned<>) as *mut _) }, is_owned: false }
 }
 /// Finally, the commitment_signed message which should be sent
 #[no_mangle]
@@ -4883,64 +4876,64 @@ impl lightning::util::events::MessageSendEventsProvider for ChannelMessageHandle
 use lightning::ln::msgs::ChannelMessageHandler as rustChannelMessageHandler;
 impl rustChannelMessageHandler for ChannelMessageHandler {
        fn handle_open_channel(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut their_features: lightning::ln::features::InitFeatures, mut msg: &lightning::ln::msgs::OpenChannel) {
-               (self.handle_open_channel)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), crate::lightning::ln::features::InitFeatures { inner: ObjOps::heap_alloc(their_features), is_owned: true }, &crate::lightning::ln::msgs::OpenChannel { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const _) as *mut _) }, is_owned: false })
+               (self.handle_open_channel)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), crate::lightning::ln::features::InitFeatures { inner: ObjOps::heap_alloc(their_features), is_owned: true }, &crate::lightning::ln::msgs::OpenChannel { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::OpenChannel<>) as *mut _) }, is_owned: false })
        }
        fn handle_accept_channel(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut their_features: lightning::ln::features::InitFeatures, mut msg: &lightning::ln::msgs::AcceptChannel) {
-               (self.handle_accept_channel)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), crate::lightning::ln::features::InitFeatures { inner: ObjOps::heap_alloc(their_features), is_owned: true }, &crate::lightning::ln::msgs::AcceptChannel { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const _) as *mut _) }, is_owned: false })
+               (self.handle_accept_channel)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), crate::lightning::ln::features::InitFeatures { inner: ObjOps::heap_alloc(their_features), is_owned: true }, &crate::lightning::ln::msgs::AcceptChannel { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::AcceptChannel<>) as *mut _) }, is_owned: false })
        }
        fn handle_funding_created(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::FundingCreated) {
-               (self.handle_funding_created)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::FundingCreated { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const _) as *mut _) }, is_owned: false })
+               (self.handle_funding_created)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::FundingCreated { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::FundingCreated<>) as *mut _) }, is_owned: false })
        }
        fn handle_funding_signed(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::FundingSigned) {
-               (self.handle_funding_signed)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::FundingSigned { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const _) as *mut _) }, is_owned: false })
+               (self.handle_funding_signed)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::FundingSigned { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::FundingSigned<>) as *mut _) }, is_owned: false })
        }
        fn handle_funding_locked(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::FundingLocked) {
-               (self.handle_funding_locked)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::FundingLocked { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const _) as *mut _) }, is_owned: false })
+               (self.handle_funding_locked)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::FundingLocked { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::FundingLocked<>) as *mut _) }, is_owned: false })
        }
        fn handle_shutdown(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut their_features: &lightning::ln::features::InitFeatures, mut msg: &lightning::ln::msgs::Shutdown) {
-               (self.handle_shutdown)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::features::InitFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((their_features as *const _) as *mut _) }, is_owned: false }, &crate::lightning::ln::msgs::Shutdown { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const _) as *mut _) }, is_owned: false })
+               (self.handle_shutdown)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::features::InitFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((their_features as *const lightning::ln::features::InitFeatures<>) as *mut _) }, is_owned: false }, &crate::lightning::ln::msgs::Shutdown { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::Shutdown<>) as *mut _) }, is_owned: false })
        }
        fn handle_closing_signed(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::ClosingSigned) {
-               (self.handle_closing_signed)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::ClosingSigned { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const _) as *mut _) }, is_owned: false })
+               (self.handle_closing_signed)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::ClosingSigned { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::ClosingSigned<>) as *mut _) }, is_owned: false })
        }
        fn handle_update_add_htlc(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::UpdateAddHTLC) {
-               (self.handle_update_add_htlc)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::UpdateAddHTLC { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const _) as *mut _) }, is_owned: false })
+               (self.handle_update_add_htlc)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::UpdateAddHTLC { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::UpdateAddHTLC<>) as *mut _) }, is_owned: false })
        }
        fn handle_update_fulfill_htlc(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::UpdateFulfillHTLC) {
-               (self.handle_update_fulfill_htlc)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::UpdateFulfillHTLC { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const _) as *mut _) }, is_owned: false })
+               (self.handle_update_fulfill_htlc)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::UpdateFulfillHTLC { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::UpdateFulfillHTLC<>) as *mut _) }, is_owned: false })
        }
        fn handle_update_fail_htlc(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::UpdateFailHTLC) {
-               (self.handle_update_fail_htlc)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::UpdateFailHTLC { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const _) as *mut _) }, is_owned: false })
+               (self.handle_update_fail_htlc)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::UpdateFailHTLC { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::UpdateFailHTLC<>) as *mut _) }, is_owned: false })
        }
        fn handle_update_fail_malformed_htlc(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::UpdateFailMalformedHTLC) {
-               (self.handle_update_fail_malformed_htlc)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::UpdateFailMalformedHTLC { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const _) as *mut _) }, is_owned: false })
+               (self.handle_update_fail_malformed_htlc)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::UpdateFailMalformedHTLC { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::UpdateFailMalformedHTLC<>) as *mut _) }, is_owned: false })
        }
        fn handle_commitment_signed(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::CommitmentSigned) {
-               (self.handle_commitment_signed)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::CommitmentSigned { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const _) as *mut _) }, is_owned: false })
+               (self.handle_commitment_signed)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::CommitmentSigned { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::CommitmentSigned<>) as *mut _) }, is_owned: false })
        }
        fn handle_revoke_and_ack(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::RevokeAndACK) {
-               (self.handle_revoke_and_ack)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::RevokeAndACK { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const _) as *mut _) }, is_owned: false })
+               (self.handle_revoke_and_ack)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::RevokeAndACK { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::RevokeAndACK<>) as *mut _) }, is_owned: false })
        }
        fn handle_update_fee(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::UpdateFee) {
-               (self.handle_update_fee)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::UpdateFee { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const _) as *mut _) }, is_owned: false })
+               (self.handle_update_fee)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::UpdateFee { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::UpdateFee<>) as *mut _) }, is_owned: false })
        }
        fn handle_announcement_signatures(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::AnnouncementSignatures) {
-               (self.handle_announcement_signatures)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::AnnouncementSignatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const _) as *mut _) }, is_owned: false })
+               (self.handle_announcement_signatures)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::AnnouncementSignatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::AnnouncementSignatures<>) as *mut _) }, is_owned: false })
        }
        fn peer_disconnected(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut no_connection_possible: bool) {
                (self.peer_disconnected)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), no_connection_possible)
        }
        fn peer_connected(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::Init) {
-               (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 _) as *mut _) }, is_owned: false })
+               (self.peer_connected)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::Init { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::Init<>) as *mut _) }, is_owned: false })
        }
        fn handle_channel_reestablish(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::ChannelReestablish) {
-               (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 _) as *mut _) }, is_owned: false })
+               (self.handle_channel_reestablish)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::ChannelReestablish { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::ChannelReestablish<>) as *mut _) }, is_owned: false })
        }
        fn handle_channel_update(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::ChannelUpdate) {
-               (self.handle_channel_update)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::ChannelUpdate { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const _) as *mut _) }, is_owned: false })
+               (self.handle_channel_update)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::ChannelUpdate { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::ChannelUpdate<>) as *mut _) }, is_owned: false })
        }
        fn handle_error(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::ErrorMessage) {
-               (self.handle_error)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::ErrorMessage { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const _) as *mut _) }, is_owned: false })
+               (self.handle_error)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::ErrorMessage { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::ErrorMessage<>) as *mut _) }, is_owned: false })
        }
 }
 
@@ -5059,17 +5052,17 @@ impl lightning::util::events::MessageSendEventsProvider for RoutingMessageHandle
 use lightning::ln::msgs::RoutingMessageHandler as rustRoutingMessageHandler;
 impl rustRoutingMessageHandler for RoutingMessageHandler {
        fn handle_node_announcement(&self, mut msg: &lightning::ln::msgs::NodeAnnouncement) -> Result<bool, lightning::ln::msgs::LightningError> {
-               let mut ret = (self.handle_node_announcement)(self.this_arg, &crate::lightning::ln::msgs::NodeAnnouncement { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const _) as *mut _) }, is_owned: false });
+               let mut ret = (self.handle_node_announcement)(self.this_arg, &crate::lightning::ln::msgs::NodeAnnouncement { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::NodeAnnouncement<>) 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((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).take_inner()) } })};
                local_ret
        }
        fn handle_channel_announcement(&self, mut msg: &lightning::ln::msgs::ChannelAnnouncement) -> Result<bool, lightning::ln::msgs::LightningError> {
-               let mut ret = (self.handle_channel_announcement)(self.this_arg, &crate::lightning::ln::msgs::ChannelAnnouncement { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const _) as *mut _) }, is_owned: false });
+               let mut ret = (self.handle_channel_announcement)(self.this_arg, &crate::lightning::ln::msgs::ChannelAnnouncement { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::ChannelAnnouncement<>) 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((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).take_inner()) } })};
                local_ret
        }
        fn handle_channel_update(&self, mut msg: &lightning::ln::msgs::ChannelUpdate) -> Result<bool, lightning::ln::msgs::LightningError> {
-               let mut ret = (self.handle_channel_update)(self.this_arg, &crate::lightning::ln::msgs::ChannelUpdate { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const _) as *mut _) }, is_owned: false });
+               let mut ret = (self.handle_channel_update)(self.this_arg, &crate::lightning::ln::msgs::ChannelUpdate { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::ChannelUpdate<>) 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((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).take_inner()) } })};
                local_ret
        }
@@ -5085,7 +5078,7 @@ impl rustRoutingMessageHandler for RoutingMessageHandler {
                local_ret
        }
        fn sync_routing_table(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut init: &lightning::ln::msgs::Init) {
-               (self.sync_routing_table)(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 _) as *mut _) }, is_owned: false })
+               (self.sync_routing_table)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::Init { inner: unsafe { ObjOps::nonnull_ptr_to_inner((init as *const lightning::ln::msgs::Init<>) as *mut _) }, is_owned: false })
        }
        fn handle_reply_channel_range(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: lightning::ln::msgs::ReplyChannelRange) -> Result<(), lightning::ln::msgs::LightningError> {
                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 });
index eeb69979afdd0d4dd243cd8a0983bf9e26d359e1..e701527548fec9bcf2f629c4b4d20fe0e54f3f0e 100644 (file)
@@ -97,7 +97,7 @@ impl Drop for CustomMessageHandler {
 }
 
 use lightning::ln::peer_handler::IgnoringMessageHandler as nativeIgnoringMessageHandlerImport;
-type nativeIgnoringMessageHandler = nativeIgnoringMessageHandlerImport;
+pub(crate) type nativeIgnoringMessageHandler = nativeIgnoringMessageHandlerImport;
 
 /// A dummy struct which implements `RoutingMessageHandler` without storing any routing information
 /// or doing any processing. You can provide one of these as the route_handler in a MessageHandler.
@@ -128,7 +128,7 @@ impl Drop for IgnoringMessageHandler {
 pub extern "C" fn IgnoringMessageHandler_free(this_obj: IgnoringMessageHandler) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn IgnoringMessageHandler_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn IgnoringMessageHandler_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeIgnoringMessageHandler); }
 }
 #[allow(unused)]
@@ -350,7 +350,7 @@ extern "C" fn IgnoringMessageHandler_CustomMessageHandler_get_and_clear_pending_
 
 
 use lightning::ln::peer_handler::ErroringMessageHandler as nativeErroringMessageHandlerImport;
-type nativeErroringMessageHandler = nativeErroringMessageHandlerImport;
+pub(crate) type nativeErroringMessageHandler = nativeErroringMessageHandlerImport;
 
 /// A dummy struct which implements `ChannelMessageHandler` without having any channels.
 /// You can provide one of these as the route_handler in a MessageHandler.
@@ -381,7 +381,7 @@ impl Drop for ErroringMessageHandler {
 pub extern "C" fn ErroringMessageHandler_free(this_obj: ErroringMessageHandler) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn ErroringMessageHandler_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn ErroringMessageHandler_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeErroringMessageHandler); }
 }
 #[allow(unused)]
@@ -544,7 +544,7 @@ extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_error(this_arg
 
 
 use lightning::ln::peer_handler::MessageHandler as nativeMessageHandlerImport;
-type nativeMessageHandler = nativeMessageHandlerImport<crate::lightning::ln::msgs::ChannelMessageHandler, crate::lightning::ln::msgs::RoutingMessageHandler>;
+pub(crate) type nativeMessageHandler = nativeMessageHandlerImport<crate::lightning::ln::msgs::ChannelMessageHandler, crate::lightning::ln::msgs::RoutingMessageHandler>;
 
 /// Provides references to trait impls which handle different types of messages.
 #[must_use]
@@ -574,7 +574,7 @@ impl Drop for MessageHandler {
 pub extern "C" fn MessageHandler_free(this_obj: MessageHandler) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn MessageHandler_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn MessageHandler_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeMessageHandler); }
 }
 #[allow(unused)]
@@ -758,7 +758,7 @@ impl Drop for SocketDescriptor {
 }
 
 use lightning::ln::peer_handler::PeerHandleError as nativePeerHandleErrorImport;
-type nativePeerHandleError = nativePeerHandleErrorImport;
+pub(crate) type nativePeerHandleError = nativePeerHandleErrorImport;
 
 /// Error for PeerManager errors. If you get one of these, you must disconnect the socket and
 /// generate no further read_event/write_buffer_space_avail/socket_disconnected calls for the
@@ -790,7 +790,7 @@ impl Drop for PeerHandleError {
 pub extern "C" fn PeerHandleError_free(this_obj: PeerHandleError) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn PeerHandleError_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn PeerHandleError_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativePeerHandleError); }
 }
 #[allow(unused)]
@@ -851,7 +851,7 @@ pub extern "C" fn PeerHandleError_clone(orig: &PeerHandleError) -> PeerHandleErr
 }
 
 use lightning::ln::peer_handler::PeerManager as nativePeerManagerImport;
-type nativePeerManager = nativePeerManagerImport<crate::lightning::ln::peer_handler::SocketDescriptor, crate::lightning::ln::msgs::ChannelMessageHandler, crate::lightning::ln::msgs::RoutingMessageHandler, crate::lightning::util::logger::Logger, crate::lightning::ln::peer_handler::CustomMessageHandler>;
+pub(crate) type nativePeerManager = nativePeerManagerImport<crate::lightning::ln::peer_handler::SocketDescriptor, crate::lightning::ln::msgs::ChannelMessageHandler, crate::lightning::ln::msgs::RoutingMessageHandler, crate::lightning::util::logger::Logger, crate::lightning::ln::peer_handler::CustomMessageHandler>;
 
 /// A PeerManager manages a set of peers, described by their [`SocketDescriptor`] and marshalls
 /// socket events into messages which it passes on to its [`MessageHandler`].
@@ -899,7 +899,7 @@ impl Drop for PeerManager {
 pub extern "C" fn PeerManager_free(this_obj: PeerManager) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn PeerManager_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn PeerManager_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativePeerManager); }
 }
 #[allow(unused)]
@@ -1058,6 +1058,14 @@ pub extern "C" fn PeerManager_disconnect_by_node_id(this_arg: &PeerManager, mut
        unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.disconnect_by_node_id(node_id.into_rust(), no_connection_possible)
 }
 
+/// Disconnects all currently-connected peers. This is useful on platforms where there may be
+/// an indication that TCP sockets have stalled even if we weren't around to time them out
+/// using regular ping/pongs.
+#[no_mangle]
+pub extern "C" fn PeerManager_disconnect_all_peers(this_arg: &PeerManager) {
+       unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.disconnect_all_peers()
+}
+
 /// Send pings to each peer and disconnect those which did not respond to the last round of
 /// pings.
 ///
index 0151ae22602b8fe4a4c6c4e386568c6d0de8d51c..0cac9563d143b33377fc54cc1dc76bc5ceda1242 100644 (file)
@@ -16,7 +16,7 @@ use crate::c_types::*;
 
 
 use lightning::ln::script::ShutdownScript as nativeShutdownScriptImport;
-type nativeShutdownScript = nativeShutdownScriptImport;
+pub(crate) type nativeShutdownScript = nativeShutdownScriptImport;
 
 /// A script pubkey for shutting down a channel as defined by [BOLT #2].
 ///
@@ -48,7 +48,7 @@ impl Drop for ShutdownScript {
 pub extern "C" fn ShutdownScript_free(this_obj: ShutdownScript) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn ShutdownScript_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn ShutdownScript_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeShutdownScript); }
 }
 #[allow(unused)]
@@ -88,7 +88,7 @@ pub extern "C" fn ShutdownScript_clone(orig: &ShutdownScript) -> ShutdownScript
 }
 
 use lightning::ln::script::InvalidShutdownScript as nativeInvalidShutdownScriptImport;
-type nativeInvalidShutdownScript = nativeInvalidShutdownScriptImport;
+pub(crate) type nativeInvalidShutdownScript = nativeInvalidShutdownScriptImport;
 
 /// An error occurring when converting from [`Script`] to [`ShutdownScript`].
 #[must_use]
@@ -118,7 +118,7 @@ impl Drop for InvalidShutdownScript {
 pub extern "C" fn InvalidShutdownScript_free(this_obj: InvalidShutdownScript) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn InvalidShutdownScript_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn InvalidShutdownScript_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeInvalidShutdownScript); }
 }
 #[allow(unused)]
index 8508d5dde1af4373ee7f8d4bf35bfcf066550d85..3348db0cdc70aa3439deb81ea6b2fbbb0f331bb0 100644 (file)
@@ -25,9 +25,14 @@ pub struct Score {
        /// 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 fee in msats willing to be paid to avoid routing through the given channel.
+       /// Returns the fee in msats willing to be paid to avoid routing through the given channel
+       /// in the direction from `source` to `target`.
        #[must_use]
-       pub channel_penalty_msat: extern "C" fn (this_arg: *const c_void, short_channel_id: u64) -> u64,
+       pub channel_penalty_msat: extern "C" fn (this_arg: *const c_void, short_channel_id: u64, source: &crate::lightning::routing::network_graph::NodeId, target: &crate::lightning::routing::network_graph::NodeId) -> u64,
+       /// Handles updating channel penalties after failing to route through a channel.
+       pub payment_path_failed: extern "C" fn (this_arg: *mut c_void, path: crate::c_types::derived::CVec_RouteHopZ, short_channel_id: u64),
+       /// 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)>,
@@ -39,16 +44,28 @@ pub(crate) extern "C" fn Score_clone_fields(orig: &Score) -> Score {
        Score {
                this_arg: orig.this_arg,
                channel_penalty_msat: Clone::clone(&orig.channel_penalty_msat),
+               payment_path_failed: Clone::clone(&orig.payment_path_failed),
+               write: Clone::clone(&orig.write),
                free: Clone::clone(&orig.free),
        }
 }
+impl lightning::util::ser::Writeable for Score {
+       fn write<W: lightning::util::ser::Writer>(&self, w: &mut W) -> Result<(), ::std::io::Error> {
+               let vec = (self.write)(self.this_arg);
+               w.write_all(vec.as_slice())
+       }
+}
 
 use lightning::routing::Score as rustScore;
 impl rustScore for Score {
-       fn channel_penalty_msat(&self, mut short_channel_id: u64) -> u64 {
-               let mut ret = (self.channel_penalty_msat)(self.this_arg, short_channel_id);
+       fn channel_penalty_msat(&self, mut short_channel_id: u64, mut source: &lightning::routing::network_graph::NodeId, mut target: &lightning::routing::network_graph::NodeId) -> u64 {
+               let mut ret = (self.channel_penalty_msat)(self.this_arg, short_channel_id, &crate::lightning::routing::network_graph::NodeId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((source as *const lightning::routing::network_graph::NodeId<>) as *mut _) }, is_owned: false }, &crate::lightning::routing::network_graph::NodeId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((target as *const lightning::routing::network_graph::NodeId<>) as *mut _) }, is_owned: false });
                ret
        }
+       fn payment_path_failed(&mut self, mut path: &[&lightning::routing::router::RouteHop], mut short_channel_id: u64) {
+               let mut local_path = Vec::new(); for item in path.iter() { local_path.push( { crate::lightning::routing::router::RouteHop { inner: unsafe { ObjOps::nonnull_ptr_to_inner(((*item) as *const lightning::routing::router::RouteHop<>) as *mut _) }, is_owned: false } }); };
+               (self.payment_path_failed)(self.this_arg, local_path.into(), short_channel_id)
+       }
 }
 
 // We're essentially a pointer already, or at least a set of pointers, so allow us to be used
@@ -69,3 +86,78 @@ impl Drop for Score {
                }
        }
 }
+
+use lightning::routing::LockableScore as nativeLockableScoreImport;
+pub(crate) type nativeLockableScore = nativeLockableScoreImport<crate::lightning::routing::Score>;
+
+/// A scorer that is accessed under a lock.
+///
+/// Needed so that calls to [`Score::channel_penalty_msat`] in [`find_route`] can be made while
+/// having shared ownership of a scorer but without requiring internal locking in [`Score`]
+/// implementations. Internal locking would be detrimental to route finding performance and could
+/// result in [`Score::channel_penalty_msat`] returning a different value for the same channel.
+///
+/// [`find_route`]: crate::routing::router::find_route
+#[must_use]
+#[repr(C)]
+pub struct LockableScore {
+       /// 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 nativeLockableScore,
+       /// Indicates that this is the only struct which contains the same pointer.
+
+       /// Rust functions which take ownership of an object provided via an argument require
+       /// this to be true and invalidate the object pointed to by inner.
+       pub is_owned: bool,
+}
+
+impl Drop for LockableScore {
+       fn drop(&mut self) {
+               if self.is_owned && !<*mut nativeLockableScore>::is_null(self.inner) {
+                       let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+               }
+       }
+}
+/// Frees any resources used by the LockableScore, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn LockableScore_free(this_obj: LockableScore) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn LockableScore_free_void(this_ptr: *mut c_void) {
+       unsafe { let _ = Box::from_raw(this_ptr as *mut nativeLockableScore); }
+}
+#[allow(unused)]
+impl LockableScore {
+       pub(crate) fn get_native_ref(&self) -> &'static nativeLockableScore {
+               unsafe { &*ObjOps::untweak_ptr(self.inner) }
+       }
+       pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeLockableScore {
+               unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
+       }
+       /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
+       pub(crate) fn take_inner(mut self) -> *mut nativeLockableScore {
+               assert!(self.is_owned);
+               let ret = ObjOps::untweak_ptr(self.inner);
+               self.inner = std::ptr::null_mut();
+               ret
+       }
+}
+/// Constructs a new LockableScore from a Score
+#[must_use]
+#[no_mangle]
+pub extern "C" fn LockableScore_new(mut score: crate::lightning::routing::Score) -> LockableScore {
+       let mut ret = lightning::routing::LockableScore::new(score);
+       LockableScore { inner: ObjOps::heap_alloc(ret), is_owned: true }
+}
+
+#[no_mangle]
+/// Serialize the LockableScore object into a byte array which can be read by LockableScore_read
+pub extern "C" fn LockableScore_write(obj: &LockableScore) -> crate::c_types::derived::CVec_u8Z {
+       crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
+}
+#[no_mangle]
+pub(crate) extern "C" fn LockableScore_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
+       crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeLockableScore) })
+}
index 425a0001363f7510bd2fc8149fe50199688cf83c..2f939ba61e356e2b8f97324226091f817edfa450 100644 (file)
@@ -16,7 +16,7 @@ use crate::c_types::*;
 
 
 use lightning::routing::network_graph::NodeId as nativeNodeIdImport;
-type nativeNodeId = nativeNodeIdImport;
+pub(crate) type nativeNodeId = nativeNodeIdImport;
 
 /// Represents the compressed public key of a node
 #[must_use]
@@ -46,7 +46,7 @@ impl Drop for NodeId {
 pub extern "C" fn NodeId_free(this_obj: NodeId) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn NodeId_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn NodeId_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeNodeId); }
 }
 #[allow(unused)]
@@ -129,7 +129,7 @@ pub extern "C" fn NodeId_read(ser: crate::c_types::u8slice) -> crate::c_types::d
 }
 
 use lightning::routing::network_graph::NetworkGraph as nativeNetworkGraphImport;
-type nativeNetworkGraph = nativeNetworkGraphImport;
+pub(crate) type nativeNetworkGraph = nativeNetworkGraphImport;
 
 /// Represents the network as nodes and channels between them
 #[must_use]
@@ -159,7 +159,7 @@ impl Drop for NetworkGraph {
 pub extern "C" fn NetworkGraph_free(this_obj: NetworkGraph) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn NetworkGraph_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn NetworkGraph_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeNetworkGraph); }
 }
 #[allow(unused)]
@@ -199,7 +199,7 @@ pub extern "C" fn NetworkGraph_clone(orig: &NetworkGraph) -> NetworkGraph {
 }
 
 use lightning::routing::network_graph::ReadOnlyNetworkGraph as nativeReadOnlyNetworkGraphImport;
-type nativeReadOnlyNetworkGraph = nativeReadOnlyNetworkGraphImport<'static>;
+pub(crate) type nativeReadOnlyNetworkGraph = nativeReadOnlyNetworkGraphImport<'static>;
 
 /// A read-only view of [`NetworkGraph`].
 #[must_use]
@@ -229,7 +229,7 @@ impl Drop for ReadOnlyNetworkGraph {
 pub extern "C" fn ReadOnlyNetworkGraph_free(this_obj: ReadOnlyNetworkGraph) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn ReadOnlyNetworkGraph_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn ReadOnlyNetworkGraph_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeReadOnlyNetworkGraph); }
 }
 #[allow(unused)]
@@ -445,7 +445,7 @@ extern "C" fn NetGraphMsgHandler_EventHandler_handle_event(this_arg: *const c_vo
 
 
 use lightning::routing::network_graph::NetGraphMsgHandler as nativeNetGraphMsgHandlerImport;
-type nativeNetGraphMsgHandler = nativeNetGraphMsgHandlerImport<crate::lightning::chain::Access, crate::lightning::util::logger::Logger>;
+pub(crate) type nativeNetGraphMsgHandler = nativeNetGraphMsgHandlerImport<&'static lightning::routing::network_graph::NetworkGraph, crate::lightning::chain::Access, crate::lightning::util::logger::Logger>;
 
 /// Receives and validates network updates from peers,
 /// stores authentic and relevant data as a network graph.
@@ -482,7 +482,7 @@ impl Drop for NetGraphMsgHandler {
 pub extern "C" fn NetGraphMsgHandler_free(this_obj: NetGraphMsgHandler) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn NetGraphMsgHandler_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn NetGraphMsgHandler_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeNetGraphMsgHandler); }
 }
 #[allow(unused)]
@@ -501,17 +501,6 @@ impl NetGraphMsgHandler {
                ret
        }
 }
-/// Representation of the payment channel network
-#[no_mangle]
-pub extern "C" fn NetGraphMsgHandler_get_network_graph(this_ptr: &NetGraphMsgHandler) -> crate::lightning::routing::network_graph::NetworkGraph {
-       let mut inner_val = &mut this_ptr.get_native_mut_ref().network_graph;
-       crate::lightning::routing::network_graph::NetworkGraph { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const _) as *mut _) }, is_owned: false }
-}
-/// Representation of the payment channel network
-#[no_mangle]
-pub extern "C" fn NetGraphMsgHandler_set_network_graph(this_ptr: &mut NetGraphMsgHandler, mut val: crate::lightning::routing::network_graph::NetworkGraph) {
-       unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.network_graph = *unsafe { Box::from_raw(val.take_inner()) };
-}
 /// Creates a new tracker of the actual state of the network of channels and nodes,
 /// assuming an existing Network Graph.
 /// Chain monitor is used to make sure announced channels exist on-chain,
@@ -519,9 +508,9 @@ pub extern "C" fn NetGraphMsgHandler_set_network_graph(this_ptr: &mut NetGraphMs
 /// channel owners' keys.
 #[must_use]
 #[no_mangle]
-pub extern "C" fn NetGraphMsgHandler_new(mut network_graph: crate::lightning::routing::network_graph::NetworkGraph, mut chain_access: crate::c_types::derived::COption_AccessZ, mut logger: crate::lightning::util::logger::Logger) -> NetGraphMsgHandler {
+pub extern "C" fn NetGraphMsgHandler_new(network_graph: &crate::lightning::routing::network_graph::NetworkGraph, mut chain_access: crate::c_types::derived::COption_AccessZ, mut logger: crate::lightning::util::logger::Logger) -> NetGraphMsgHandler {
        let mut local_chain_access = { /* chain_access*/ let chain_access_opt = chain_access; { } if chain_access_opt.is_none() { None } else { Some({ chain_access_opt.take() }) } };
-       let mut ret = lightning::routing::network_graph::NetGraphMsgHandler::new(*unsafe { Box::from_raw(network_graph.take_inner()) }, local_chain_access, logger);
+       let mut ret = lightning::routing::network_graph::NetGraphMsgHandler::new(network_graph.get_native_ref(), local_chain_access, logger);
        NetGraphMsgHandler { inner: ObjOps::heap_alloc(ret), is_owned: true }
 }
 
@@ -658,7 +647,7 @@ extern "C" fn NetGraphMsgHandler_MessageSendEventsProvider_get_and_clear_pending
 
 
 use lightning::routing::network_graph::DirectionalChannelInfo as nativeDirectionalChannelInfoImport;
-type nativeDirectionalChannelInfo = nativeDirectionalChannelInfoImport;
+pub(crate) type nativeDirectionalChannelInfo = nativeDirectionalChannelInfoImport;
 
 /// Details about one direction of a channel. Received
 /// within a channel update.
@@ -689,7 +678,7 @@ impl Drop for DirectionalChannelInfo {
 pub extern "C" fn DirectionalChannelInfo_free(this_obj: DirectionalChannelInfo) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn DirectionalChannelInfo_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn DirectionalChannelInfo_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeDirectionalChannelInfo); }
 }
 #[allow(unused)]
@@ -771,7 +760,7 @@ pub extern "C" fn DirectionalChannelInfo_set_htlc_maximum_msat(this_ptr: &mut Di
 #[no_mangle]
 pub extern "C" fn DirectionalChannelInfo_get_fees(this_ptr: &DirectionalChannelInfo) -> crate::lightning::routing::network_graph::RoutingFees {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().fees;
-       crate::lightning::routing::network_graph::RoutingFees { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const _) as *mut _) }, is_owned: false }
+       crate::lightning::routing::network_graph::RoutingFees { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::routing::network_graph::RoutingFees<>) as *mut _) }, is_owned: false }
 }
 /// Fees charged when the channel is used for routing
 #[no_mangle]
@@ -787,7 +776,7 @@ pub extern "C" fn DirectionalChannelInfo_set_fees(this_ptr: &mut DirectionalChan
 #[no_mangle]
 pub extern "C" fn DirectionalChannelInfo_get_last_update_message(this_ptr: &DirectionalChannelInfo) -> crate::lightning::ln::msgs::ChannelUpdate {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().last_update_message;
-       let mut local_inner_val = crate::lightning::ln::msgs::ChannelUpdate { inner: unsafe { (if inner_val.is_none() { std::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const _) as *mut _ }, is_owned: false };
+       let mut local_inner_val = crate::lightning::ln::msgs::ChannelUpdate { inner: unsafe { (if inner_val.is_none() { std::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::ln::msgs::ChannelUpdate<>) as *mut _ }, is_owned: false };
        local_inner_val
 }
 /// Most recent update for the channel received from the network
@@ -854,7 +843,7 @@ pub extern "C" fn DirectionalChannelInfo_read(ser: crate::c_types::u8slice) -> c
 }
 
 use lightning::routing::network_graph::ChannelInfo as nativeChannelInfoImport;
-type nativeChannelInfo = nativeChannelInfoImport;
+pub(crate) type nativeChannelInfo = nativeChannelInfoImport;
 
 /// Details about a channel (both directions).
 /// Received within a channel announcement.
@@ -885,7 +874,7 @@ impl Drop for ChannelInfo {
 pub extern "C" fn ChannelInfo_free(this_obj: ChannelInfo) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn ChannelInfo_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn ChannelInfo_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelInfo); }
 }
 #[allow(unused)]
@@ -908,7 +897,7 @@ impl ChannelInfo {
 #[no_mangle]
 pub extern "C" fn ChannelInfo_get_features(this_ptr: &ChannelInfo) -> crate::lightning::ln::features::ChannelFeatures {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().features;
-       crate::lightning::ln::features::ChannelFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const _) as *mut _) }, is_owned: false }
+       crate::lightning::ln::features::ChannelFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::features::ChannelFeatures<>) as *mut _) }, is_owned: false }
 }
 /// Protocol features of a channel communicated during its announcement
 #[no_mangle]
@@ -919,7 +908,7 @@ pub extern "C" fn ChannelInfo_set_features(this_ptr: &mut ChannelInfo, mut val:
 #[no_mangle]
 pub extern "C" fn ChannelInfo_get_node_one(this_ptr: &ChannelInfo) -> crate::lightning::routing::network_graph::NodeId {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().node_one;
-       crate::lightning::routing::network_graph::NodeId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const _) as *mut _) }, is_owned: false }
+       crate::lightning::routing::network_graph::NodeId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::routing::network_graph::NodeId<>) as *mut _) }, is_owned: false }
 }
 /// Source node of the first direction of a channel
 #[no_mangle]
@@ -932,7 +921,7 @@ pub extern "C" fn ChannelInfo_set_node_one(this_ptr: &mut ChannelInfo, mut val:
 #[no_mangle]
 pub extern "C" fn ChannelInfo_get_one_to_two(this_ptr: &ChannelInfo) -> crate::lightning::routing::network_graph::DirectionalChannelInfo {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().one_to_two;
-       let mut local_inner_val = crate::lightning::routing::network_graph::DirectionalChannelInfo { inner: unsafe { (if inner_val.is_none() { std::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const _) as *mut _ }, is_owned: false };
+       let mut local_inner_val = crate::lightning::routing::network_graph::DirectionalChannelInfo { inner: unsafe { (if inner_val.is_none() { std::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::routing::network_graph::DirectionalChannelInfo<>) as *mut _ }, is_owned: false };
        local_inner_val
 }
 /// Details about the first direction of a channel
@@ -947,7 +936,7 @@ pub extern "C" fn ChannelInfo_set_one_to_two(this_ptr: &mut ChannelInfo, mut val
 #[no_mangle]
 pub extern "C" fn ChannelInfo_get_node_two(this_ptr: &ChannelInfo) -> crate::lightning::routing::network_graph::NodeId {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().node_two;
-       crate::lightning::routing::network_graph::NodeId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const _) as *mut _) }, is_owned: false }
+       crate::lightning::routing::network_graph::NodeId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::routing::network_graph::NodeId<>) as *mut _) }, is_owned: false }
 }
 /// Source node of the second direction of a channel
 #[no_mangle]
@@ -960,7 +949,7 @@ pub extern "C" fn ChannelInfo_set_node_two(this_ptr: &mut ChannelInfo, mut val:
 #[no_mangle]
 pub extern "C" fn ChannelInfo_get_two_to_one(this_ptr: &ChannelInfo) -> crate::lightning::routing::network_graph::DirectionalChannelInfo {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().two_to_one;
-       let mut local_inner_val = crate::lightning::routing::network_graph::DirectionalChannelInfo { inner: unsafe { (if inner_val.is_none() { std::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const _) as *mut _ }, is_owned: false };
+       let mut local_inner_val = crate::lightning::routing::network_graph::DirectionalChannelInfo { inner: unsafe { (if inner_val.is_none() { std::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::routing::network_graph::DirectionalChannelInfo<>) as *mut _ }, is_owned: false };
        local_inner_val
 }
 /// Details about the second direction of a channel
@@ -993,7 +982,7 @@ pub extern "C" fn ChannelInfo_set_capacity_sats(this_ptr: &mut ChannelInfo, mut
 #[no_mangle]
 pub extern "C" fn ChannelInfo_get_announcement_message(this_ptr: &ChannelInfo) -> crate::lightning::ln::msgs::ChannelAnnouncement {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().announcement_message;
-       let mut local_inner_val = crate::lightning::ln::msgs::ChannelAnnouncement { inner: unsafe { (if inner_val.is_none() { std::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const _) as *mut _ }, is_owned: false };
+       let mut local_inner_val = crate::lightning::ln::msgs::ChannelAnnouncement { inner: unsafe { (if inner_val.is_none() { std::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::ln::msgs::ChannelAnnouncement<>) as *mut _ }, is_owned: false };
        local_inner_val
 }
 /// An initial announcement of the channel
@@ -1062,7 +1051,7 @@ pub extern "C" fn ChannelInfo_read(ser: crate::c_types::u8slice) -> crate::c_typ
 }
 
 use lightning::routing::network_graph::RoutingFees as nativeRoutingFeesImport;
-type nativeRoutingFees = nativeRoutingFeesImport;
+pub(crate) type nativeRoutingFees = nativeRoutingFeesImport;
 
 /// Fees for routing via a given channel or a node
 #[must_use]
@@ -1092,7 +1081,7 @@ impl Drop for RoutingFees {
 pub extern "C" fn RoutingFees_free(this_obj: RoutingFees) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn RoutingFees_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn RoutingFees_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeRoutingFees); }
 }
 #[allow(unused)]
@@ -1200,7 +1189,7 @@ pub extern "C" fn RoutingFees_read(ser: crate::c_types::u8slice) -> crate::c_typ
 }
 
 use lightning::routing::network_graph::NodeAnnouncementInfo as nativeNodeAnnouncementInfoImport;
-type nativeNodeAnnouncementInfo = nativeNodeAnnouncementInfoImport;
+pub(crate) type nativeNodeAnnouncementInfo = nativeNodeAnnouncementInfoImport;
 
 /// Information received in the latest node_announcement from this node.
 #[must_use]
@@ -1230,7 +1219,7 @@ impl Drop for NodeAnnouncementInfo {
 pub extern "C" fn NodeAnnouncementInfo_free(this_obj: NodeAnnouncementInfo) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn NodeAnnouncementInfo_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn NodeAnnouncementInfo_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeNodeAnnouncementInfo); }
 }
 #[allow(unused)]
@@ -1253,7 +1242,7 @@ impl NodeAnnouncementInfo {
 #[no_mangle]
 pub extern "C" fn NodeAnnouncementInfo_get_features(this_ptr: &NodeAnnouncementInfo) -> crate::lightning::ln::features::NodeFeatures {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().features;
-       crate::lightning::ln::features::NodeFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const _) as *mut _) }, is_owned: false }
+       crate::lightning::ln::features::NodeFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::features::NodeFeatures<>) as *mut _) }, is_owned: false }
 }
 /// Protocol features the node announced support for
 #[no_mangle]
@@ -1314,7 +1303,7 @@ pub extern "C" fn NodeAnnouncementInfo_set_addresses(this_ptr: &mut NodeAnnounce
 #[no_mangle]
 pub extern "C" fn NodeAnnouncementInfo_get_announcement_message(this_ptr: &NodeAnnouncementInfo) -> crate::lightning::ln::msgs::NodeAnnouncement {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().announcement_message;
-       let mut local_inner_val = crate::lightning::ln::msgs::NodeAnnouncement { inner: unsafe { (if inner_val.is_none() { std::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const _) as *mut _ }, is_owned: false };
+       let mut local_inner_val = crate::lightning::ln::msgs::NodeAnnouncement { inner: unsafe { (if inner_val.is_none() { std::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::ln::msgs::NodeAnnouncement<>) as *mut _ }, is_owned: false };
        local_inner_val
 }
 /// An initial announcement of the node
@@ -1380,7 +1369,7 @@ pub extern "C" fn NodeAnnouncementInfo_read(ser: crate::c_types::u8slice) -> cra
 }
 
 use lightning::routing::network_graph::NodeInfo as nativeNodeInfoImport;
-type nativeNodeInfo = nativeNodeInfoImport;
+pub(crate) type nativeNodeInfo = nativeNodeInfoImport;
 
 /// Details about a node in the network, known from the network announcement.
 #[must_use]
@@ -1410,7 +1399,7 @@ impl Drop for NodeInfo {
 pub extern "C" fn NodeInfo_free(this_obj: NodeInfo) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn NodeInfo_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn NodeInfo_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeNodeInfo); }
 }
 #[allow(unused)]
@@ -1443,7 +1432,7 @@ pub extern "C" fn NodeInfo_set_channels(this_ptr: &mut NodeInfo, mut val: crate:
 #[no_mangle]
 pub extern "C" fn NodeInfo_get_lowest_inbound_channel_fees(this_ptr: &NodeInfo) -> crate::lightning::routing::network_graph::RoutingFees {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().lowest_inbound_channel_fees;
-       let mut local_inner_val = crate::lightning::routing::network_graph::RoutingFees { inner: unsafe { (if inner_val.is_none() { std::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const _) as *mut _ }, is_owned: false };
+       let mut local_inner_val = crate::lightning::routing::network_graph::RoutingFees { inner: unsafe { (if inner_val.is_none() { std::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::routing::network_graph::RoutingFees<>) as *mut _ }, is_owned: false };
        local_inner_val
 }
 /// Lowest fees enabling routing via any of the enabled, known channels to a node.
@@ -1464,7 +1453,7 @@ pub extern "C" fn NodeInfo_set_lowest_inbound_channel_fees(this_ptr: &mut NodeIn
 #[no_mangle]
 pub extern "C" fn NodeInfo_get_announcement_info(this_ptr: &NodeInfo) -> crate::lightning::routing::network_graph::NodeAnnouncementInfo {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().announcement_info;
-       let mut local_inner_val = crate::lightning::routing::network_graph::NodeAnnouncementInfo { inner: unsafe { (if inner_val.is_none() { std::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const _) as *mut _ }, is_owned: false };
+       let mut local_inner_val = crate::lightning::routing::network_graph::NodeAnnouncementInfo { inner: unsafe { (if inner_val.is_none() { std::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::routing::network_graph::NodeAnnouncementInfo<>) as *mut _ }, is_owned: false };
        local_inner_val
 }
 /// More information about a node from node_announcement.
index 5b5368d81120d4407ffac94edef20c64517bf2e4..04be1c5d9f0b038ca151737f19e3eb25e49853dc 100644 (file)
@@ -19,7 +19,7 @@ use crate::c_types::*;
 
 
 use lightning::routing::router::RouteHop as nativeRouteHopImport;
-type nativeRouteHop = nativeRouteHopImport;
+pub(crate) type nativeRouteHop = nativeRouteHopImport;
 
 /// A hop in a route
 #[must_use]
@@ -49,7 +49,7 @@ impl Drop for RouteHop {
 pub extern "C" fn RouteHop_free(this_obj: RouteHop) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn RouteHop_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn RouteHop_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeRouteHop); }
 }
 #[allow(unused)]
@@ -84,7 +84,7 @@ pub extern "C" fn RouteHop_set_pubkey(this_ptr: &mut RouteHop, mut val: crate::c
 #[no_mangle]
 pub extern "C" fn RouteHop_get_node_features(this_ptr: &RouteHop) -> crate::lightning::ln::features::NodeFeatures {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().node_features;
-       crate::lightning::ln::features::NodeFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const _) as *mut _) }, is_owned: false }
+       crate::lightning::ln::features::NodeFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::features::NodeFeatures<>) as *mut _) }, is_owned: false }
 }
 /// The node_announcement features of the node at this hop. For the last hop, these may be
 /// amended to match the features present in the invoice this node generated.
@@ -108,7 +108,7 @@ pub extern "C" fn RouteHop_set_short_channel_id(this_ptr: &mut RouteHop, mut val
 #[no_mangle]
 pub extern "C" fn RouteHop_get_channel_features(this_ptr: &RouteHop) -> crate::lightning::ln::features::ChannelFeatures {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_features;
-       crate::lightning::ln::features::ChannelFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const _) as *mut _) }, is_owned: false }
+       crate::lightning::ln::features::ChannelFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::features::ChannelFeatures<>) as *mut _) }, is_owned: false }
 }
 /// The channel_announcement features of the channel that should be used from the previous hop
 /// to reach this node.
@@ -213,7 +213,7 @@ pub extern "C" fn RouteHop_read(ser: crate::c_types::u8slice) -> crate::c_types:
 }
 
 use lightning::routing::router::Route as nativeRouteImport;
-type nativeRoute = nativeRouteImport;
+pub(crate) type nativeRoute = nativeRouteImport;
 
 /// A route directs a payment from the sender (us) to the recipient. If the recipient supports MPP,
 /// it can take multiple paths. Each path is composed of one or more hops through the network.
@@ -244,7 +244,7 @@ impl Drop for Route {
 pub extern "C" fn Route_free(this_obj: Route) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn Route_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn Route_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeRoute); }
 }
 #[allow(unused)]
@@ -272,7 +272,7 @@ impl Route {
 #[no_mangle]
 pub extern "C" fn Route_get_paths(this_ptr: &Route) -> crate::c_types::derived::CVec_CVec_RouteHopZZ {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().paths;
-       let mut local_inner_val = Vec::new(); for item in inner_val.iter() { local_inner_val.push( { let mut local_inner_val_0 = Vec::new(); for item in item.iter() { local_inner_val_0.push( { crate::lightning::routing::router::RouteHop { inner: unsafe { ObjOps::nonnull_ptr_to_inner((item as *const _) as *mut _) }, is_owned: false } }); }; local_inner_val_0.into() }); };
+       let mut local_inner_val = Vec::new(); for item in inner_val.iter() { local_inner_val.push( { let mut local_inner_val_0 = Vec::new(); for item in item.iter() { local_inner_val_0.push( { crate::lightning::routing::router::RouteHop { inner: unsafe { ObjOps::nonnull_ptr_to_inner((item as *const lightning::routing::router::RouteHop<>) as *mut _) }, is_owned: false } }); }; local_inner_val_0.into() }); };
        local_inner_val.into()
 }
 /// The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
@@ -286,13 +286,40 @@ pub extern "C" fn Route_set_paths(this_ptr: &mut Route, mut val: crate::c_types:
        let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { let mut local_val_0 = Vec::new(); for mut item in item.into_rust().drain(..) { local_val_0.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; local_val_0 }); };
        unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.paths = local_val;
 }
+/// The `payee` parameter passed to [`find_route`].
+/// This is used by `ChannelManager` to track information which may be required for retries,
+/// provided back to you via [`Event::PaymentPathFailed`].
+///
+/// [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
+///
+/// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
+#[no_mangle]
+pub extern "C" fn Route_get_payee(this_ptr: &Route) -> crate::lightning::routing::router::Payee {
+       let mut inner_val = &mut this_ptr.get_native_mut_ref().payee;
+       let mut local_inner_val = crate::lightning::routing::router::Payee { inner: unsafe { (if inner_val.is_none() { std::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::routing::router::Payee<>) as *mut _ }, is_owned: false };
+       local_inner_val
+}
+/// The `payee` parameter passed to [`find_route`].
+/// This is used by `ChannelManager` to track information which may be required for retries,
+/// provided back to you via [`Event::PaymentPathFailed`].
+///
+/// [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
+///
+/// Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
+#[no_mangle]
+pub extern "C" fn Route_set_payee(this_ptr: &mut Route, mut val: crate::lightning::routing::router::Payee) {
+       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) }.payee = local_val;
+}
 /// Constructs a new Route given each field
 #[must_use]
 #[no_mangle]
-pub extern "C" fn Route_new(mut paths_arg: crate::c_types::derived::CVec_CVec_RouteHopZZ) -> Route {
+pub extern "C" fn Route_new(mut paths_arg: crate::c_types::derived::CVec_CVec_RouteHopZZ, mut payee_arg: crate::lightning::routing::router::Payee) -> Route {
        let mut local_paths_arg = Vec::new(); for mut item in paths_arg.into_rust().drain(..) { local_paths_arg.push( { let mut local_paths_arg_0 = Vec::new(); for mut item in item.into_rust().drain(..) { local_paths_arg_0.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; local_paths_arg_0 }); };
+       let mut local_payee_arg = if payee_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(payee_arg.take_inner()) } }) };
        Route { inner: ObjOps::heap_alloc(nativeRoute {
                paths: local_paths_arg,
+               payee: local_payee_arg,
        }), is_owned: true }
 }
 impl Clone for Route {
@@ -336,7 +363,7 @@ pub extern "C" fn Route_eq(a: &Route, b: &Route) -> bool {
 /// Returns the total amount of fees paid on this [`Route`].
 ///
 /// This doesn't include any extra payment made to the recipient, which can happen in excess of
-/// the amount passed to [`get_route`]'s `final_value_msat`.
+/// the amount passed to [`find_route`]'s `params.final_value_msat`.
 #[must_use]
 #[no_mangle]
 pub extern "C" fn Route_get_total_fees(this_arg: &Route) -> u64 {
@@ -369,8 +396,341 @@ pub extern "C" fn Route_read(ser: crate::c_types::u8slice) -> crate::c_types::de
        local_res
 }
 
+use lightning::routing::router::RouteParameters as nativeRouteParametersImport;
+pub(crate) type nativeRouteParameters = nativeRouteParametersImport;
+
+/// Parameters needed to find a [`Route`] for paying a [`Payee`].
+///
+/// Passed to [`find_route`] and also provided in [`Event::PaymentPathFailed`] for retrying a failed
+/// payment path.
+///
+/// [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
+#[must_use]
+#[repr(C)]
+pub struct RouteParameters {
+       /// 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 nativeRouteParameters,
+       /// Indicates that this is the only struct which contains the same pointer.
+
+       /// Rust functions which take ownership of an object provided via an argument require
+       /// this to be true and invalidate the object pointed to by inner.
+       pub is_owned: bool,
+}
+
+impl Drop for RouteParameters {
+       fn drop(&mut self) {
+               if self.is_owned && !<*mut nativeRouteParameters>::is_null(self.inner) {
+                       let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+               }
+       }
+}
+/// Frees any resources used by the RouteParameters, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn RouteParameters_free(this_obj: RouteParameters) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn RouteParameters_free_void(this_ptr: *mut c_void) {
+       unsafe { let _ = Box::from_raw(this_ptr as *mut nativeRouteParameters); }
+}
+#[allow(unused)]
+impl RouteParameters {
+       pub(crate) fn get_native_ref(&self) -> &'static nativeRouteParameters {
+               unsafe { &*ObjOps::untweak_ptr(self.inner) }
+       }
+       pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeRouteParameters {
+               unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
+       }
+       /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
+       pub(crate) fn take_inner(mut self) -> *mut nativeRouteParameters {
+               assert!(self.is_owned);
+               let ret = ObjOps::untweak_ptr(self.inner);
+               self.inner = std::ptr::null_mut();
+               ret
+       }
+}
+/// The recipient of the failed payment path.
+#[no_mangle]
+pub extern "C" fn RouteParameters_get_payee(this_ptr: &RouteParameters) -> crate::lightning::routing::router::Payee {
+       let mut inner_val = &mut this_ptr.get_native_mut_ref().payee;
+       crate::lightning::routing::router::Payee { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::routing::router::Payee<>) as *mut _) }, is_owned: false }
+}
+/// The recipient of the failed payment path.
+#[no_mangle]
+pub extern "C" fn RouteParameters_set_payee(this_ptr: &mut RouteParameters, mut val: crate::lightning::routing::router::Payee) {
+       unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.payee = *unsafe { Box::from_raw(val.take_inner()) };
+}
+/// The amount in msats sent on the failed payment path.
+#[no_mangle]
+pub extern "C" fn RouteParameters_get_final_value_msat(this_ptr: &RouteParameters) -> u64 {
+       let mut inner_val = &mut this_ptr.get_native_mut_ref().final_value_msat;
+       *inner_val
+}
+/// The amount in msats sent on the failed payment path.
+#[no_mangle]
+pub extern "C" fn RouteParameters_set_final_value_msat(this_ptr: &mut RouteParameters, mut val: u64) {
+       unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.final_value_msat = val;
+}
+/// The CLTV on the final hop of the failed payment path.
+#[no_mangle]
+pub extern "C" fn RouteParameters_get_final_cltv_expiry_delta(this_ptr: &RouteParameters) -> u32 {
+       let mut inner_val = &mut this_ptr.get_native_mut_ref().final_cltv_expiry_delta;
+       *inner_val
+}
+/// The CLTV on the final hop of the failed payment path.
+#[no_mangle]
+pub extern "C" fn RouteParameters_set_final_cltv_expiry_delta(this_ptr: &mut RouteParameters, mut val: u32) {
+       unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.final_cltv_expiry_delta = val;
+}
+/// Constructs a new RouteParameters given each field
+#[must_use]
+#[no_mangle]
+pub extern "C" fn RouteParameters_new(mut payee_arg: crate::lightning::routing::router::Payee, mut final_value_msat_arg: u64, mut final_cltv_expiry_delta_arg: u32) -> RouteParameters {
+       RouteParameters { inner: ObjOps::heap_alloc(nativeRouteParameters {
+               payee: *unsafe { Box::from_raw(payee_arg.take_inner()) },
+               final_value_msat: final_value_msat_arg,
+               final_cltv_expiry_delta: final_cltv_expiry_delta_arg,
+       }), is_owned: true }
+}
+impl Clone for RouteParameters {
+       fn clone(&self) -> Self {
+               Self {
+                       inner: if <*mut nativeRouteParameters>::is_null(self.inner) { std::ptr::null_mut() } else {
+                               ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
+                       is_owned: true,
+               }
+       }
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn RouteParameters_clone_void(this_ptr: *const c_void) -> *mut c_void {
+       Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeRouteParameters)).clone() })) as *mut c_void
+}
+#[no_mangle]
+/// Creates a copy of the RouteParameters
+pub extern "C" fn RouteParameters_clone(orig: &RouteParameters) -> RouteParameters {
+       orig.clone()
+}
+#[no_mangle]
+/// Serialize the RouteParameters object into a byte array which can be read by RouteParameters_read
+pub extern "C" fn RouteParameters_write(obj: &RouteParameters) -> crate::c_types::derived::CVec_u8Z {
+       crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
+}
+#[no_mangle]
+pub(crate) extern "C" fn RouteParameters_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
+       crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeRouteParameters) })
+}
+#[no_mangle]
+/// 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 = 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() };
+       local_res
+}
+
+use lightning::routing::router::Payee as nativePayeeImport;
+pub(crate) type nativePayee = nativePayeeImport;
+
+/// The recipient of a payment.
+#[must_use]
+#[repr(C)]
+pub struct Payee {
+       /// 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 nativePayee,
+       /// Indicates that this is the only struct which contains the same pointer.
+
+       /// Rust functions which take ownership of an object provided via an argument require
+       /// this to be true and invalidate the object pointed to by inner.
+       pub is_owned: bool,
+}
+
+impl Drop for Payee {
+       fn drop(&mut self) {
+               if self.is_owned && !<*mut nativePayee>::is_null(self.inner) {
+                       let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+               }
+       }
+}
+/// Frees any resources used by the Payee, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn Payee_free(this_obj: Payee) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn Payee_free_void(this_ptr: *mut c_void) {
+       unsafe { let _ = Box::from_raw(this_ptr as *mut nativePayee); }
+}
+#[allow(unused)]
+impl Payee {
+       pub(crate) fn get_native_ref(&self) -> &'static nativePayee {
+               unsafe { &*ObjOps::untweak_ptr(self.inner) }
+       }
+       pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativePayee {
+               unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
+       }
+       /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
+       pub(crate) fn take_inner(mut self) -> *mut nativePayee {
+               assert!(self.is_owned);
+               let ret = ObjOps::untweak_ptr(self.inner);
+               self.inner = std::ptr::null_mut();
+               ret
+       }
+}
+/// The node id of the payee.
+#[no_mangle]
+pub extern "C" fn Payee_get_pubkey(this_ptr: &Payee) -> crate::c_types::PublicKey {
+       let mut inner_val = &mut this_ptr.get_native_mut_ref().pubkey;
+       crate::c_types::PublicKey::from_rust(&inner_val)
+}
+/// The node id of the payee.
+#[no_mangle]
+pub extern "C" fn Payee_set_pubkey(this_ptr: &mut Payee, mut val: crate::c_types::PublicKey) {
+       unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.pubkey = val.into_rust();
+}
+/// Features supported by the payee.
+///
+/// May be set from the payee's invoice or via [`for_keysend`]. May be `None` if the invoice
+/// does not contain any features.
+///
+/// [`for_keysend`]: Self::for_keysend
+///
+/// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
+#[no_mangle]
+pub extern "C" fn Payee_get_features(this_ptr: &Payee) -> crate::lightning::ln::features::InvoiceFeatures {
+       let mut inner_val = &mut this_ptr.get_native_mut_ref().features;
+       let mut local_inner_val = crate::lightning::ln::features::InvoiceFeatures { inner: unsafe { (if inner_val.is_none() { std::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::ln::features::InvoiceFeatures<>) as *mut _ }, is_owned: false };
+       local_inner_val
+}
+/// Features supported by the payee.
+///
+/// May be set from the payee's invoice or via [`for_keysend`]. May be `None` if the invoice
+/// does not contain any features.
+///
+/// [`for_keysend`]: Self::for_keysend
+///
+/// Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
+#[no_mangle]
+pub extern "C" fn Payee_set_features(this_ptr: &mut Payee, mut val: crate::lightning::ln::features::InvoiceFeatures) {
+       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) }.features = local_val;
+}
+/// Hints for routing to the payee, containing channels connecting the payee to public nodes.
+#[no_mangle]
+pub extern "C" fn Payee_get_route_hints(this_ptr: &Payee) -> crate::c_types::derived::CVec_RouteHintZ {
+       let mut inner_val = &mut this_ptr.get_native_mut_ref().route_hints;
+       let mut local_inner_val = Vec::new(); for item in inner_val.iter() { local_inner_val.push( { crate::lightning::routing::router::RouteHint { inner: unsafe { ObjOps::nonnull_ptr_to_inner((item as *const lightning::routing::router::RouteHint<>) as *mut _) }, is_owned: false } }); };
+       local_inner_val.into()
+}
+/// Hints for routing to the payee, containing channels connecting the payee to public nodes.
+#[no_mangle]
+pub extern "C" fn Payee_set_route_hints(this_ptr: &mut Payee, mut val: crate::c_types::derived::CVec_RouteHintZ) {
+       let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { *unsafe { Box::from_raw(item.take_inner()) } }); };
+       unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.route_hints = local_val;
+}
+/// Expiration of a payment to the payee, in seconds relative to the UNIX epoch.
+#[no_mangle]
+pub extern "C" fn Payee_get_expiry_time(this_ptr: &Payee) -> crate::c_types::derived::COption_u64Z {
+       let mut inner_val = &mut this_ptr.get_native_mut_ref().expiry_time;
+       let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { inner_val.unwrap() }) };
+       local_inner_val
+}
+/// Expiration of a payment to the payee, in seconds relative to the UNIX epoch.
+#[no_mangle]
+pub extern "C" fn Payee_set_expiry_time(this_ptr: &mut Payee, mut val: crate::c_types::derived::COption_u64Z) {
+       let mut local_val = if val.is_some() { Some( { val.take() }) } else { None };
+       unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.expiry_time = local_val;
+}
+/// Constructs a new Payee given each field
+#[must_use]
+#[no_mangle]
+pub extern "C" fn Payee_new(mut pubkey_arg: crate::c_types::PublicKey, mut features_arg: crate::lightning::ln::features::InvoiceFeatures, mut route_hints_arg: crate::c_types::derived::CVec_RouteHintZ, mut expiry_time_arg: crate::c_types::derived::COption_u64Z) -> Payee {
+       let mut local_features_arg = if features_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(features_arg.take_inner()) } }) };
+       let mut local_route_hints_arg = Vec::new(); for mut item in route_hints_arg.into_rust().drain(..) { local_route_hints_arg.push( { *unsafe { Box::from_raw(item.take_inner()) } }); };
+       let mut local_expiry_time_arg = if expiry_time_arg.is_some() { Some( { expiry_time_arg.take() }) } else { None };
+       Payee { inner: ObjOps::heap_alloc(nativePayee {
+               pubkey: pubkey_arg.into_rust(),
+               features: local_features_arg,
+               route_hints: local_route_hints_arg,
+               expiry_time: local_expiry_time_arg,
+       }), is_owned: true }
+}
+impl Clone for Payee {
+       fn clone(&self) -> Self {
+               Self {
+                       inner: if <*mut nativePayee>::is_null(self.inner) { std::ptr::null_mut() } else {
+                               ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
+                       is_owned: true,
+               }
+       }
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn Payee_clone_void(this_ptr: *const c_void) -> *mut c_void {
+       Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativePayee)).clone() })) as *mut c_void
+}
+#[no_mangle]
+/// Creates a copy of the Payee
+pub extern "C" fn Payee_clone(orig: &Payee) -> Payee {
+       orig.clone()
+}
+/// Checks if two Payees contain equal inner contents.
+#[no_mangle]
+pub extern "C" fn Payee_hash(o: &Payee) -> u64 {
+       if o.inner.is_null() { return 0; }
+       // Note that we'd love to use std::collections::hash_map::DefaultHasher but it's not in core
+       #[allow(deprecated)]
+       let mut hasher = core::hash::SipHasher::new();
+       std::hash::Hash::hash(o.get_native_ref(), &mut hasher);
+       std::hash::Hasher::finish(&hasher)
+}
+/// Checks if two Payees 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 Payee_eq(a: &Payee, b: &Payee) -> 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 Payee object into a byte array which can be read by Payee_read
+pub extern "C" fn Payee_write(obj: &Payee) -> crate::c_types::derived::CVec_u8Z {
+       crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
+}
+#[no_mangle]
+pub(crate) extern "C" fn Payee_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
+       crate::c_types::serialize_obj(unsafe { &*(obj as *const nativePayee) })
+}
+#[no_mangle]
+/// Read a Payee from a byte array, created by Payee_write
+pub extern "C" fn Payee_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_PayeeDecodeErrorZ {
+       let res = crate::c_types::deserialize_obj(ser);
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::router::Payee { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       local_res
+}
+/// Creates a payee with the node id of the given `pubkey`.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn Payee_from_node_id(mut pubkey: crate::c_types::PublicKey) -> Payee {
+       let mut ret = lightning::routing::router::Payee::from_node_id(pubkey.into_rust());
+       Payee { inner: ObjOps::heap_alloc(ret), is_owned: true }
+}
+
+/// Creates a payee with the node id of the given `pubkey` to use for keysend payments.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn Payee_for_keysend(mut pubkey: crate::c_types::PublicKey) -> Payee {
+       let mut ret = lightning::routing::router::Payee::for_keysend(pubkey.into_rust());
+       Payee { inner: ObjOps::heap_alloc(ret), is_owned: true }
+}
+
+
 use lightning::routing::router::RouteHint as nativeRouteHintImport;
-type nativeRouteHint = nativeRouteHintImport;
+pub(crate) type nativeRouteHint = nativeRouteHintImport;
 
 /// A list of hops along a payment path terminating with a channel to the recipient.
 #[must_use]
@@ -400,7 +760,7 @@ impl Drop for RouteHint {
 pub extern "C" fn RouteHint_free(this_obj: RouteHint) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn RouteHint_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn RouteHint_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeRouteHint); }
 }
 #[allow(unused)]
@@ -419,6 +779,26 @@ impl RouteHint {
                ret
        }
 }
+#[no_mangle]
+pub extern "C" fn RouteHint_get_a(this_ptr: &RouteHint) -> crate::c_types::derived::CVec_RouteHintHopZ {
+       let mut inner_val = &mut this_ptr.get_native_mut_ref().0;
+       let mut local_inner_val = Vec::new(); for item in inner_val.iter() { local_inner_val.push( { crate::lightning::routing::router::RouteHintHop { inner: unsafe { ObjOps::nonnull_ptr_to_inner((item as *const lightning::routing::router::RouteHintHop<>) as *mut _) }, is_owned: false } }); };
+       local_inner_val.into()
+}
+#[no_mangle]
+pub extern "C" fn RouteHint_set_a(this_ptr: &mut RouteHint, mut val: crate::c_types::derived::CVec_RouteHintHopZ) {
+       let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { *unsafe { Box::from_raw(item.take_inner()) } }); };
+       unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.0 = local_val;
+}
+/// Constructs a new RouteHint given each field
+#[must_use]
+#[no_mangle]
+pub extern "C" fn RouteHint_new(mut a_arg: crate::c_types::derived::CVec_RouteHintHopZ) -> RouteHint {
+       let mut local_a_arg = Vec::new(); for mut item in a_arg.into_rust().drain(..) { local_a_arg.push( { *unsafe { Box::from_raw(item.take_inner()) } }); };
+       RouteHint { inner: ObjOps::heap_alloc(lightning::routing::router::RouteHint (
+               local_a_arg,
+       )), is_owned: true }
+}
 impl Clone for RouteHint {
        fn clone(&self) -> Self {
                Self {
@@ -457,9 +837,25 @@ pub extern "C" fn RouteHint_eq(a: &RouteHint, b: &RouteHint) -> bool {
        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 RouteHint object into a byte array which can be read by RouteHint_read
+pub extern "C" fn RouteHint_write(obj: &RouteHint) -> crate::c_types::derived::CVec_u8Z {
+       crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
+}
+#[no_mangle]
+pub(crate) extern "C" fn RouteHint_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
+       crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeRouteHint) })
+}
+#[no_mangle]
+/// 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 = 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() };
+       local_res
+}
 
 use lightning::routing::router::RouteHintHop as nativeRouteHintHopImport;
-type nativeRouteHintHop = nativeRouteHintHopImport;
+pub(crate) type nativeRouteHintHop = nativeRouteHintHopImport;
 
 /// A channel descriptor for a hop along a payment path.
 #[must_use]
@@ -489,7 +885,7 @@ impl Drop for RouteHintHop {
 pub extern "C" fn RouteHintHop_free(this_obj: RouteHintHop) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn RouteHintHop_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn RouteHintHop_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeRouteHintHop); }
 }
 #[allow(unused)]
@@ -534,7 +930,7 @@ pub extern "C" fn RouteHintHop_set_short_channel_id(this_ptr: &mut RouteHintHop,
 #[no_mangle]
 pub extern "C" fn RouteHintHop_get_fees(this_ptr: &RouteHintHop) -> crate::lightning::routing::network_graph::RoutingFees {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().fees;
-       crate::lightning::routing::network_graph::RoutingFees { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const _) as *mut _) }, is_owned: false }
+       crate::lightning::routing::network_graph::RoutingFees { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::routing::network_graph::RoutingFees<>) as *mut _) }, is_owned: false }
 }
 /// The fees which must be paid to use this channel
 #[no_mangle]
@@ -631,48 +1027,56 @@ pub extern "C" fn RouteHintHop_eq(a: &RouteHintHop, b: &RouteHintHop) -> bool {
        if a.inner.is_null() || b.inner.is_null() { return false; }
        if a.get_native_ref() == b.get_native_ref() { true } else { false }
 }
-/// Gets a keysend route from us (payer) to the given target node (payee). This is needed because
-/// keysend payments do not have an invoice from which to pull the payee's supported features, which
-/// makes it tricky to otherwise supply the `payee_features` parameter of `get_route`.
-///
-/// Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
 #[no_mangle]
-pub extern "C" fn get_keysend_route(mut our_node_pubkey: crate::c_types::PublicKey, network: &crate::lightning::routing::network_graph::NetworkGraph, mut payee: crate::c_types::PublicKey, first_hops: *mut crate::c_types::derived::CVec_ChannelDetailsZ, mut last_hops: crate::c_types::derived::CVec_RouteHintZ, mut final_value_msat: u64, mut final_cltv: u32, mut logger: crate::lightning::util::logger::Logger, scorer: &crate::lightning::routing::Score) -> crate::c_types::derived::CResult_RouteLightningErrorZ {
-       let mut local_first_hops_base = if first_hops == std::ptr::null_mut() { None } else { Some( { let mut local_first_hops_0 = Vec::new(); for mut item in unsafe { &mut *first_hops }.as_slice().iter() { local_first_hops_0.push( { item.get_native_ref() }); }; local_first_hops_0 }) }; let mut local_first_hops = local_first_hops_base.as_ref().map(|a| &a[..]);
-       let mut local_last_hops = Vec::new(); for mut item in last_hops.as_slice().iter() { local_last_hops.push( { item.get_native_ref() }); };
-       let mut ret = lightning::routing::router::get_keysend_route(&our_node_pubkey.into_rust(), network.get_native_ref(), &payee.into_rust(), local_first_hops, &local_last_hops[..], final_value_msat, final_cltv, logger, scorer);
-       let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::router::Route { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::LightningError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
-       local_ret
+/// Serialize the RouteHintHop object into a byte array which can be read by RouteHintHop_read
+pub extern "C" fn RouteHintHop_write(obj: &RouteHintHop) -> crate::c_types::derived::CVec_u8Z {
+       crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
 }
-
-/// Gets a route from us (payer) to the given target node (payee).
+#[no_mangle]
+pub(crate) extern "C" fn RouteHintHop_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
+       crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeRouteHintHop) })
+}
+#[no_mangle]
+/// 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 = 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() };
+       local_res
+}
+/// Finds a route from us (payer) to the given target node (payee).
 ///
-/// If the payee provided features in their invoice, they should be provided via payee_features.
+/// If the payee provided features in their invoice, they should be provided via `params.payee`.
 /// Without this, MPP will only be used if the payee's features are available in the network graph.
 ///
-/// Private routing paths between a public node and the target may be included in `last_hops`.
-/// Currently, only the last hop in each path is considered.
+/// Private routing paths between a public node and the target may be included in `params.payee`.
+///
+/// If some channels aren't announced, it may be useful to fill in `first_hops` with the results
+/// from [`ChannelManager::list_usable_channels`]. If it is filled in, the view of our local
+/// channels from [`NetworkGraph`] will be ignored, and only those in `first_hops` will be used.
+///
+/// The fees on channels from us to the next hop are ignored as they are assumed to all be equal.
+/// However, the enabled/disabled bit on such channels as well as the `htlc_minimum_msat` /
+/// `htlc_maximum_msat` *are* checked as they may change based on the receiving node.
+///
+/// # Note
+///
+/// May be used to re-compute a [`Route`] when handling a [`Event::PaymentPathFailed`]. Any
+/// adjustments to the [`NetworkGraph`] and channel scores should be made prior to calling this
+/// function.
 ///
-/// If some channels aren't announced, it may be useful to fill in a first_hops with the
-/// results from a local ChannelManager::list_usable_channels() call. If it is filled in, our
-/// view of our local channels (from net_graph_msg_handler) will be ignored, and only those
-/// in first_hops will be used.
+/// # Panics
 ///
-/// Panics if first_hops contains channels without short_channel_ids
-/// (ChannelManager::list_usable_channels will never include such channels).
+/// Panics if first_hops contains channels without short_channel_ids;
+/// [`ChannelManager::list_usable_channels`] will never include such channels.
 ///
-/// The fees on channels from us to next-hops are ignored (as they are assumed to all be
-/// equal), however the enabled/disabled bit on such channels as well as the
-/// htlc_minimum_msat/htlc_maximum_msat *are* checked as they may change based on the receiving node.
+/// [`ChannelManager::list_usable_channels`]: crate::ln::channelmanager::ChannelManager::list_usable_channels
+/// [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
 ///
-/// Note that payee_features (or a relevant inner pointer) may be NULL or all-0s to represent None
 /// Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
 #[no_mangle]
-pub extern "C" fn get_route(mut our_node_pubkey: crate::c_types::PublicKey, network: &crate::lightning::routing::network_graph::NetworkGraph, mut payee: crate::c_types::PublicKey, mut payee_features: crate::lightning::ln::features::InvoiceFeatures, first_hops: *mut crate::c_types::derived::CVec_ChannelDetailsZ, mut last_hops: crate::c_types::derived::CVec_RouteHintZ, mut final_value_msat: u64, mut final_cltv: u32, mut logger: crate::lightning::util::logger::Logger, scorer: &crate::lightning::routing::Score) -> crate::c_types::derived::CResult_RouteLightningErrorZ {
-       let mut local_payee_features = if payee_features.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(payee_features.take_inner()) } }) };
+pub extern "C" fn find_route(mut our_node_pubkey: crate::c_types::PublicKey, params: &crate::lightning::routing::router::RouteParameters, network: &crate::lightning::routing::network_graph::NetworkGraph, first_hops: *mut crate::c_types::derived::CVec_ChannelDetailsZ, mut logger: crate::lightning::util::logger::Logger, scorer: &crate::lightning::routing::Score) -> crate::c_types::derived::CResult_RouteLightningErrorZ {
        let mut local_first_hops_base = if first_hops == std::ptr::null_mut() { None } else { Some( { let mut local_first_hops_0 = Vec::new(); for mut item in unsafe { &mut *first_hops }.as_slice().iter() { local_first_hops_0.push( { item.get_native_ref() }); }; local_first_hops_0 }) }; let mut local_first_hops = local_first_hops_base.as_ref().map(|a| &a[..]);
-       let mut local_last_hops = Vec::new(); for mut item in last_hops.as_slice().iter() { local_last_hops.push( { item.get_native_ref() }); };
-       let mut ret = lightning::routing::router::get_route(&our_node_pubkey.into_rust(), network.get_native_ref(), &payee.into_rust(), local_payee_features, local_first_hops, &local_last_hops[..], final_value_msat, final_cltv, logger, scorer);
+       let mut ret = lightning::routing::router::find_route(&our_node_pubkey.into_rust(), params.get_native_ref(), network.get_native_ref(), local_first_hops, logger, scorer);
        let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::router::Route { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::LightningError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
        local_ret
 }
index a25a489ff410cf97c4a4eca648ee9ad57a122425..29bb05de8a8b09d138164e20a6effcd9ff2b2341 100644 (file)
@@ -8,7 +8,7 @@
 
 //! Utilities for scoring payment channels.
 //!
-//! [`Scorer`] may be given to [`get_route`] to score payment channels during path finding when a
+//! [`Scorer`] may be given to [`find_route`] to score payment channels during path finding when a
 //! custom [`routing::Score`] implementation is not needed.
 //!
 //! # Example
@@ -17,8 +17,8 @@
 //! # extern crate secp256k1;
 //! #
 //! # use lightning::routing::network_graph::NetworkGraph;
-//! # use lightning::routing::router::get_route;
-//! # use lightning::routing::scorer::Scorer;
+//! # use lightning::routing::router::{RouteParameters, find_route};
+//! # use lightning::routing::scorer::{Scorer, ScoringParameters};
 //! # use lightning::util::logger::{Logger, Record};
 //! # use secp256k1::key::PublicKey;
 //! #
 //! # impl Logger for FakeLogger {
 //! #     fn log(&self, record: &Record) { unimplemented!() }
 //! # }
-//! # fn find_scored_route(payer: PublicKey, payee: PublicKey, network_graph: NetworkGraph) {
+//! # fn find_scored_route(payer: PublicKey, params: RouteParameters, network_graph: NetworkGraph) {
 //! # let logger = FakeLogger {};
 //! #
-//! // Use the default channel penalty.
+//! // Use the default channel penalties.
 //! let scorer = Scorer::default();
 //!
-//! // Or use a custom channel penalty.
-//! let scorer = Scorer::new(1_000);
+//! // Or use custom channel penalties.
+//! let scorer = Scorer::new(ScoringParameters {
+//!     base_penalty_msat: 1000,
+//!     failure_penalty_msat: 2 * 1024 * 1000,
+//!     ..ScoringParameters::default()
+//! });
 //!
-//! let route = get_route(&payer, &network_graph, &payee, None, None, &vec![], 1_000, 42, &logger, &scorer);
+//! let route = find_route(&payer, &params, &network_graph, None, &logger, &scorer);
 //! # }
 //! ```
 //!
-//! [`get_route`]: crate::routing::router::get_route
+//! # Note
+//!
+//! If persisting [`Scorer`], it must be restored using the same [`Time`] parameterization. Using a
+//! different type results in undefined behavior. Specifically, persisting when built with feature
+//! `no-std` and restoring without it, or vice versa, uses different types and thus is undefined.
+//!
+//! [`find_route`]: crate::routing::router::find_route
 
 use std::str::FromStr;
 use std::ffi::c_void;
@@ -47,14 +57,23 @@ use core::convert::Infallible;
 use bitcoin::hashes::Hash;
 use crate::c_types::*;
 
+mod sealed {
+
+use std::str::FromStr;
+use std::ffi::c_void;
+use core::convert::Infallible;
+use bitcoin::hashes::Hash;
+use crate::c_types::*;
+
+}
 
 use lightning::routing::scorer::Scorer as nativeScorerImport;
-type nativeScorer = nativeScorerImport;
+pub(crate) type nativeScorer = nativeScorerImport;
 
 /// [`routing::Score`] implementation that provides reasonable default behavior.
 ///
 /// Used to apply a fixed penalty to each channel, thus avoiding long paths when shorter paths with
-/// slightly higher fees are available.
+/// slightly higher fees are available. Will further penalize channels that fail to relay payments.
 ///
 /// See [module-level documentation] for usage.
 ///
@@ -86,7 +105,7 @@ impl Drop for Scorer {
 pub extern "C" fn Scorer_free(this_obj: Scorer) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn Scorer_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn Scorer_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeScorer); }
 }
 #[allow(unused)]
@@ -105,11 +124,147 @@ impl Scorer {
                ret
        }
 }
-/// Creates a new scorer using `base_penalty_msat` as the channel penalty.
+
+use lightning::routing::scorer::ScoringParameters as nativeScoringParametersImport;
+pub(crate) type nativeScoringParameters = nativeScoringParametersImport;
+
+/// Parameters for configuring [`Scorer`].
 #[must_use]
+#[repr(C)]
+pub struct ScoringParameters {
+       /// A pointer to the opaque Rust object.
+
+       /// Nearly everywhere, inner must be non-null, however in places where
+       /// the Rust equivalent takes an Option, it may be set to null to indicate None.
+       pub inner: *mut nativeScoringParameters,
+       /// Indicates that this is the only struct which contains the same pointer.
+
+       /// Rust functions which take ownership of an object provided via an argument require
+       /// this to be true and invalidate the object pointed to by inner.
+       pub is_owned: bool,
+}
+
+impl Drop for ScoringParameters {
+       fn drop(&mut self) {
+               if self.is_owned && !<*mut nativeScoringParameters>::is_null(self.inner) {
+                       let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+               }
+       }
+}
+/// Frees any resources used by the ScoringParameters, if is_owned is set and inner is non-NULL.
 #[no_mangle]
-pub extern "C" fn Scorer_new(mut base_penalty_msat: u64) -> Scorer {
-       let mut ret = lightning::routing::scorer::Scorer::new(base_penalty_msat);
+pub extern "C" fn ScoringParameters_free(this_obj: ScoringParameters) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn ScoringParameters_free_void(this_ptr: *mut c_void) {
+       unsafe { let _ = Box::from_raw(this_ptr as *mut nativeScoringParameters); }
+}
+#[allow(unused)]
+impl ScoringParameters {
+       pub(crate) fn get_native_ref(&self) -> &'static nativeScoringParameters {
+               unsafe { &*ObjOps::untweak_ptr(self.inner) }
+       }
+       pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeScoringParameters {
+               unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
+       }
+       /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
+       pub(crate) fn take_inner(mut self) -> *mut nativeScoringParameters {
+               assert!(self.is_owned);
+               let ret = ObjOps::untweak_ptr(self.inner);
+               self.inner = std::ptr::null_mut();
+               ret
+       }
+}
+/// A fixed penalty in msats to apply to each channel.
+#[no_mangle]
+pub extern "C" fn ScoringParameters_get_base_penalty_msat(this_ptr: &ScoringParameters) -> u64 {
+       let mut inner_val = &mut this_ptr.get_native_mut_ref().base_penalty_msat;
+       *inner_val
+}
+/// A fixed penalty in msats to apply to each channel.
+#[no_mangle]
+pub extern "C" fn ScoringParameters_set_base_penalty_msat(this_ptr: &mut ScoringParameters, mut val: u64) {
+       unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.base_penalty_msat = val;
+}
+/// A penalty in msats to apply to a channel upon failing to relay a payment.
+///
+/// This accumulates for each failure but may be reduced over time based on
+/// [`failure_penalty_half_life`].
+///
+/// [`failure_penalty_half_life`]: Self::failure_penalty_half_life
+#[no_mangle]
+pub extern "C" fn ScoringParameters_get_failure_penalty_msat(this_ptr: &ScoringParameters) -> u64 {
+       let mut inner_val = &mut this_ptr.get_native_mut_ref().failure_penalty_msat;
+       *inner_val
+}
+/// A penalty in msats to apply to a channel upon failing to relay a payment.
+///
+/// This accumulates for each failure but may be reduced over time based on
+/// [`failure_penalty_half_life`].
+///
+/// [`failure_penalty_half_life`]: Self::failure_penalty_half_life
+#[no_mangle]
+pub extern "C" fn ScoringParameters_set_failure_penalty_msat(this_ptr: &mut ScoringParameters, mut val: u64) {
+       unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.failure_penalty_msat = val;
+}
+/// The time required to elapse before any accumulated [`failure_penalty_msat`] penalties are
+/// cut in half.
+///
+/// # Note
+///
+/// When time is an [`Eternity`], as is default when enabling feature `no-std`, it will never
+/// elapse. Therefore, this penalty will never decay.
+///
+/// [`failure_penalty_msat`]: Self::failure_penalty_msat
+#[no_mangle]
+pub extern "C" fn ScoringParameters_get_failure_penalty_half_life(this_ptr: &ScoringParameters) -> u64 {
+       let mut inner_val = &mut this_ptr.get_native_mut_ref().failure_penalty_half_life;
+       inner_val.as_secs()
+}
+/// The time required to elapse before any accumulated [`failure_penalty_msat`] penalties are
+/// cut in half.
+///
+/// # Note
+///
+/// When time is an [`Eternity`], as is default when enabling feature `no-std`, it will never
+/// elapse. Therefore, this penalty will never decay.
+///
+/// [`failure_penalty_msat`]: Self::failure_penalty_msat
+#[no_mangle]
+pub extern "C" fn ScoringParameters_set_failure_penalty_half_life(this_ptr: &mut ScoringParameters, mut val: u64) {
+       unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.failure_penalty_half_life = std::time::Duration::from_secs(val);
+}
+/// Constructs a new ScoringParameters given each field
+#[must_use]
+#[no_mangle]
+pub extern "C" fn ScoringParameters_new(mut base_penalty_msat_arg: u64, mut failure_penalty_msat_arg: u64, mut failure_penalty_half_life_arg: u64) -> ScoringParameters {
+       ScoringParameters { inner: ObjOps::heap_alloc(nativeScoringParameters {
+               base_penalty_msat: base_penalty_msat_arg,
+               failure_penalty_msat: failure_penalty_msat_arg,
+               failure_penalty_half_life: std::time::Duration::from_secs(failure_penalty_half_life_arg),
+       }), is_owned: true }
+}
+#[no_mangle]
+/// Serialize the ScoringParameters object into a byte array which can be read by ScoringParameters_read
+pub extern "C" fn ScoringParameters_write(obj: &ScoringParameters) -> crate::c_types::derived::CVec_u8Z {
+       crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
+}
+#[no_mangle]
+pub(crate) extern "C" fn ScoringParameters_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
+       crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeScoringParameters) })
+}
+#[no_mangle]
+/// Read a ScoringParameters from a byte array, created by ScoringParameters_write
+pub extern "C" fn ScoringParameters_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ScoringParametersDecodeErrorZ {
+       let res = crate::c_types::deserialize_obj(ser);
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::scorer::ScoringParameters { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       local_res
+}
+/// Creates a new scorer using the given scoring parameters.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn Scorer_new(mut params: crate::lightning::routing::scorer::ScoringParameters) -> Scorer {
+       let mut ret = lightning::routing::scorer::Scorer::new(*unsafe { Box::from_raw(params.take_inner()) });
        Scorer { inner: ObjOps::heap_alloc(ret), is_owned: true }
 }
 
@@ -119,6 +274,12 @@ pub extern "C" fn Scorer_new(mut base_penalty_msat: u64) -> Scorer {
 pub extern "C" fn Scorer_default() -> Scorer {
        Scorer { inner: ObjOps::heap_alloc(Default::default()), is_owned: true }
 }
+/// Creates a "default" ScoringParameters. See struct and individual field documentaiton for details on which values are used.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn ScoringParameters_default() -> ScoringParameters {
+       ScoringParameters { inner: ObjOps::heap_alloc(Default::default()), is_owned: true }
+}
 impl From<nativeScorer> for crate::lightning::routing::Score {
        fn from(obj: nativeScorer) -> Self {
                let mut rust_obj = Scorer { inner: ObjOps::heap_alloc(obj), is_owned: true };
@@ -137,12 +298,34 @@ pub extern "C" fn Scorer_as_Score(this_arg: &Scorer) -> crate::lightning::routin
                this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void },
                free: None,
                channel_penalty_msat: Scorer_Score_channel_penalty_msat,
+               payment_path_failed: Scorer_Score_payment_path_failed,
+               write: Scorer_write_void,
        }
 }
 
 #[must_use]
-extern "C" fn Scorer_Score_channel_penalty_msat(this_arg: *const c_void, mut _short_channel_id: u64) -> u64 {
-       let mut ret = <nativeScorer as lightning::routing::Score<>>::channel_penalty_msat(unsafe { &mut *(this_arg as *mut nativeScorer) }, _short_channel_id);
+extern "C" fn Scorer_Score_channel_penalty_msat(this_arg: *const c_void, mut short_channel_id: u64, _source: &crate::lightning::routing::network_graph::NodeId, _target: &crate::lightning::routing::network_graph::NodeId) -> u64 {
+       let mut ret = <nativeScorer as lightning::routing::Score<>>::channel_penalty_msat(unsafe { &mut *(this_arg as *mut nativeScorer) }, short_channel_id, _source.get_native_ref(), _target.get_native_ref());
        ret
 }
+extern "C" fn Scorer_Score_payment_path_failed(this_arg: *mut c_void, mut _path: crate::c_types::derived::CVec_RouteHopZ, mut short_channel_id: u64) {
+       let mut local__path = Vec::new(); for mut item in _path.as_slice().iter() { local__path.push( { item.get_native_ref() }); };
+       <nativeScorer as lightning::routing::Score<>>::payment_path_failed(unsafe { &mut *(this_arg as *mut nativeScorer) }, &local__path[..], short_channel_id)
+}
 
+#[no_mangle]
+/// Serialize the Scorer object into a byte array which can be read by Scorer_read
+pub extern "C" fn Scorer_write(obj: &Scorer) -> crate::c_types::derived::CVec_u8Z {
+       crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
+}
+#[no_mangle]
+pub(crate) extern "C" fn Scorer_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
+       crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeScorer) })
+}
+#[no_mangle]
+/// Read a Scorer from a byte array, created by Scorer_write
+pub extern "C" fn Scorer_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ScorerDecodeErrorZ {
+       let res = crate::c_types::deserialize_obj(ser);
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::scorer::Scorer { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       local_res
+}
index 0bec9636f839bb152c6bb34dc28abaf03c2f989e..180a8fbd80fed775398062d8d16cd264caf374e8 100644 (file)
@@ -17,7 +17,7 @@ use crate::c_types::*;
 
 
 use lightning::util::config::ChannelHandshakeConfig as nativeChannelHandshakeConfigImport;
-type nativeChannelHandshakeConfig = nativeChannelHandshakeConfigImport;
+pub(crate) type nativeChannelHandshakeConfig = nativeChannelHandshakeConfigImport;
 
 /// Configuration we set when applicable.
 ///
@@ -49,7 +49,7 @@ impl Drop for ChannelHandshakeConfig {
 pub extern "C" fn ChannelHandshakeConfig_free(this_obj: ChannelHandshakeConfig) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn ChannelHandshakeConfig_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn ChannelHandshakeConfig_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelHandshakeConfig); }
 }
 #[allow(unused)]
@@ -186,7 +186,7 @@ pub extern "C" fn ChannelHandshakeConfig_default() -> ChannelHandshakeConfig {
 }
 
 use lightning::util::config::ChannelHandshakeLimits as nativeChannelHandshakeLimitsImport;
-type nativeChannelHandshakeLimits = nativeChannelHandshakeLimitsImport;
+pub(crate) type nativeChannelHandshakeLimits = nativeChannelHandshakeLimitsImport;
 
 /// Optional channel limits which are applied during channel creation.
 ///
@@ -226,7 +226,7 @@ impl Drop for ChannelHandshakeLimits {
 pub extern "C" fn ChannelHandshakeLimits_free(this_obj: ChannelHandshakeLimits) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn ChannelHandshakeLimits_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn ChannelHandshakeLimits_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelHandshakeLimits); }
 }
 #[allow(unused)]
@@ -443,7 +443,7 @@ pub extern "C" fn ChannelHandshakeLimits_default() -> ChannelHandshakeLimits {
 }
 
 use lightning::util::config::ChannelConfig as nativeChannelConfigImport;
-type nativeChannelConfig = nativeChannelConfigImport;
+pub(crate) type nativeChannelConfig = nativeChannelConfigImport;
 
 /// Options which apply on a per-channel basis and may change at runtime or based on negotiation
 /// with our counterparty.
@@ -474,7 +474,7 @@ impl Drop for ChannelConfig {
 pub extern "C" fn ChannelConfig_free(this_obj: ChannelConfig) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn ChannelConfig_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn ChannelConfig_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelConfig); }
 }
 #[allow(unused)]
@@ -805,7 +805,7 @@ pub extern "C" fn ChannelConfig_read(ser: crate::c_types::u8slice) -> crate::c_t
 }
 
 use lightning::util::config::UserConfig as nativeUserConfigImport;
-type nativeUserConfig = nativeUserConfigImport;
+pub(crate) type nativeUserConfig = nativeUserConfigImport;
 
 /// Top-level config which holds ChannelHandshakeLimits and ChannelConfig.
 ///
@@ -838,7 +838,7 @@ impl Drop for UserConfig {
 pub extern "C" fn UserConfig_free(this_obj: UserConfig) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn UserConfig_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn UserConfig_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeUserConfig); }
 }
 #[allow(unused)]
@@ -861,7 +861,7 @@ impl UserConfig {
 #[no_mangle]
 pub extern "C" fn UserConfig_get_own_channel_config(this_ptr: &UserConfig) -> crate::lightning::util::config::ChannelHandshakeConfig {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().own_channel_config;
-       crate::lightning::util::config::ChannelHandshakeConfig { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const _) as *mut _) }, is_owned: false }
+       crate::lightning::util::config::ChannelHandshakeConfig { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::util::config::ChannelHandshakeConfig<>) as *mut _) }, is_owned: false }
 }
 /// Channel config that we propose to our counterparty.
 #[no_mangle]
@@ -872,7 +872,7 @@ pub extern "C" fn UserConfig_set_own_channel_config(this_ptr: &mut UserConfig, m
 #[no_mangle]
 pub extern "C" fn UserConfig_get_peer_channel_config_limits(this_ptr: &UserConfig) -> crate::lightning::util::config::ChannelHandshakeLimits {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().peer_channel_config_limits;
-       crate::lightning::util::config::ChannelHandshakeLimits { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const _) as *mut _) }, is_owned: false }
+       crate::lightning::util::config::ChannelHandshakeLimits { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::util::config::ChannelHandshakeLimits<>) as *mut _) }, is_owned: false }
 }
 /// Limits applied to our counterparty's proposed channel config settings.
 #[no_mangle]
@@ -883,7 +883,7 @@ pub extern "C" fn UserConfig_set_peer_channel_config_limits(this_ptr: &mut UserC
 #[no_mangle]
 pub extern "C" fn UserConfig_get_channel_options(this_ptr: &UserConfig) -> crate::lightning::util::config::ChannelConfig {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_options;
-       crate::lightning::util::config::ChannelConfig { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const _) as *mut _) }, is_owned: false }
+       crate::lightning::util::config::ChannelConfig { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::util::config::ChannelConfig<>) as *mut _) }, is_owned: false }
 }
 /// Channel config which affects behavior during channel lifetime.
 #[no_mangle]
index 47f4465fd7bbcf900cac2241c03115b5ed34c267..6baa8b27823a22106c480852d125c7b0ea66197b 100644 (file)
@@ -397,6 +397,14 @@ pub enum Event {
        /// Note for MPP payments: in rare cases, this event may be preceded by a `PaymentPathFailed`
        /// event. In this situation, you SHOULD treat this payment as having succeeded.
        PaymentSent {
+               /// The id returned by [`ChannelManager::send_payment`] and used with
+               /// [`ChannelManager::retry_payment`].
+               ///
+               /// [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
+               /// [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
+               ///
+               /// Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
+               payment_id: crate::c_types::ThirtyTwoBytes,
                /// The preimage to the hash given to ChannelManager::send_payment.
                /// Note that this serves as a payment receipt, if you wish to have such a thing, you must
                /// store it somehow!
@@ -405,10 +413,28 @@ pub enum Event {
                ///
                /// [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
                payment_hash: crate::c_types::ThirtyTwoBytes,
+               /// The total fee which was spent at intermediate hops in this payment, across all paths.
+               ///
+               /// Note that, like [`Route::get_total_fees`] this does *not* include any potential
+               /// overpayment to the recipient node.
+               ///
+               /// If the recipient or an intermediate node misbehaves and gives us free money, this may
+               /// overstate the amount paid, though this is unlikely.
+               ///
+               /// [`Route::get_total_fees`]: crate::routing::router::Route::get_total_fees
+               fee_paid_msat: crate::c_types::derived::COption_u64Z,
        },
        /// Indicates an outbound payment we made failed. Probably some intermediary node dropped
        /// something. You may wish to retry with a different route.
        PaymentPathFailed {
+               /// The id returned by [`ChannelManager::send_payment`] and used with
+               /// [`ChannelManager::retry_payment`].
+               ///
+               /// [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
+               /// [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
+               ///
+               /// Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
+               payment_id: crate::c_types::ThirtyTwoBytes,
                /// The hash which was given to ChannelManager::send_payment.
                payment_hash: crate::c_types::ThirtyTwoBytes,
                /// Indicates the payment was rejected for some reason by the recipient. This implies that
@@ -435,6 +461,15 @@ pub enum Event {
                /// If this is `Some`, then the corresponding channel should be avoided when the payment is
                /// retried. May be `None` for older [`Event`] serializations.
                short_channel_id: crate::c_types::derived::COption_u64Z,
+               /// Parameters needed to compute a new [`Route`] when retrying the failed payment path.
+               ///
+               /// See [`find_route`] for details.
+               ///
+               /// [`Route`]: crate::routing::router::Route
+               /// [`find_route`]: crate::routing::router::find_route
+               ///
+               /// Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
+               retry: crate::lightning::routing::router::RouteParameters,
        },
        /// Used to indicate that ChannelManager::process_pending_htlc_forwards should be called at a
        /// time in the future.
@@ -525,15 +560,23 @@ impl Event {
                                        purpose: purpose_nonref.into_native(),
                                }
                        },
-                       Event::PaymentSent {ref payment_preimage, ref payment_hash, } => {
+                       Event::PaymentSent {ref payment_id, ref payment_preimage, ref payment_hash, ref fee_paid_msat, } => {
+                               let mut payment_id_nonref = (*payment_id).clone();
+                               let mut local_payment_id_nonref = if payment_id_nonref.data == [0; 32] { None } else { Some( { ::lightning::ln::channelmanager::PaymentId(payment_id_nonref.data) }) };
                                let mut payment_preimage_nonref = (*payment_preimage).clone();
                                let mut payment_hash_nonref = (*payment_hash).clone();
+                               let mut fee_paid_msat_nonref = (*fee_paid_msat).clone();
+                               let mut local_fee_paid_msat_nonref = if fee_paid_msat_nonref.is_some() { Some( { fee_paid_msat_nonref.take() }) } else { None };
                                nativeEvent::PaymentSent {
+                                       payment_id: local_payment_id_nonref,
                                        payment_preimage: ::lightning::ln::PaymentPreimage(payment_preimage_nonref.data),
                                        payment_hash: ::lightning::ln::PaymentHash(payment_hash_nonref.data),
+                                       fee_paid_msat: local_fee_paid_msat_nonref,
                                }
                        },
-                       Event::PaymentPathFailed {ref payment_hash, ref rejected_by_dest, ref network_update, ref all_paths_failed, ref path, ref short_channel_id, } => {
+                       Event::PaymentPathFailed {ref payment_id, ref payment_hash, ref rejected_by_dest, ref network_update, ref all_paths_failed, ref path, ref short_channel_id, ref retry, } => {
+                               let mut payment_id_nonref = (*payment_id).clone();
+                               let mut local_payment_id_nonref = if payment_id_nonref.data == [0; 32] { None } else { Some( { ::lightning::ln::channelmanager::PaymentId(payment_id_nonref.data) }) };
                                let mut payment_hash_nonref = (*payment_hash).clone();
                                let mut rejected_by_dest_nonref = (*rejected_by_dest).clone();
                                let mut network_update_nonref = (*network_update).clone();
@@ -543,13 +586,17 @@ impl Event {
                                let mut local_path_nonref = Vec::new(); for mut item in path_nonref.into_rust().drain(..) { local_path_nonref.push( { *unsafe { Box::from_raw(item.take_inner()) } }); };
                                let mut short_channel_id_nonref = (*short_channel_id).clone();
                                let mut local_short_channel_id_nonref = if short_channel_id_nonref.is_some() { Some( { short_channel_id_nonref.take() }) } else { None };
+                               let mut retry_nonref = (*retry).clone();
+                               let mut local_retry_nonref = if retry_nonref.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(retry_nonref.take_inner()) } }) };
                                nativeEvent::PaymentPathFailed {
+                                       payment_id: local_payment_id_nonref,
                                        payment_hash: ::lightning::ln::PaymentHash(payment_hash_nonref.data),
                                        rejected_by_dest: rejected_by_dest_nonref,
                                        network_update: local_network_update_nonref,
                                        all_paths_failed: all_paths_failed_nonref,
                                        path: local_path_nonref,
                                        short_channel_id: local_short_channel_id_nonref,
+                                       retry: local_retry_nonref,
                                }
                        },
                        Event::PendingHTLCsForwardable {ref time_forwardable, } => {
@@ -612,23 +659,31 @@ impl Event {
                                        purpose: purpose.into_native(),
                                }
                        },
-                       Event::PaymentSent {mut payment_preimage, mut payment_hash, } => {
+                       Event::PaymentSent {mut payment_id, mut payment_preimage, mut payment_hash, mut fee_paid_msat, } => {
+                               let mut local_payment_id = if payment_id.data == [0; 32] { None } else { Some( { ::lightning::ln::channelmanager::PaymentId(payment_id.data) }) };
+                               let mut local_fee_paid_msat = if fee_paid_msat.is_some() { Some( { fee_paid_msat.take() }) } else { None };
                                nativeEvent::PaymentSent {
+                                       payment_id: local_payment_id,
                                        payment_preimage: ::lightning::ln::PaymentPreimage(payment_preimage.data),
                                        payment_hash: ::lightning::ln::PaymentHash(payment_hash.data),
+                                       fee_paid_msat: local_fee_paid_msat,
                                }
                        },
-                       Event::PaymentPathFailed {mut payment_hash, mut rejected_by_dest, mut network_update, mut all_paths_failed, mut path, mut short_channel_id, } => {
+                       Event::PaymentPathFailed {mut payment_id, mut payment_hash, mut rejected_by_dest, mut network_update, mut all_paths_failed, mut path, mut short_channel_id, mut retry, } => {
+                               let mut local_payment_id = if payment_id.data == [0; 32] { None } else { Some( { ::lightning::ln::channelmanager::PaymentId(payment_id.data) }) };
                                let mut local_network_update = { /* network_update*/ let network_update_opt = network_update; { } if network_update_opt.is_none() { None } else { Some({ network_update_opt.take().into_native() }) } };
                                let mut local_path = Vec::new(); for mut item in path.into_rust().drain(..) { local_path.push( { *unsafe { Box::from_raw(item.take_inner()) } }); };
                                let mut local_short_channel_id = if short_channel_id.is_some() { Some( { short_channel_id.take() }) } else { None };
+                               let mut local_retry = if retry.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(retry.take_inner()) } }) };
                                nativeEvent::PaymentPathFailed {
+                                       payment_id: local_payment_id,
                                        payment_hash: ::lightning::ln::PaymentHash(payment_hash.data),
                                        rejected_by_dest: rejected_by_dest,
                                        network_update: local_network_update,
                                        all_paths_failed: all_paths_failed,
                                        path: local_path,
                                        short_channel_id: local_short_channel_id,
+                                       retry: local_retry,
                                }
                        },
                        Event::PendingHTLCsForwardable {mut time_forwardable, } => {
@@ -689,15 +744,23 @@ impl Event {
                                        purpose: crate::lightning::util::events::PaymentPurpose::native_into(purpose_nonref),
                                }
                        },
-                       nativeEvent::PaymentSent {ref payment_preimage, ref payment_hash, } => {
+                       nativeEvent::PaymentSent {ref payment_id, ref payment_preimage, ref payment_hash, ref fee_paid_msat, } => {
+                               let mut payment_id_nonref = (*payment_id).clone();
+                               let mut local_payment_id_nonref = if payment_id_nonref.is_none() { crate::c_types::ThirtyTwoBytes::null() } else {  { crate::c_types::ThirtyTwoBytes { data: (payment_id_nonref.unwrap()).0 } } };
                                let mut payment_preimage_nonref = (*payment_preimage).clone();
                                let mut payment_hash_nonref = (*payment_hash).clone();
+                               let mut fee_paid_msat_nonref = (*fee_paid_msat).clone();
+                               let mut local_fee_paid_msat_nonref = if fee_paid_msat_nonref.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { fee_paid_msat_nonref.unwrap() }) };
                                Event::PaymentSent {
+                                       payment_id: local_payment_id_nonref,
                                        payment_preimage: crate::c_types::ThirtyTwoBytes { data: payment_preimage_nonref.0 },
                                        payment_hash: crate::c_types::ThirtyTwoBytes { data: payment_hash_nonref.0 },
+                                       fee_paid_msat: local_fee_paid_msat_nonref,
                                }
                        },
-                       nativeEvent::PaymentPathFailed {ref payment_hash, ref rejected_by_dest, ref network_update, ref all_paths_failed, ref path, ref short_channel_id, } => {
+                       nativeEvent::PaymentPathFailed {ref payment_id, ref payment_hash, ref rejected_by_dest, ref network_update, ref all_paths_failed, ref path, ref short_channel_id, ref retry, } => {
+                               let mut payment_id_nonref = (*payment_id).clone();
+                               let mut local_payment_id_nonref = if payment_id_nonref.is_none() { crate::c_types::ThirtyTwoBytes::null() } else {  { crate::c_types::ThirtyTwoBytes { data: (payment_id_nonref.unwrap()).0 } } };
                                let mut payment_hash_nonref = (*payment_hash).clone();
                                let mut rejected_by_dest_nonref = (*rejected_by_dest).clone();
                                let mut network_update_nonref = (*network_update).clone();
@@ -707,13 +770,17 @@ impl Event {
                                let mut local_path_nonref = Vec::new(); for mut item in path_nonref.drain(..) { local_path_nonref.push( { crate::lightning::routing::router::RouteHop { inner: ObjOps::heap_alloc(item), is_owned: true } }); };
                                let mut short_channel_id_nonref = (*short_channel_id).clone();
                                let mut local_short_channel_id_nonref = if short_channel_id_nonref.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { short_channel_id_nonref.unwrap() }) };
+                               let mut retry_nonref = (*retry).clone();
+                               let mut local_retry_nonref = crate::lightning::routing::router::RouteParameters { inner: if retry_nonref.is_none() { std::ptr::null_mut() } else {  { ObjOps::heap_alloc((retry_nonref.unwrap())) } }, is_owned: true };
                                Event::PaymentPathFailed {
+                                       payment_id: local_payment_id_nonref,
                                        payment_hash: crate::c_types::ThirtyTwoBytes { data: payment_hash_nonref.0 },
                                        rejected_by_dest: rejected_by_dest_nonref,
                                        network_update: local_network_update_nonref,
                                        all_paths_failed: all_paths_failed_nonref,
                                        path: local_path_nonref.into(),
                                        short_channel_id: local_short_channel_id_nonref,
+                                       retry: local_retry_nonref,
                                }
                        },
                        nativeEvent::PendingHTLCsForwardable {ref time_forwardable, } => {
@@ -776,23 +843,31 @@ impl Event {
                                        purpose: crate::lightning::util::events::PaymentPurpose::native_into(purpose),
                                }
                        },
-                       nativeEvent::PaymentSent {mut payment_preimage, mut payment_hash, } => {
+                       nativeEvent::PaymentSent {mut payment_id, mut payment_preimage, mut payment_hash, mut fee_paid_msat, } => {
+                               let mut local_payment_id = if payment_id.is_none() { crate::c_types::ThirtyTwoBytes::null() } else {  { crate::c_types::ThirtyTwoBytes { data: (payment_id.unwrap()).0 } } };
+                               let mut local_fee_paid_msat = if fee_paid_msat.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { fee_paid_msat.unwrap() }) };
                                Event::PaymentSent {
+                                       payment_id: local_payment_id,
                                        payment_preimage: crate::c_types::ThirtyTwoBytes { data: payment_preimage.0 },
                                        payment_hash: crate::c_types::ThirtyTwoBytes { data: payment_hash.0 },
+                                       fee_paid_msat: local_fee_paid_msat,
                                }
                        },
-                       nativeEvent::PaymentPathFailed {mut payment_hash, mut rejected_by_dest, mut network_update, mut all_paths_failed, mut path, mut short_channel_id, } => {
+                       nativeEvent::PaymentPathFailed {mut payment_id, mut payment_hash, mut rejected_by_dest, mut network_update, mut all_paths_failed, mut path, mut short_channel_id, mut retry, } => {
+                               let mut local_payment_id = if payment_id.is_none() { crate::c_types::ThirtyTwoBytes::null() } else {  { crate::c_types::ThirtyTwoBytes { data: (payment_id.unwrap()).0 } } };
                                let mut local_network_update = if network_update.is_none() { crate::c_types::derived::COption_NetworkUpdateZ::None } else { crate::c_types::derived::COption_NetworkUpdateZ::Some( { crate::lightning::routing::network_graph::NetworkUpdate::native_into(network_update.unwrap()) }) };
                                let mut local_path = Vec::new(); for mut item in path.drain(..) { local_path.push( { crate::lightning::routing::router::RouteHop { inner: ObjOps::heap_alloc(item), is_owned: true } }); };
                                let mut local_short_channel_id = if short_channel_id.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { short_channel_id.unwrap() }) };
+                               let mut local_retry = crate::lightning::routing::router::RouteParameters { inner: if retry.is_none() { std::ptr::null_mut() } else {  { ObjOps::heap_alloc((retry.unwrap())) } }, is_owned: true };
                                Event::PaymentPathFailed {
+                                       payment_id: local_payment_id,
                                        payment_hash: crate::c_types::ThirtyTwoBytes { data: payment_hash.0 },
                                        rejected_by_dest: rejected_by_dest,
                                        network_update: local_network_update,
                                        all_paths_failed: all_paths_failed,
                                        path: local_path.into(),
                                        short_channel_id: local_short_channel_id,
+                                       retry: local_retry,
                                }
                        },
                        nativeEvent::PendingHTLCsForwardable {mut time_forwardable, } => {
@@ -858,22 +933,26 @@ pub extern "C" fn Event_payment_received(payment_hash: crate::c_types::ThirtyTwo
 }
 #[no_mangle]
 /// Utility method to constructs a new PaymentSent-variant Event
-pub extern "C" fn Event_payment_sent(payment_preimage: crate::c_types::ThirtyTwoBytes, payment_hash: crate::c_types::ThirtyTwoBytes) -> Event {
+pub extern "C" fn Event_payment_sent(payment_id: crate::c_types::ThirtyTwoBytes, payment_preimage: crate::c_types::ThirtyTwoBytes, payment_hash: crate::c_types::ThirtyTwoBytes, fee_paid_msat: crate::c_types::derived::COption_u64Z) -> Event {
        Event::PaymentSent {
+               payment_id,
                payment_preimage,
                payment_hash,
+               fee_paid_msat,
        }
 }
 #[no_mangle]
 /// Utility method to constructs a new PaymentPathFailed-variant Event
-pub extern "C" fn Event_payment_path_failed(payment_hash: crate::c_types::ThirtyTwoBytes, rejected_by_dest: bool, network_update: crate::c_types::derived::COption_NetworkUpdateZ, all_paths_failed: bool, path: crate::c_types::derived::CVec_RouteHopZ, short_channel_id: crate::c_types::derived::COption_u64Z) -> Event {
+pub extern "C" fn Event_payment_path_failed(payment_id: crate::c_types::ThirtyTwoBytes, payment_hash: crate::c_types::ThirtyTwoBytes, rejected_by_dest: bool, network_update: crate::c_types::derived::COption_NetworkUpdateZ, all_paths_failed: bool, path: crate::c_types::derived::CVec_RouteHopZ, short_channel_id: crate::c_types::derived::COption_u64Z, retry: crate::lightning::routing::router::RouteParameters) -> Event {
        Event::PaymentPathFailed {
+               payment_id,
                payment_hash,
                rejected_by_dest,
                network_update,
                all_paths_failed,
                path,
                short_channel_id,
+               retry,
        }
 }
 #[no_mangle]
index 195c8a5aa57ff1759186e884dc2a05871f554438..45d754bd1fb7354c63f60c11f0d31988ae248def 100644 (file)
@@ -37,6 +37,15 @@ use core::convert::Infallible;
 use bitcoin::hashes::Hash;
 use crate::c_types::*;
 
+}
+mod atomic_counter {
+
+use std::str::FromStr;
+use std::ffi::c_void;
+use core::convert::Infallible;
+use bitcoin::hashes::Hash;
+use crate::c_types::*;
+
 }
 mod byte_utils {
 
index c3c7ee3545abdca12332587d427771ecf1e346e8..c35788f72b72c1fdec5f0a4ac631812409ec877f 100644 (file)
@@ -18,7 +18,7 @@ use crate::c_types::*;
 
 
 use lightning_background_processor::BackgroundProcessor as nativeBackgroundProcessorImport;
-type nativeBackgroundProcessor = nativeBackgroundProcessorImport;
+pub(crate) type nativeBackgroundProcessor = nativeBackgroundProcessorImport;
 
 /// `BackgroundProcessor` takes care of tasks that (1) need to happen periodically to keep
 /// Rust-Lightning running properly, and (2) either can or should be run in the background. Its
@@ -70,7 +70,7 @@ impl Drop for BackgroundProcessor {
 pub extern "C" fn BackgroundProcessor_free(this_obj: BackgroundProcessor) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn BackgroundProcessor_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn BackgroundProcessor_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeBackgroundProcessor); }
 }
 #[allow(unused)]
@@ -121,7 +121,7 @@ pub(crate) extern "C" fn ChannelManagerPersister_clone_fields(orig: &ChannelMana
 use lightning_background_processor::ChannelManagerPersister as rustChannelManagerPersister;
 impl rustChannelManagerPersister<crate::lightning::chain::keysinterface::Sign, crate::lightning::chain::Watch, crate::lightning::chain::chaininterface::BroadcasterInterface, crate::lightning::chain::keysinterface::KeysInterface, crate::lightning::chain::chaininterface::FeeEstimator, crate::lightning::util::logger::Logger> for ChannelManagerPersister {
        fn persist_manager(&self, mut channel_manager: &lightning::ln::channelmanager::ChannelManager<crate::lightning::chain::keysinterface::Sign, crate::lightning::chain::Watch, crate::lightning::chain::chaininterface::BroadcasterInterface, crate::lightning::chain::keysinterface::KeysInterface, crate::lightning::chain::chaininterface::FeeEstimator, crate::lightning::util::logger::Logger>) -> Result<(), std::io::Error> {
-               let mut ret = (self.persist_manager)(self.this_arg, &crate::lightning::ln::channelmanager::ChannelManager { inner: unsafe { ObjOps::nonnull_ptr_to_inner((channel_manager as *const _) as *mut _) }, is_owned: false });
+               let mut ret = (self.persist_manager)(self.this_arg, &crate::lightning::ln::channelmanager::ChannelManager { inner: unsafe { ObjOps::nonnull_ptr_to_inner((channel_manager as *const lightning::ln::channelmanager::ChannelManager<_, _, _, _, _, _, >) as *mut _) }, is_owned: false });
                let mut local_ret = match ret.result_ok { true => Ok( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) })*/ }), false => Err( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).to_rust() })};
                local_ret
        }
index e2937ab68a257a2cce808404a3e729a372f4254f..53314331cf26b146aa5665b794bb1808cf1d2822 100644 (file)
@@ -21,6 +21,7 @@ use core::convert::Infallible;
 use bitcoin::hashes::Hash;
 use crate::c_types::*;
 
+pub mod payment;
 pub mod utils;
 pub mod constants;
 mod de {
@@ -151,7 +152,7 @@ pub extern "C" fn check_platform() {
 
 
 use lightning_invoice::Invoice as nativeInvoiceImport;
-type nativeInvoice = nativeInvoiceImport;
+pub(crate) type nativeInvoice = nativeInvoiceImport;
 
 /// Represents a syntactically and semantically correct lightning BOLT11 invoice.
 ///
@@ -186,7 +187,7 @@ impl Drop for Invoice {
 pub extern "C" fn Invoice_free(this_obj: Invoice) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn Invoice_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn Invoice_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeInvoice); }
 }
 #[allow(unused)]
@@ -235,7 +236,7 @@ pub extern "C" fn Invoice_clone(orig: &Invoice) -> Invoice {
 }
 
 use lightning_invoice::SignedRawInvoice as nativeSignedRawInvoiceImport;
-type nativeSignedRawInvoice = nativeSignedRawInvoiceImport;
+pub(crate) type nativeSignedRawInvoice = nativeSignedRawInvoiceImport;
 
 /// Represents a signed `RawInvoice` with cached hash. The signature is not checked and may be
 /// invalid.
@@ -269,7 +270,7 @@ impl Drop for SignedRawInvoice {
 pub extern "C" fn SignedRawInvoice_free(this_obj: SignedRawInvoice) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn SignedRawInvoice_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn SignedRawInvoice_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeSignedRawInvoice); }
 }
 #[allow(unused)]
@@ -318,7 +319,7 @@ pub extern "C" fn SignedRawInvoice_clone(orig: &SignedRawInvoice) -> SignedRawIn
 }
 
 use lightning_invoice::RawInvoice as nativeRawInvoiceImport;
-type nativeRawInvoice = nativeRawInvoiceImport;
+pub(crate) type nativeRawInvoice = nativeRawInvoiceImport;
 
 /// Represents an syntactically correct Invoice for a payment on the lightning network,
 /// but without the signature information.
@@ -352,7 +353,7 @@ impl Drop for RawInvoice {
 pub extern "C" fn RawInvoice_free(this_obj: RawInvoice) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn RawInvoice_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn RawInvoice_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeRawInvoice); }
 }
 #[allow(unused)]
@@ -375,7 +376,7 @@ impl RawInvoice {
 #[no_mangle]
 pub extern "C" fn RawInvoice_get_data(this_ptr: &RawInvoice) -> crate::lightning_invoice::RawDataPart {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().data;
-       crate::lightning_invoice::RawDataPart { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const _) as *mut _) }, is_owned: false }
+       crate::lightning_invoice::RawDataPart { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning_invoice::RawDataPart<>) as *mut _) }, is_owned: false }
 }
 /// data part
 #[no_mangle]
@@ -412,7 +413,7 @@ pub extern "C" fn RawInvoice_clone(orig: &RawInvoice) -> RawInvoice {
 }
 
 use lightning_invoice::RawDataPart as nativeRawDataPartImport;
-type nativeRawDataPart = nativeRawDataPartImport;
+pub(crate) type nativeRawDataPart = nativeRawDataPartImport;
 
 /// Data of the `RawInvoice` that is encoded in the data part
 #[must_use]
@@ -442,7 +443,7 @@ impl Drop for RawDataPart {
 pub extern "C" fn RawDataPart_free(this_obj: RawDataPart) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn RawDataPart_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn RawDataPart_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeRawDataPart); }
 }
 #[allow(unused)]
@@ -465,7 +466,7 @@ impl RawDataPart {
 #[no_mangle]
 pub extern "C" fn RawDataPart_get_timestamp(this_ptr: &RawDataPart) -> crate::lightning_invoice::PositiveTimestamp {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().timestamp;
-       crate::lightning_invoice::PositiveTimestamp { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const _) as *mut _) }, is_owned: false }
+       crate::lightning_invoice::PositiveTimestamp { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning_invoice::PositiveTimestamp<>) as *mut _) }, is_owned: false }
 }
 /// generation time of the invoice
 #[no_mangle]
@@ -502,7 +503,7 @@ pub extern "C" fn RawDataPart_clone(orig: &RawDataPart) -> RawDataPart {
 }
 
 use lightning_invoice::PositiveTimestamp as nativePositiveTimestampImport;
-type nativePositiveTimestamp = nativePositiveTimestampImport;
+pub(crate) type nativePositiveTimestamp = nativePositiveTimestampImport;
 
 /// A timestamp that refers to a date after 1 January 1970 which means its representation as UNIX
 /// timestamp is positive.
@@ -537,7 +538,7 @@ impl Drop for PositiveTimestamp {
 pub extern "C" fn PositiveTimestamp_free(this_obj: PositiveTimestamp) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn PositiveTimestamp_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn PositiveTimestamp_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativePositiveTimestamp); }
 }
 #[allow(unused)]
@@ -774,7 +775,7 @@ pub extern "C" fn Currency_eq(a: &Currency, b: &Currency) -> bool {
 }
 
 use lightning_invoice::Sha256 as nativeSha256Import;
-type nativeSha256 = nativeSha256Import;
+pub(crate) type nativeSha256 = nativeSha256Import;
 
 /// SHA-256 hash
 #[must_use]
@@ -804,7 +805,7 @@ impl Drop for Sha256 {
 pub extern "C" fn Sha256_free(this_obj: Sha256) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn Sha256_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn Sha256_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeSha256); }
 }
 #[allow(unused)]
@@ -863,7 +864,7 @@ pub extern "C" fn Sha256_eq(a: &Sha256, b: &Sha256) -> bool {
 }
 
 use lightning_invoice::Description as nativeDescriptionImport;
-type nativeDescription = nativeDescriptionImport;
+pub(crate) type nativeDescription = nativeDescriptionImport;
 
 /// Description string
 ///
@@ -896,7 +897,7 @@ impl Drop for Description {
 pub extern "C" fn Description_free(this_obj: Description) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn Description_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn Description_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeDescription); }
 }
 #[allow(unused)]
@@ -955,7 +956,7 @@ pub extern "C" fn Description_eq(a: &Description, b: &Description) -> bool {
 }
 
 use lightning_invoice::PayeePubKey as nativePayeePubKeyImport;
-type nativePayeePubKey = nativePayeePubKeyImport;
+pub(crate) type nativePayeePubKey = nativePayeePubKeyImport;
 
 /// Payee public key
 #[must_use]
@@ -985,7 +986,7 @@ impl Drop for PayeePubKey {
 pub extern "C" fn PayeePubKey_free(this_obj: PayeePubKey) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn PayeePubKey_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn PayeePubKey_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativePayeePubKey); }
 }
 #[allow(unused)]
@@ -1004,6 +1005,23 @@ impl PayeePubKey {
                ret
        }
 }
+#[no_mangle]
+pub extern "C" fn PayeePubKey_get_a(this_ptr: &PayeePubKey) -> crate::c_types::PublicKey {
+       let mut inner_val = &mut this_ptr.get_native_mut_ref().0;
+       crate::c_types::PublicKey::from_rust(&inner_val)
+}
+#[no_mangle]
+pub extern "C" fn PayeePubKey_set_a(this_ptr: &mut PayeePubKey, mut val: crate::c_types::PublicKey) {
+       unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.0 = val.into_rust();
+}
+/// Constructs a new PayeePubKey given each field
+#[must_use]
+#[no_mangle]
+pub extern "C" fn PayeePubKey_new(mut a_arg: crate::c_types::PublicKey) -> PayeePubKey {
+       PayeePubKey { inner: ObjOps::heap_alloc(lightning_invoice::PayeePubKey (
+               a_arg.into_rust(),
+       )), is_owned: true }
+}
 impl Clone for PayeePubKey {
        fn clone(&self) -> Self {
                Self {
@@ -1044,7 +1062,7 @@ pub extern "C" fn PayeePubKey_eq(a: &PayeePubKey, b: &PayeePubKey) -> bool {
 }
 
 use lightning_invoice::ExpiryTime as nativeExpiryTimeImport;
-type nativeExpiryTime = nativeExpiryTimeImport;
+pub(crate) type nativeExpiryTime = nativeExpiryTimeImport;
 
 /// Positive duration that defines when (relatively to the timestamp) in the future the invoice
 /// expires
@@ -1080,7 +1098,7 @@ impl Drop for ExpiryTime {
 pub extern "C" fn ExpiryTime_free(this_obj: ExpiryTime) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn ExpiryTime_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn ExpiryTime_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeExpiryTime); }
 }
 #[allow(unused)]
@@ -1139,7 +1157,7 @@ pub extern "C" fn ExpiryTime_eq(a: &ExpiryTime, b: &ExpiryTime) -> bool {
 }
 
 use lightning_invoice::MinFinalCltvExpiry as nativeMinFinalCltvExpiryImport;
-type nativeMinFinalCltvExpiry = nativeMinFinalCltvExpiryImport;
+pub(crate) type nativeMinFinalCltvExpiry = nativeMinFinalCltvExpiryImport;
 
 /// `min_final_cltv_expiry` to use for the last HTLC in the route
 #[must_use]
@@ -1169,7 +1187,7 @@ impl Drop for MinFinalCltvExpiry {
 pub extern "C" fn MinFinalCltvExpiry_free(this_obj: MinFinalCltvExpiry) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn MinFinalCltvExpiry_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn MinFinalCltvExpiry_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeMinFinalCltvExpiry); }
 }
 #[allow(unused)]
@@ -1188,6 +1206,23 @@ impl MinFinalCltvExpiry {
                ret
        }
 }
+#[no_mangle]
+pub extern "C" fn MinFinalCltvExpiry_get_a(this_ptr: &MinFinalCltvExpiry) -> u64 {
+       let mut inner_val = &mut this_ptr.get_native_mut_ref().0;
+       *inner_val
+}
+#[no_mangle]
+pub extern "C" fn MinFinalCltvExpiry_set_a(this_ptr: &mut MinFinalCltvExpiry, mut val: u64) {
+       unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.0 = val;
+}
+/// Constructs a new MinFinalCltvExpiry given each field
+#[must_use]
+#[no_mangle]
+pub extern "C" fn MinFinalCltvExpiry_new(mut a_arg: u64) -> MinFinalCltvExpiry {
+       MinFinalCltvExpiry { inner: ObjOps::heap_alloc(lightning_invoice::MinFinalCltvExpiry (
+               a_arg,
+       )), is_owned: true }
+}
 impl Clone for MinFinalCltvExpiry {
        fn clone(&self) -> Self {
                Self {
@@ -1380,7 +1415,7 @@ pub extern "C" fn Fallback_eq(a: &Fallback, b: &Fallback) -> bool {
 }
 
 use lightning_invoice::InvoiceSignature as nativeInvoiceSignatureImport;
-type nativeInvoiceSignature = nativeInvoiceSignatureImport;
+pub(crate) type nativeInvoiceSignature = nativeInvoiceSignatureImport;
 
 /// Recoverable signature
 #[must_use]
@@ -1410,7 +1445,7 @@ impl Drop for InvoiceSignature {
 pub extern "C" fn InvoiceSignature_free(this_obj: InvoiceSignature) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn InvoiceSignature_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn InvoiceSignature_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeInvoiceSignature); }
 }
 #[allow(unused)]
@@ -1459,7 +1494,7 @@ pub extern "C" fn InvoiceSignature_eq(a: &InvoiceSignature, b: &InvoiceSignature
 }
 
 use lightning_invoice::PrivateRoute as nativePrivateRouteImport;
-type nativePrivateRoute = nativePrivateRouteImport;
+pub(crate) type nativePrivateRoute = nativePrivateRouteImport;
 
 /// Private routing information
 ///
@@ -1493,7 +1528,7 @@ impl Drop for PrivateRoute {
 pub extern "C" fn PrivateRoute_free(this_obj: PrivateRoute) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn PrivateRoute_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn PrivateRoute_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativePrivateRoute); }
 }
 #[allow(unused)]
@@ -1567,7 +1602,7 @@ pub extern "C" fn SignedRawInvoice_into_parts(mut this_arg: SignedRawInvoice) ->
 #[no_mangle]
 pub extern "C" fn SignedRawInvoice_raw_invoice(this_arg: &SignedRawInvoice) -> crate::lightning_invoice::RawInvoice {
        let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.raw_invoice();
-       crate::lightning_invoice::RawInvoice { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const _) as *mut _) }, is_owned: false }
+       crate::lightning_invoice::RawInvoice { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning_invoice::RawInvoice<>) as *mut _) }, is_owned: false }
 }
 
 /// The hash of the `RawInvoice` that was signed.
@@ -1583,7 +1618,7 @@ pub extern "C" fn SignedRawInvoice_hash(this_arg: &SignedRawInvoice) -> *const [
 #[no_mangle]
 pub extern "C" fn SignedRawInvoice_signature(this_arg: &SignedRawInvoice) -> crate::lightning_invoice::InvoiceSignature {
        let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.signature();
-       crate::lightning_invoice::InvoiceSignature { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const _) as *mut _) }, is_owned: false }
+       crate::lightning_invoice::InvoiceSignature { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning_invoice::InvoiceSignature<>) as *mut _) }, is_owned: false }
 }
 
 /// Recovers the public key used for signing the invoice from the recoverable signature.
@@ -1618,7 +1653,7 @@ pub extern "C" fn RawInvoice_hash(this_arg: &RawInvoice) -> crate::c_types::Thir
 #[no_mangle]
 pub extern "C" fn RawInvoice_payment_hash(this_arg: &RawInvoice) -> crate::lightning_invoice::Sha256 {
        let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payment_hash();
-       let mut local_ret = crate::lightning_invoice::Sha256 { inner: unsafe { (if ret.is_none() { std::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (ret.unwrap()) }) } as *const _) as *mut _ }, is_owned: false };
+       let mut local_ret = crate::lightning_invoice::Sha256 { inner: unsafe { (if ret.is_none() { std::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (ret.unwrap()) }) } as *const lightning_invoice::Sha256<>) as *mut _ }, is_owned: false };
        local_ret
 }
 
@@ -1628,7 +1663,7 @@ pub extern "C" fn RawInvoice_payment_hash(this_arg: &RawInvoice) -> crate::light
 #[no_mangle]
 pub extern "C" fn RawInvoice_description(this_arg: &RawInvoice) -> crate::lightning_invoice::Description {
        let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.description();
-       let mut local_ret = crate::lightning_invoice::Description { inner: unsafe { (if ret.is_none() { std::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (ret.unwrap()) }) } as *const _) as *mut _ }, is_owned: false };
+       let mut local_ret = crate::lightning_invoice::Description { inner: unsafe { (if ret.is_none() { std::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (ret.unwrap()) }) } as *const lightning_invoice::Description<>) as *mut _ }, is_owned: false };
        local_ret
 }
 
@@ -1638,7 +1673,7 @@ pub extern "C" fn RawInvoice_description(this_arg: &RawInvoice) -> crate::lightn
 #[no_mangle]
 pub extern "C" fn RawInvoice_payee_pub_key(this_arg: &RawInvoice) -> crate::lightning_invoice::PayeePubKey {
        let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payee_pub_key();
-       let mut local_ret = crate::lightning_invoice::PayeePubKey { inner: unsafe { (if ret.is_none() { std::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (ret.unwrap()) }) } as *const _) as *mut _ }, is_owned: false };
+       let mut local_ret = crate::lightning_invoice::PayeePubKey { inner: unsafe { (if ret.is_none() { std::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (ret.unwrap()) }) } as *const lightning_invoice::PayeePubKey<>) as *mut _ }, is_owned: false };
        local_ret
 }
 
@@ -1648,7 +1683,7 @@ pub extern "C" fn RawInvoice_payee_pub_key(this_arg: &RawInvoice) -> crate::ligh
 #[no_mangle]
 pub extern "C" fn RawInvoice_description_hash(this_arg: &RawInvoice) -> crate::lightning_invoice::Sha256 {
        let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.description_hash();
-       let mut local_ret = crate::lightning_invoice::Sha256 { inner: unsafe { (if ret.is_none() { std::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (ret.unwrap()) }) } as *const _) as *mut _ }, is_owned: false };
+       let mut local_ret = crate::lightning_invoice::Sha256 { inner: unsafe { (if ret.is_none() { std::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (ret.unwrap()) }) } as *const lightning_invoice::Sha256<>) as *mut _ }, is_owned: false };
        local_ret
 }
 
@@ -1658,7 +1693,7 @@ pub extern "C" fn RawInvoice_description_hash(this_arg: &RawInvoice) -> crate::l
 #[no_mangle]
 pub extern "C" fn RawInvoice_expiry_time(this_arg: &RawInvoice) -> crate::lightning_invoice::ExpiryTime {
        let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.expiry_time();
-       let mut local_ret = crate::lightning_invoice::ExpiryTime { inner: unsafe { (if ret.is_none() { std::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (ret.unwrap()) }) } as *const _) as *mut _ }, is_owned: false };
+       let mut local_ret = crate::lightning_invoice::ExpiryTime { inner: unsafe { (if ret.is_none() { std::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (ret.unwrap()) }) } as *const lightning_invoice::ExpiryTime<>) as *mut _ }, is_owned: false };
        local_ret
 }
 
@@ -1668,7 +1703,7 @@ pub extern "C" fn RawInvoice_expiry_time(this_arg: &RawInvoice) -> crate::lightn
 #[no_mangle]
 pub extern "C" fn RawInvoice_min_final_cltv_expiry(this_arg: &RawInvoice) -> crate::lightning_invoice::MinFinalCltvExpiry {
        let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.min_final_cltv_expiry();
-       let mut local_ret = crate::lightning_invoice::MinFinalCltvExpiry { inner: unsafe { (if ret.is_none() { std::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (ret.unwrap()) }) } as *const _) as *mut _ }, is_owned: false };
+       let mut local_ret = crate::lightning_invoice::MinFinalCltvExpiry { inner: unsafe { (if ret.is_none() { std::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (ret.unwrap()) }) } as *const lightning_invoice::MinFinalCltvExpiry<>) as *mut _ }, is_owned: false };
        local_ret
 }
 
@@ -1688,7 +1723,7 @@ pub extern "C" fn RawInvoice_payment_secret(this_arg: &RawInvoice) -> crate::c_t
 #[no_mangle]
 pub extern "C" fn RawInvoice_features(this_arg: &RawInvoice) -> crate::lightning::ln::features::InvoiceFeatures {
        let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.features();
-       let mut local_ret = crate::lightning::ln::features::InvoiceFeatures { inner: unsafe { (if ret.is_none() { std::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (ret.unwrap()) }) } as *const _) as *mut _ }, is_owned: false };
+       let mut local_ret = crate::lightning::ln::features::InvoiceFeatures { inner: unsafe { (if ret.is_none() { std::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (ret.unwrap()) }) } as *const lightning::ln::features::InvoiceFeatures<>) as *mut _ }, is_owned: false };
        local_ret
 }
 
@@ -1696,7 +1731,7 @@ pub extern "C" fn RawInvoice_features(this_arg: &RawInvoice) -> crate::lightning
 #[no_mangle]
 pub extern "C" fn RawInvoice_private_routes(this_arg: &RawInvoice) -> crate::c_types::derived::CVec_PrivateRouteZ {
        let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.private_routes();
-       let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning_invoice::PrivateRoute { inner: unsafe { ObjOps::nonnull_ptr_to_inner((item as *const _) as *mut _) }, is_owned: false } }); };
+       let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning_invoice::PrivateRoute { inner: unsafe { ObjOps::nonnull_ptr_to_inner((item as *const lightning_invoice::PrivateRoute<>) as *mut _) }, is_owned: false } }); };
        local_ret.into()
 }
 
@@ -1828,9 +1863,9 @@ pub extern "C" fn Invoice_payee_pub_key(this_arg: &Invoice) -> crate::c_types::P
 /// Get the payment secret if one was included in the invoice
 #[must_use]
 #[no_mangle]
-pub extern "C" fn Invoice_payment_secret(this_arg: &Invoice) -> crate::c_types::ThirtyTwoBytes {
+pub extern "C" fn Invoice_payment_secret(this_arg: &Invoice) -> *const [u8; 32] {
        let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payment_secret();
-       crate::c_types::ThirtyTwoBytes { data: ret.0 }
+       &ret.0
 }
 
 /// Get the invoice features if they were included in the invoice
@@ -1840,7 +1875,7 @@ pub extern "C" fn Invoice_payment_secret(this_arg: &Invoice) -> crate::c_types::
 #[no_mangle]
 pub extern "C" fn Invoice_features(this_arg: &Invoice) -> crate::lightning::ln::features::InvoiceFeatures {
        let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.features();
-       let mut local_ret = crate::lightning::ln::features::InvoiceFeatures { inner: unsafe { (if ret.is_none() { std::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (ret.unwrap()) }) } as *const _) as *mut _ }, is_owned: false };
+       let mut local_ret = crate::lightning::ln::features::InvoiceFeatures { inner: unsafe { (if ret.is_none() { std::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (ret.unwrap()) }) } as *const lightning::ln::features::InvoiceFeatures<>) as *mut _ }, is_owned: false };
        local_ret
 }
 
@@ -1860,6 +1895,14 @@ pub extern "C" fn Invoice_expiry_time(this_arg: &Invoice) -> u64 {
        ret.as_secs()
 }
 
+/// Returns whether the invoice has expired.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn Invoice_is_expired(this_arg: &Invoice) -> bool {
+       let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.is_expired();
+       ret
+}
+
 /// Returns the invoice's `min_final_cltv_expiry` time, if present, otherwise
 /// [`DEFAULT_MIN_FINAL_CLTV_EXPIRY`].
 #[must_use]
@@ -1874,7 +1917,7 @@ pub extern "C" fn Invoice_min_final_cltv_expiry(this_arg: &Invoice) -> u64 {
 #[no_mangle]
 pub extern "C" fn Invoice_private_routes(this_arg: &Invoice) -> crate::c_types::derived::CVec_PrivateRouteZ {
        let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.private_routes();
-       let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning_invoice::PrivateRoute { inner: unsafe { ObjOps::nonnull_ptr_to_inner((item as *const _) as *mut _) }, is_owned: false } }); };
+       let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning_invoice::PrivateRoute { inner: unsafe { ObjOps::nonnull_ptr_to_inner((item as *const lightning_invoice::PrivateRoute<>) as *mut _) }, is_owned: false } }); };
        local_ret.into()
 }
 
@@ -1883,7 +1926,7 @@ pub extern "C" fn Invoice_private_routes(this_arg: &Invoice) -> crate::c_types::
 #[no_mangle]
 pub extern "C" fn Invoice_route_hints(this_arg: &Invoice) -> crate::c_types::derived::CVec_RouteHintZ {
        let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.route_hints();
-       let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning::routing::router::RouteHint { inner: unsafe { ObjOps::nonnull_ptr_to_inner((item as *const _) as *mut _) }, is_owned: false } }); };
+       let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning::routing::router::RouteHint { inner: ObjOps::heap_alloc(item), is_owned: true } }); };
        local_ret.into()
 }
 
@@ -1895,11 +1938,11 @@ pub extern "C" fn Invoice_currency(this_arg: &Invoice) -> crate::lightning_invoi
        crate::lightning_invoice::Currency::native_into(ret)
 }
 
-/// Returns the amount if specified in the invoice as pico <currency>.
+/// Returns the amount if specified in the invoice as millisatoshis.
 #[must_use]
 #[no_mangle]
-pub extern "C" fn Invoice_amount_pico_btc(this_arg: &Invoice) -> crate::c_types::derived::COption_u64Z {
-       let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.amount_pico_btc();
+pub extern "C" fn Invoice_amount_milli_satoshis(this_arg: &Invoice) -> crate::c_types::derived::COption_u64Z {
+       let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.amount_milli_satoshis();
        let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { ret.unwrap() }) };
        local_ret
 }
diff --git a/lightning-c-bindings/src/lightning_invoice/payment.rs b/lightning-c-bindings/src/lightning_invoice/payment.rs
new file mode 100644 (file)
index 0000000..6c7a2ca
--- /dev/null
@@ -0,0 +1,611 @@
+// 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.
+
+//! A module for paying Lightning invoices.
+//!
+//! Defines an [`InvoicePayer`] utility for paying invoices, parameterized by [`Payer`] and
+//! [`Router`] traits. Implementations of [`Payer`] provide the payer's node id, channels, and means
+//! to send a payment over a [`Route`]. Implementations of [`Router`] find a [`Route`] between payer
+//! and payee using information provided by the payer and from the payee's [`Invoice`].
+//!
+//! [`InvoicePayer`] is capable of retrying failed payments. It accomplishes this by implementing
+//! [`EventHandler`] which decorates a user-provided handler. It will intercept any
+//! [`Event::PaymentPathFailed`] events and retry the failed paths for a fixed number of total
+//! attempts or until retry is no longer possible. In such a situation, [`InvoicePayer`] will pass
+//! along the events to the user-provided handler.
+//!
+//! # Example
+//!
+//! ```
+//! # extern crate lightning;
+//! # extern crate lightning_invoice;
+//! # extern crate secp256k1;
+//! #
+//! # use lightning::ln::{PaymentHash, PaymentSecret};
+//! # use lightning::ln::channelmanager::{ChannelDetails, PaymentId, PaymentSendFailure};
+//! # use lightning::ln::msgs::LightningError;
+//! # use lightning::routing::{self, LockableScore};
+//! # use lightning::routing::network_graph::NodeId;
+//! # use lightning::routing::router::{Route, RouteHop, RouteParameters};
+//! # use lightning::util::events::{Event, EventHandler, EventsProvider};
+//! # use lightning::util::logger::{Logger, Record};
+//! # use lightning_invoice::Invoice;
+//! # use lightning_invoice::payment::{InvoicePayer, Payer, RetryAttempts, Router};
+//! # use secp256k1::key::PublicKey;
+//! # use std::cell::RefCell;
+//! # use std::ops::Deref;
+//! #
+//! # struct FakeEventProvider {}
+//! # impl EventsProvider for FakeEventProvider {
+//! #     fn process_pending_events<H: Deref>(&self, handler: H) where H::Target: EventHandler {}
+//! # }
+//! #
+//! # struct FakePayer {}
+//! # impl Payer for FakePayer {
+//! #     fn node_id(&self) -> PublicKey { unimplemented!() }
+//! #     fn first_hops(&self) -> Vec<ChannelDetails> { unimplemented!() }
+//! #     fn send_payment(
+//! #         &self, route: &Route, payment_hash: PaymentHash, payment_secret: &Option<PaymentSecret>
+//! #     ) -> Result<PaymentId, PaymentSendFailure> { unimplemented!() }
+//! #     fn retry_payment(
+//! #         &self, route: &Route, payment_id: PaymentId
+//! #     ) -> Result<(), PaymentSendFailure> { unimplemented!() }
+//! # }
+//! #
+//! # struct FakeRouter {};
+//! # impl<S: routing::Score> Router<S> for FakeRouter {
+//! #     fn find_route(
+//! #         &self, payer: &PublicKey, params: &RouteParameters,
+//! #         first_hops: Option<&[&ChannelDetails]>, scorer: &S
+//! #     ) -> Result<Route, LightningError> { unimplemented!() }
+//! # }
+//! #
+//! # struct FakeScorer {};
+//! # impl lightning::util::ser::Writeable for FakeScorer {
+//! #     fn write<W: lightning::util::ser::Writer>(&self, _: &mut W) -> Result<(), std::io::Error> { unreachable!(); }
+//! # }
+//! # impl routing::Score for FakeScorer {
+//! #     fn channel_penalty_msat(
+//! #         &self, _short_channel_id: u64, _source: &NodeId, _target: &NodeId
+//! #     ) -> u64 { 0 }
+//! #     fn payment_path_failed(&mut self, _path: &[&RouteHop], _short_channel_id: u64) {}
+//! # }
+//! #
+//! # struct FakeLogger {};
+//! # impl Logger for FakeLogger {
+//! #     fn log(&self, record: &Record) { unimplemented!() }
+//! # }
+//! #
+//! # fn main() {
+//! let event_handler = |event: &Event| {
+//!     match event {
+//!         Event::PaymentPathFailed { .. } => println!(\"payment failed after retries\"),
+//!         Event::PaymentSent { .. } => println!(\"payment successful\"),
+//!         _ => {},
+//!     }
+//! };
+//! # let payer = FakePayer {};
+//! # let router = FakeRouter {};
+//! # let scorer = LockableScore::new(FakeScorer {});
+//! # let logger = FakeLogger {};
+//! let invoice_payer = InvoicePayer::new(&payer, router, &scorer, &logger, event_handler, RetryAttempts(2));
+//!
+//! let invoice = \"...\";
+//! let invoice = invoice.parse::<Invoice>().unwrap();
+//! invoice_payer.pay_invoice(&invoice).unwrap();
+//!
+//! # let event_provider = FakeEventProvider {};
+//! loop {
+//!     event_provider.process_pending_events(&invoice_payer);
+//! }
+//! # }
+//! ```
+//!
+//! # Note
+//!
+//! The [`Route`] is computed before each payment attempt. Any updates affecting path finding such
+//! as updates to the network graph or changes to channel scores should be applied prior to
+//! retries, typically by way of composing [`EventHandler`]s accordingly.
+
+use std::str::FromStr;
+use std::ffi::c_void;
+use core::convert::Infallible;
+use bitcoin::hashes::Hash;
+use crate::c_types::*;
+
+
+use lightning_invoice::payment::InvoicePayer as nativeInvoicePayerImport;
+pub(crate) type nativeInvoicePayer = nativeInvoicePayerImport<crate::lightning_invoice::payment::Payer, crate::lightning_invoice::payment::Router, crate::lightning::routing::Score, &'static lightning::routing::LockableScore<crate::lightning::routing::Score>, crate::lightning::util::logger::Logger, crate::lightning::util::events::EventHandler>;
+
+/// A utility for paying [`Invoice]`s.
+#[must_use]
+#[repr(C)]
+pub struct InvoicePayer {
+       /// 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 nativeInvoicePayer,
+       /// Indicates that this is the only struct which contains the same pointer.
+
+       /// Rust functions which take ownership of an object provided via an argument require
+       /// this to be true and invalidate the object pointed to by inner.
+       pub is_owned: bool,
+}
+
+impl Drop for InvoicePayer {
+       fn drop(&mut self) {
+               if self.is_owned && !<*mut nativeInvoicePayer>::is_null(self.inner) {
+                       let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+               }
+       }
+}
+/// Frees any resources used by the InvoicePayer, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn InvoicePayer_free(this_obj: InvoicePayer) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn InvoicePayer_free_void(this_ptr: *mut c_void) {
+       unsafe { let _ = Box::from_raw(this_ptr as *mut nativeInvoicePayer); }
+}
+#[allow(unused)]
+impl InvoicePayer {
+       pub(crate) fn get_native_ref(&self) -> &'static nativeInvoicePayer {
+               unsafe { &*ObjOps::untweak_ptr(self.inner) }
+       }
+       pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeInvoicePayer {
+               unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
+       }
+       /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
+       pub(crate) fn take_inner(mut self) -> *mut nativeInvoicePayer {
+               assert!(self.is_owned);
+               let ret = ObjOps::untweak_ptr(self.inner);
+               self.inner = std::ptr::null_mut();
+               ret
+       }
+}
+/// A trait defining behavior of an [`Invoice`] payer.
+#[repr(C)]
+pub struct Payer {
+       /// 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 payer's node id.
+       #[must_use]
+       pub node_id: extern "C" fn (this_arg: *const c_void) -> crate::c_types::PublicKey,
+       /// Returns the payer's channels.
+       #[must_use]
+       pub first_hops: extern "C" fn (this_arg: *const c_void) -> crate::c_types::derived::CVec_ChannelDetailsZ,
+       /// Sends a payment over the Lightning Network using the given [`Route`].
+       ///
+       /// Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None
+       #[must_use]
+       pub send_payment: extern "C" fn (this_arg: *const c_void, route: &crate::lightning::routing::router::Route, payment_hash: crate::c_types::ThirtyTwoBytes, payment_secret: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_PaymentIdPaymentSendFailureZ,
+       /// Retries a failed payment path for the [`PaymentId`] using the given [`Route`].
+       #[must_use]
+       pub retry_payment: extern "C" fn (this_arg: *const c_void, route: &crate::lightning::routing::router::Route, payment_id: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_NonePaymentSendFailureZ,
+       /// Frees any resources associated with this object given its this_arg pointer.
+       /// Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+       pub free: Option<extern "C" fn(this_arg: *mut c_void)>,
+}
+unsafe impl Send for Payer {}
+unsafe impl Sync for Payer {}
+#[no_mangle]
+pub(crate) extern "C" fn Payer_clone_fields(orig: &Payer) -> Payer {
+       Payer {
+               this_arg: orig.this_arg,
+               node_id: Clone::clone(&orig.node_id),
+               first_hops: Clone::clone(&orig.first_hops),
+               send_payment: Clone::clone(&orig.send_payment),
+               retry_payment: Clone::clone(&orig.retry_payment),
+               free: Clone::clone(&orig.free),
+       }
+}
+
+use lightning_invoice::payment::Payer as rustPayer;
+impl rustPayer for Payer {
+       fn node_id(&self) -> secp256k1::key::PublicKey {
+               let mut ret = (self.node_id)(self.this_arg);
+               ret.into_rust()
+       }
+       fn first_hops(&self) -> Vec<lightning::ln::channelmanager::ChannelDetails> {
+               let mut ret = (self.first_hops)(self.this_arg);
+               let mut local_ret = Vec::new(); for mut item in ret.into_rust().drain(..) { local_ret.push( { *unsafe { Box::from_raw(item.take_inner()) } }); };
+               local_ret
+       }
+       fn send_payment(&self, mut route: &lightning::routing::router::Route, mut payment_hash: lightning::ln::PaymentHash, mut payment_secret: &Option<lightning::ln::PaymentSecret>) -> Result<lightning::ln::channelmanager::PaymentId, lightning::ln::channelmanager::PaymentSendFailure> {
+               let mut local_payment_secret = if payment_secret.is_none() { crate::c_types::ThirtyTwoBytes::null() } else {  { crate::c_types::ThirtyTwoBytes { data: (payment_secret.unwrap()).0 } } };
+               let mut ret = (self.send_payment)(self.this_arg, &crate::lightning::routing::router::Route { inner: unsafe { ObjOps::nonnull_ptr_to_inner((route as *const lightning::routing::router::Route<>) as *mut _) }, is_owned: false }, crate::c_types::ThirtyTwoBytes { data: payment_hash.0 }, local_payment_secret);
+               let mut local_ret = match ret.result_ok { true => Ok( { ::lightning::ln::channelmanager::PaymentId((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).data) }), false => Err( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).into_native() })};
+               local_ret
+       }
+       fn retry_payment(&self, mut route: &lightning::routing::router::Route, mut payment_id: lightning::ln::channelmanager::PaymentId) -> Result<(), lightning::ln::channelmanager::PaymentSendFailure> {
+               let mut ret = (self.retry_payment)(self.this_arg, &crate::lightning::routing::router::Route { inner: unsafe { ObjOps::nonnull_ptr_to_inner((route as *const lightning::routing::router::Route<>) as *mut _) }, is_owned: false }, crate::c_types::ThirtyTwoBytes { data: payment_id.0 });
+               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
+       }
+}
+
+// We're essentially a pointer already, or at least a set of pointers, so allow us to be used
+// directly as a Deref trait in higher-level structs:
+impl std::ops::Deref for Payer {
+       type Target = Self;
+       fn deref(&self) -> &Self {
+               self
+       }
+}
+/// Calls the free function if one is set
+#[no_mangle]
+pub extern "C" fn Payer_free(this_ptr: Payer) { }
+impl Drop for Payer {
+       fn drop(&mut self) {
+               if let Some(f) = self.free {
+                       f(self.this_arg);
+               }
+       }
+}
+/// A trait defining behavior for routing an [`Invoice`] payment.
+#[repr(C)]
+pub struct Router {
+       /// 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,
+       /// Finds a [`Route`] between `payer` and `payee` for a payment with the given values.
+       ///
+       /// Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
+       #[must_use]
+       pub find_route: extern "C" fn (this_arg: *const c_void, payer: crate::c_types::PublicKey, params: &crate::lightning::routing::router::RouteParameters, first_hops: *mut crate::c_types::derived::CVec_ChannelDetailsZ, scorer: &crate::lightning::routing::Score) -> crate::c_types::derived::CResult_RouteLightningErrorZ,
+       /// 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 Router {}
+unsafe impl Sync for Router {}
+#[no_mangle]
+pub(crate) extern "C" fn Router_clone_fields(orig: &Router) -> Router {
+       Router {
+               this_arg: orig.this_arg,
+               find_route: Clone::clone(&orig.find_route),
+               free: Clone::clone(&orig.free),
+       }
+}
+
+use lightning_invoice::payment::Router as rustRouter;
+impl rustRouter<crate::lightning::routing::Score> for Router {
+       fn find_route(&self, mut payer: &secp256k1::key::PublicKey, mut params: &lightning::routing::router::RouteParameters, mut first_hops: Option<&[&lightning::ln::channelmanager::ChannelDetails]>, mut scorer: &crate::lightning::routing::Score) -> Result<lightning::routing::router::Route, lightning::ln::msgs::LightningError> {
+               let mut local_first_hops_base = if first_hops.is_none() { SmartPtr::null() } else { SmartPtr::from_obj( { let mut local_first_hops_0 = Vec::new(); for item in (first_hops.unwrap()).iter() { local_first_hops_0.push( { crate::lightning::ln::channelmanager::ChannelDetails { inner: unsafe { ObjOps::nonnull_ptr_to_inner(((*item) as *const lightning::ln::channelmanager::ChannelDetails<>) as *mut _) }, is_owned: false } }); }; local_first_hops_0.into() }) }; let mut local_first_hops = *local_first_hops_base;
+               let mut ret = (self.find_route)(self.this_arg, crate::c_types::PublicKey::from_rust(&payer), &crate::lightning::routing::router::RouteParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((params as *const lightning::routing::router::RouteParameters<>) as *mut _) }, is_owned: false }, local_first_hops, scorer);
+               let mut local_ret = match ret.result_ok { true => Ok( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).take_inner()) } }), false => Err( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).take_inner()) } })};
+               local_ret
+       }
+}
+
+// We're essentially a pointer already, or at least a set of pointers, so allow us to be used
+// directly as a Deref trait in higher-level structs:
+impl std::ops::Deref for Router {
+       type Target = Self;
+       fn deref(&self) -> &Self {
+               self
+       }
+}
+/// Calls the free function if one is set
+#[no_mangle]
+pub extern "C" fn Router_free(this_ptr: Router) { }
+impl Drop for Router {
+       fn drop(&mut self) {
+               if let Some(f) = self.free {
+                       f(self.this_arg);
+               }
+       }
+}
+
+use lightning_invoice::payment::RetryAttempts as nativeRetryAttemptsImport;
+pub(crate) type nativeRetryAttempts = nativeRetryAttemptsImport;
+
+/// Number of attempts to retry payment path failures for an [`Invoice`].
+///
+/// Note that this is the number of *path* failures, not full payment retries. For multi-path
+/// payments, if this is less than the total number of paths, we will never even retry all of the
+/// payment's paths.
+#[must_use]
+#[repr(C)]
+pub struct RetryAttempts {
+       /// A pointer to the opaque Rust object.
+
+       /// Nearly everywhere, inner must be non-null, however in places where
+       /// the Rust equivalent takes an Option, it may be set to null to indicate None.
+       pub inner: *mut nativeRetryAttempts,
+       /// Indicates that this is the only struct which contains the same pointer.
+
+       /// Rust functions which take ownership of an object provided via an argument require
+       /// this to be true and invalidate the object pointed to by inner.
+       pub is_owned: bool,
+}
+
+impl Drop for RetryAttempts {
+       fn drop(&mut self) {
+               if self.is_owned && !<*mut nativeRetryAttempts>::is_null(self.inner) {
+                       let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+               }
+       }
+}
+/// Frees any resources used by the RetryAttempts, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn RetryAttempts_free(this_obj: RetryAttempts) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn RetryAttempts_free_void(this_ptr: *mut c_void) {
+       unsafe { let _ = Box::from_raw(this_ptr as *mut nativeRetryAttempts); }
+}
+#[allow(unused)]
+impl RetryAttempts {
+       pub(crate) fn get_native_ref(&self) -> &'static nativeRetryAttempts {
+               unsafe { &*ObjOps::untweak_ptr(self.inner) }
+       }
+       pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeRetryAttempts {
+               unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
+       }
+       /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
+       pub(crate) fn take_inner(mut self) -> *mut nativeRetryAttempts {
+               assert!(self.is_owned);
+               let ret = ObjOps::untweak_ptr(self.inner);
+               self.inner = std::ptr::null_mut();
+               ret
+       }
+}
+#[no_mangle]
+pub extern "C" fn RetryAttempts_get_a(this_ptr: &RetryAttempts) -> usize {
+       let mut inner_val = &mut this_ptr.get_native_mut_ref().0;
+       *inner_val
+}
+#[no_mangle]
+pub extern "C" fn RetryAttempts_set_a(this_ptr: &mut RetryAttempts, mut val: usize) {
+       unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.0 = val;
+}
+/// Constructs a new RetryAttempts given each field
+#[must_use]
+#[no_mangle]
+pub extern "C" fn RetryAttempts_new(mut a_arg: usize) -> RetryAttempts {
+       RetryAttempts { inner: ObjOps::heap_alloc(lightning_invoice::payment::RetryAttempts (
+               a_arg,
+       )), is_owned: true }
+}
+impl Clone for RetryAttempts {
+       fn clone(&self) -> Self {
+               Self {
+                       inner: if <*mut nativeRetryAttempts>::is_null(self.inner) { std::ptr::null_mut() } else {
+                               ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
+                       is_owned: true,
+               }
+       }
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn RetryAttempts_clone_void(this_ptr: *const c_void) -> *mut c_void {
+       Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeRetryAttempts)).clone() })) as *mut c_void
+}
+#[no_mangle]
+/// Creates a copy of the RetryAttempts
+pub extern "C" fn RetryAttempts_clone(orig: &RetryAttempts) -> RetryAttempts {
+       orig.clone()
+}
+/// Checks if two RetryAttemptss contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn RetryAttempts_eq(a: &RetryAttempts, b: &RetryAttempts) -> bool {
+       if a.inner == b.inner { return true; }
+       if a.inner.is_null() || b.inner.is_null() { return false; }
+       if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
+/// Checks if two RetryAttemptss contain equal inner contents.
+#[no_mangle]
+pub extern "C" fn RetryAttempts_hash(o: &RetryAttempts) -> u64 {
+       if o.inner.is_null() { return 0; }
+       // Note that we'd love to use std::collections::hash_map::DefaultHasher but it's not in core
+       #[allow(deprecated)]
+       let mut hasher = core::hash::SipHasher::new();
+       std::hash::Hash::hash(o.get_native_ref(), &mut hasher);
+       std::hash::Hasher::finish(&hasher)
+}
+/// An error that may occur when making a payment.
+#[must_use]
+#[derive(Clone)]
+#[repr(C)]
+pub enum PaymentError {
+       /// An error resulting from the provided [`Invoice`] or payment hash.
+       Invoice(crate::c_types::Str),
+       /// An error occurring when finding a route.
+       Routing(crate::lightning::ln::msgs::LightningError),
+       /// An error occurring when sending a payment.
+       Sending(crate::lightning::ln::channelmanager::PaymentSendFailure),
+}
+use lightning_invoice::payment::PaymentError as nativePaymentError;
+impl PaymentError {
+       #[allow(unused)]
+       pub(crate) fn to_native(&self) -> nativePaymentError {
+               match self {
+                       PaymentError::Invoice (ref a, ) => {
+                               let mut a_nonref = (*a).clone();
+                               nativePaymentError::Invoice (
+                                       a_nonref.into_str(),
+                               )
+                       },
+                       PaymentError::Routing (ref a, ) => {
+                               let mut a_nonref = (*a).clone();
+                               nativePaymentError::Routing (
+                                       *unsafe { Box::from_raw(a_nonref.take_inner()) },
+                               )
+                       },
+                       PaymentError::Sending (ref a, ) => {
+                               let mut a_nonref = (*a).clone();
+                               nativePaymentError::Sending (
+                                       a_nonref.into_native(),
+                               )
+                       },
+               }
+       }
+       #[allow(unused)]
+       pub(crate) fn into_native(self) -> nativePaymentError {
+               match self {
+                       PaymentError::Invoice (mut a, ) => {
+                               nativePaymentError::Invoice (
+                                       a.into_str(),
+                               )
+                       },
+                       PaymentError::Routing (mut a, ) => {
+                               nativePaymentError::Routing (
+                                       *unsafe { Box::from_raw(a.take_inner()) },
+                               )
+                       },
+                       PaymentError::Sending (mut a, ) => {
+                               nativePaymentError::Sending (
+                                       a.into_native(),
+                               )
+                       },
+               }
+       }
+       #[allow(unused)]
+       pub(crate) fn from_native(native: &nativePaymentError) -> Self {
+               match native {
+                       nativePaymentError::Invoice (ref a, ) => {
+                               let mut a_nonref = (*a).clone();
+                               PaymentError::Invoice (
+                                       a_nonref.into(),
+                               )
+                       },
+                       nativePaymentError::Routing (ref a, ) => {
+                               let mut a_nonref = (*a).clone();
+                               PaymentError::Routing (
+                                       crate::lightning::ln::msgs::LightningError { inner: ObjOps::heap_alloc(a_nonref), is_owned: true },
+                               )
+                       },
+                       nativePaymentError::Sending (ref a, ) => {
+                               let mut a_nonref = (*a).clone();
+                               PaymentError::Sending (
+                                       crate::lightning::ln::channelmanager::PaymentSendFailure::native_into(a_nonref),
+                               )
+                       },
+               }
+       }
+       #[allow(unused)]
+       pub(crate) fn native_into(native: nativePaymentError) -> Self {
+               match native {
+                       nativePaymentError::Invoice (mut a, ) => {
+                               PaymentError::Invoice (
+                                       a.into(),
+                               )
+                       },
+                       nativePaymentError::Routing (mut a, ) => {
+                               PaymentError::Routing (
+                                       crate::lightning::ln::msgs::LightningError { inner: ObjOps::heap_alloc(a), is_owned: true },
+                               )
+                       },
+                       nativePaymentError::Sending (mut a, ) => {
+                               PaymentError::Sending (
+                                       crate::lightning::ln::channelmanager::PaymentSendFailure::native_into(a),
+                               )
+                       },
+               }
+       }
+}
+/// Frees any resources used by the PaymentError
+#[no_mangle]
+pub extern "C" fn PaymentError_free(this_ptr: PaymentError) { }
+/// Creates a copy of the PaymentError
+#[no_mangle]
+pub extern "C" fn PaymentError_clone(orig: &PaymentError) -> PaymentError {
+       orig.clone()
+}
+#[no_mangle]
+/// Utility method to constructs a new Invoice-variant PaymentError
+pub extern "C" fn PaymentError_invoice(a: crate::c_types::Str) -> PaymentError {
+       PaymentError::Invoice(a, )
+}
+#[no_mangle]
+/// Utility method to constructs a new Routing-variant PaymentError
+pub extern "C" fn PaymentError_routing(a: crate::lightning::ln::msgs::LightningError) -> PaymentError {
+       PaymentError::Routing(a, )
+}
+#[no_mangle]
+/// Utility method to constructs a new Sending-variant PaymentError
+pub extern "C" fn PaymentError_sending(a: crate::lightning::ln::channelmanager::PaymentSendFailure) -> PaymentError {
+       PaymentError::Sending(a, )
+}
+/// Creates an invoice payer that retries failed payment paths.
+///
+/// Will forward any [`Event::PaymentPathFailed`] events to the decorated `event_handler` once
+/// `retry_attempts` has been exceeded for a given [`Invoice`].
+#[must_use]
+#[no_mangle]
+pub extern "C" fn InvoicePayer_new(mut payer: crate::lightning_invoice::payment::Payer, mut router: crate::lightning_invoice::payment::Router, scorer: &crate::lightning::routing::LockableScore, mut logger: crate::lightning::util::logger::Logger, mut event_handler: crate::lightning::util::events::EventHandler, mut retry_attempts: crate::lightning_invoice::payment::RetryAttempts) -> InvoicePayer {
+       let mut ret = lightning_invoice::payment::InvoicePayer::new(payer, router, scorer.get_native_ref(), logger, event_handler, *unsafe { Box::from_raw(retry_attempts.take_inner()) });
+       InvoicePayer { inner: ObjOps::heap_alloc(ret), is_owned: true }
+}
+
+/// Pays the given [`Invoice`], caching it for later use in case a retry is needed.
+///
+/// You should ensure that the `invoice.payment_hash()` is unique and the same payment_hash has
+/// never been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so
+/// for you.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn InvoicePayer_pay_invoice(this_arg: &InvoicePayer, invoice: &crate::lightning_invoice::Invoice) -> crate::c_types::derived::CResult_PaymentIdPaymentErrorZ {
+       let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.pay_invoice(invoice.get_native_ref());
+       let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::ThirtyTwoBytes { data: o.0 } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning_invoice::payment::PaymentError::native_into(e) }).into() };
+       local_ret
+}
+
+/// Pays the given zero-value [`Invoice`] using the given amount, caching it for later use in
+/// case a retry is needed.
+///
+/// You should ensure that the `invoice.payment_hash()` is unique and the same payment_hash has
+/// never been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so
+/// for you.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn InvoicePayer_pay_zero_value_invoice(this_arg: &InvoicePayer, invoice: &crate::lightning_invoice::Invoice, mut amount_msats: u64) -> crate::c_types::derived::CResult_PaymentIdPaymentErrorZ {
+       let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.pay_zero_value_invoice(invoice.get_native_ref(), amount_msats);
+       let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::ThirtyTwoBytes { data: o.0 } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning_invoice::payment::PaymentError::native_into(e) }).into() };
+       local_ret
+}
+
+/// Removes the payment cached by the given payment hash.
+///
+/// Should be called once a payment has failed or succeeded if not using [`InvoicePayer`] as an
+/// [`EventHandler`]. Otherwise, calling this method is unnecessary.
+#[no_mangle]
+pub extern "C" fn InvoicePayer_remove_cached_payment(this_arg: &InvoicePayer, payment_hash: *const [u8; 32]) {
+       unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.remove_cached_payment(&::lightning::ln::PaymentHash(unsafe { *payment_hash }))
+}
+
+impl From<nativeInvoicePayer> for crate::lightning::util::events::EventHandler {
+       fn from(obj: nativeInvoicePayer) -> Self {
+               let mut rust_obj = InvoicePayer { inner: ObjOps::heap_alloc(obj), is_owned: true };
+               let mut ret = InvoicePayer_as_EventHandler(&rust_obj);
+               // We want to free rust_obj when ret gets drop()'d, not rust_obj, so wipe rust_obj's pointer and set ret's free() fn
+               rust_obj.inner = std::ptr::null_mut();
+               ret.free = Some(InvoicePayer_free_void);
+               ret
+       }
+}
+/// Constructs a new EventHandler which calls the relevant methods on this_arg.
+/// This copies the `inner` pointer in this_arg and thus the returned EventHandler must be freed before this_arg is
+#[no_mangle]
+pub extern "C" fn InvoicePayer_as_EventHandler(this_arg: &InvoicePayer) -> crate::lightning::util::events::EventHandler {
+       crate::lightning::util::events::EventHandler {
+               this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void },
+               free: None,
+               handle_event: InvoicePayer_EventHandler_handle_event,
+       }
+}
+
+extern "C" fn InvoicePayer_EventHandler_handle_event(this_arg: *const c_void, event: &crate::lightning::util::events::Event) {
+       <nativeInvoicePayer as lightning::util::events::EventHandler<>>::handle_event(unsafe { &mut *(this_arg as *mut nativeInvoicePayer) }, &event.to_native())
+}
+
index 74807a517ae91b04c3ce8323586a12edf5ab2a0f..aeb6f1cd8439bd57946663826821c517e157f12e 100644 (file)
@@ -27,3 +27,143 @@ pub extern "C" fn create_invoice_from_channelmanager(channelmanager: &crate::lig
        local_ret
 }
 
+
+use lightning_invoice::utils::DefaultRouter as nativeDefaultRouterImport;
+pub(crate) type nativeDefaultRouter = nativeDefaultRouterImport<&'static lightning::routing::network_graph::NetworkGraph, crate::lightning::util::logger::Logger>;
+
+/// A [`Router`] implemented using [`find_route`].
+#[must_use]
+#[repr(C)]
+pub struct DefaultRouter {
+       /// 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 nativeDefaultRouter,
+       /// Indicates that this is the only struct which contains the same pointer.
+
+       /// Rust functions which take ownership of an object provided via an argument require
+       /// this to be true and invalidate the object pointed to by inner.
+       pub is_owned: bool,
+}
+
+impl Drop for DefaultRouter {
+       fn drop(&mut self) {
+               if self.is_owned && !<*mut nativeDefaultRouter>::is_null(self.inner) {
+                       let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+               }
+       }
+}
+/// Frees any resources used by the DefaultRouter, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn DefaultRouter_free(this_obj: DefaultRouter) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn DefaultRouter_free_void(this_ptr: *mut c_void) {
+       unsafe { let _ = Box::from_raw(this_ptr as *mut nativeDefaultRouter); }
+}
+#[allow(unused)]
+impl DefaultRouter {
+       pub(crate) fn get_native_ref(&self) -> &'static nativeDefaultRouter {
+               unsafe { &*ObjOps::untweak_ptr(self.inner) }
+       }
+       pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeDefaultRouter {
+               unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
+       }
+       /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
+       pub(crate) fn take_inner(mut self) -> *mut nativeDefaultRouter {
+               assert!(self.is_owned);
+               let ret = ObjOps::untweak_ptr(self.inner);
+               self.inner = std::ptr::null_mut();
+               ret
+       }
+}
+/// Creates a new router using the given [`NetworkGraph`] and  [`Logger`].
+#[must_use]
+#[no_mangle]
+pub extern "C" fn DefaultRouter_new(network_graph: &crate::lightning::routing::network_graph::NetworkGraph, mut logger: crate::lightning::util::logger::Logger) -> DefaultRouter {
+       let mut ret = lightning_invoice::utils::DefaultRouter::new(network_graph.get_native_ref(), logger);
+       DefaultRouter { inner: ObjOps::heap_alloc(ret), is_owned: true }
+}
+
+impl From<nativeDefaultRouter> for crate::lightning_invoice::payment::Router {
+       fn from(obj: nativeDefaultRouter) -> Self {
+               let mut rust_obj = DefaultRouter { inner: ObjOps::heap_alloc(obj), is_owned: true };
+               let mut ret = DefaultRouter_as_Router(&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 = std::ptr::null_mut();
+               ret.free = Some(DefaultRouter_free_void);
+               ret
+       }
+}
+/// Constructs a new Router which calls the relevant methods on this_arg.
+/// This copies the `inner` pointer in this_arg and thus the returned Router must be freed before this_arg is
+#[no_mangle]
+pub extern "C" fn DefaultRouter_as_Router(this_arg: &DefaultRouter) -> crate::lightning_invoice::payment::Router {
+       crate::lightning_invoice::payment::Router {
+               this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void },
+               free: None,
+               find_route: DefaultRouter_Router_find_route,
+       }
+}
+
+#[must_use]
+extern "C" fn DefaultRouter_Router_find_route(this_arg: *const c_void, mut payer: crate::c_types::PublicKey, params: &crate::lightning::routing::router::RouteParameters, first_hops: *mut crate::c_types::derived::CVec_ChannelDetailsZ, scorer: &crate::lightning::routing::Score) -> crate::c_types::derived::CResult_RouteLightningErrorZ {
+       let mut local_first_hops_base = if first_hops == std::ptr::null_mut() { None } else { Some( { let mut local_first_hops_0 = Vec::new(); for mut item in unsafe { &mut *first_hops }.as_slice().iter() { local_first_hops_0.push( { item.get_native_ref() }); }; local_first_hops_0 }) }; let mut local_first_hops = local_first_hops_base.as_ref().map(|a| &a[..]);
+       let mut ret = <nativeDefaultRouter as lightning_invoice::payment::Router<_>>::find_route(unsafe { &mut *(this_arg as *mut nativeDefaultRouter) }, &payer.into_rust(), params.get_native_ref(), local_first_hops, scorer);
+       let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::router::Route { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::LightningError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       local_ret
+}
+
+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 };
+               let mut ret = ChannelManager_as_Payer(&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 = std::ptr::null_mut();
+               ret.free = Some(ChannelManager_free_void);
+               ret
+       }
+}
+/// Constructs a new Payer which calls the relevant methods on this_arg.
+/// This copies the `inner` pointer in this_arg and thus the returned Payer must be freed before this_arg is
+#[no_mangle]
+pub extern "C" fn ChannelManager_as_Payer(this_arg: &ChannelManager) -> crate::lightning_invoice::payment::Payer {
+       crate::lightning_invoice::payment::Payer {
+               this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void },
+               free: None,
+               node_id: ChannelManager_Payer_node_id,
+               first_hops: ChannelManager_Payer_first_hops,
+               send_payment: ChannelManager_Payer_send_payment,
+               retry_payment: ChannelManager_Payer_retry_payment,
+       }
+}
+
+#[must_use]
+extern "C" fn ChannelManager_Payer_node_id(this_arg: *const c_void) -> crate::c_types::PublicKey {
+       let mut ret = <nativeChannelManager as lightning_invoice::payment::Payer<>>::node_id(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, );
+       crate::c_types::PublicKey::from_rust(&ret)
+}
+#[must_use]
+extern "C" fn ChannelManager_Payer_first_hops(this_arg: *const c_void) -> crate::c_types::derived::CVec_ChannelDetailsZ {
+       let mut ret = <nativeChannelManager as lightning_invoice::payment::Payer<>>::first_hops(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, );
+       let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning::ln::channelmanager::ChannelDetails { inner: ObjOps::heap_alloc(item), is_owned: true } }); };
+       local_ret.into()
+}
+#[must_use]
+extern "C" fn ChannelManager_Payer_send_payment(this_arg: *const c_void, route: &crate::lightning::routing::router::Route, mut payment_hash: crate::c_types::ThirtyTwoBytes, mut payment_secret: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_PaymentIdPaymentSendFailureZ {
+       let mut local_payment_secret = if payment_secret.data == [0; 32] { None } else { Some( { ::lightning::ln::PaymentSecret(payment_secret.data) }) };
+       let mut ret = <nativeChannelManager as lightning_invoice::payment::Payer<>>::send_payment(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, route.get_native_ref(), ::lightning::ln::PaymentHash(payment_hash.data), &local_payment_secret);
+       let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::ThirtyTwoBytes { data: o.0 } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::channelmanager::PaymentSendFailure::native_into(e) }).into() };
+       local_ret
+}
+#[must_use]
+extern "C" fn ChannelManager_Payer_retry_payment(this_arg: *const c_void, route: &crate::lightning::routing::router::Route, mut payment_id: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_NonePaymentSendFailureZ {
+       let mut ret = <nativeChannelManager as lightning_invoice::payment::Payer<>>::retry_payment(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, route.get_native_ref(), ::lightning::ln::channelmanager::PaymentId(payment_id.data));
+       let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::channelmanager::PaymentSendFailure::native_into(e) }).into() };
+       local_ret
+}
+
index c0cd08a3ddbe815eb82ba7b04d980cb01c4cd5ef..303e73512dbcc7bab3f8bd2e5cf1dda1ed95436c 100644 (file)
@@ -25,7 +25,7 @@ use crate::c_types::*;
 }
 
 use lightning_persister::FilesystemPersister as nativeFilesystemPersisterImport;
-type nativeFilesystemPersister = nativeFilesystemPersisterImport;
+pub(crate) type nativeFilesystemPersister = nativeFilesystemPersisterImport;
 
 /// FilesystemPersister persists channel data on disk, where each channel's
 /// data is stored in a file named after its funding outpoint.
@@ -66,7 +66,7 @@ impl Drop for FilesystemPersister {
 pub extern "C" fn FilesystemPersister_free(this_obj: FilesystemPersister) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn FilesystemPersister_free_void(this_ptr: *mut c_void) {
+pub(crate) extern "C" fn FilesystemPersister_free_void(this_ptr: *mut c_void) {
        unsafe { let _ = Box::from_raw(this_ptr as *mut nativeFilesystemPersister); }
 }
 #[allow(unused)]
@@ -144,14 +144,15 @@ pub extern "C" fn FilesystemPersister_as_Persist(this_arg: &FilesystemPersister)
 }
 
 #[must_use]
-extern "C" fn FilesystemPersister_Persist_persist_new_channel(this_arg: *const c_void, mut funding_txo: crate::lightning::chain::transaction::OutPoint, monitor: &crate::lightning::chain::channelmonitor::ChannelMonitor) -> crate::c_types::derived::CResult_NoneChannelMonitorUpdateErrZ {
-       let mut ret = <nativeFilesystemPersister as lightning::chain::chainmonitor::Persist<_>>::persist_new_channel(unsafe { &mut *(this_arg as *mut nativeFilesystemPersister) }, *unsafe { Box::from_raw(funding_txo.take_inner()) }, monitor.get_native_ref());
+extern "C" fn FilesystemPersister_Persist_persist_new_channel(this_arg: *const c_void, mut funding_txo: crate::lightning::chain::transaction::OutPoint, monitor: &crate::lightning::chain::channelmonitor::ChannelMonitor, mut _update_id: crate::lightning::chain::chainmonitor::MonitorUpdateId) -> crate::c_types::derived::CResult_NoneChannelMonitorUpdateErrZ {
+       let mut ret = <nativeFilesystemPersister as lightning::chain::chainmonitor::Persist<_>>::persist_new_channel(unsafe { &mut *(this_arg as *mut nativeFilesystemPersister) }, *unsafe { Box::from_raw(funding_txo.take_inner()) }, monitor.get_native_ref(), *unsafe { Box::from_raw(_update_id.take_inner()) });
        let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::chain::ChannelMonitorUpdateErr::native_into(e) }).into() };
        local_ret
 }
 #[must_use]
-extern "C" fn FilesystemPersister_Persist_update_persisted_channel(this_arg: *const c_void, mut funding_txo: crate::lightning::chain::transaction::OutPoint, _update: &crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, monitor: &crate::lightning::chain::channelmonitor::ChannelMonitor) -> crate::c_types::derived::CResult_NoneChannelMonitorUpdateErrZ {
-       let mut ret = <nativeFilesystemPersister as lightning::chain::chainmonitor::Persist<_>>::update_persisted_channel(unsafe { &mut *(this_arg as *mut nativeFilesystemPersister) }, *unsafe { Box::from_raw(funding_txo.take_inner()) }, _update.get_native_ref(), monitor.get_native_ref());
+extern "C" fn FilesystemPersister_Persist_update_persisted_channel(this_arg: *const c_void, mut funding_txo: crate::lightning::chain::transaction::OutPoint, _update: &crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, monitor: &crate::lightning::chain::channelmonitor::ChannelMonitor, mut _update_id: crate::lightning::chain::chainmonitor::MonitorUpdateId) -> crate::c_types::derived::CResult_NoneChannelMonitorUpdateErrZ {
+       let mut local__update = if _update.inner.is_null() { None } else { Some((* { _update.get_native_ref() }).clone()) };
+       let mut ret = <nativeFilesystemPersister as lightning::chain::chainmonitor::Persist<_>>::update_persisted_channel(unsafe { &mut *(this_arg as *mut nativeFilesystemPersister) }, *unsafe { Box::from_raw(funding_txo.take_inner()) }, &local__update, monitor.get_native_ref(), *unsafe { Box::from_raw(_update_id.take_inner()) });
        let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::chain::ChannelMonitorUpdateErr::native_into(e) }).into() };
        local_ret
 }