Regenerate auto-generated bindings with license info and new upstream
[ldk-c-bindings] / lightning-c-bindings / include / lightning.h
index 5869546d83e2ad3d860b5bc9c16d82cd4db79b63..c85ac58e919d6224d6a3e3f9388eff3012ca0fe4 100644 (file)
@@ -11,8 +11,6 @@
 
 /**
  * An error when accessing the chain via [`Access`].
- *
- * [`Access`]: trait.Access.html
  */
 typedef enum LDKAccessError {
    /**
@@ -1060,6 +1058,32 @@ typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds {
    bool is_owned;
 } LDKQueryShortChannelIds;
 
+
+
+/**
+ * A reply_channel_range message is a reply to a query_channel_range
+ * message. Multiple reply_channel_range messages can be sent in reply
+ * to a single query_channel_range message. The query recipient makes a
+ * best effort to respond based on their local network view which may
+ * not be a perfect view of the network. The short_channel_ids in the
+ * reply are encoded. We only support encoding_type=0 uncompressed
+ * serialization and do not support encoding_type=1 zlib serialization.
+ */
+typedef struct MUST_USE_STRUCT LDKReplyChannelRange {
+   /**
+    * 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.
+    */
+   LDKnativeReplyChannelRange *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;
+} LDKReplyChannelRange;
+
 /**
  * An event generated by ChannelManager which indicates a message should be sent to a peer (or
  * broadcast to most peers).
@@ -1150,6 +1174,11 @@ typedef enum LDKMessageSendEvent_Tag {
     * their short_channel_ids.
     */
    LDKMessageSendEvent_SendShortIdsQuery,
+   /**
+    * Sends a reply to a channel range query. This may be one of several SendReplyChannelRange events
+    * emitted during processing of the query.
+    */
+   LDKMessageSendEvent_SendReplyChannelRange,
    /**
     * Must be last for serialization purposes
     */
@@ -1342,6 +1371,17 @@ typedef struct LDKMessageSendEvent_LDKSendShortIdsQuery_Body {
    struct LDKQueryShortChannelIds msg;
 } LDKMessageSendEvent_LDKSendShortIdsQuery_Body;
 
+typedef struct LDKMessageSendEvent_LDKSendReplyChannelRange_Body {
+   /**
+    * The node_id of this message recipient
+    */
+   struct LDKPublicKey node_id;
+   /**
+    * The reply_channel_range which should be sent.
+    */
+   struct LDKReplyChannelRange msg;
+} LDKMessageSendEvent_LDKSendReplyChannelRange_Body;
+
 typedef struct MUST_USE_STRUCT LDKMessageSendEvent {
    LDKMessageSendEvent_Tag tag;
    union {
@@ -1363,6 +1403,7 @@ typedef struct MUST_USE_STRUCT LDKMessageSendEvent {
       LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body payment_failure_network_update;
       LDKMessageSendEvent_LDKSendChannelRangeQuery_Body send_channel_range_query;
       LDKMessageSendEvent_LDKSendShortIdsQuery_Body send_short_ids_query;
+      LDKMessageSendEvent_LDKSendReplyChannelRange_Body send_reply_channel_range;
    };
 } LDKMessageSendEvent;
 
@@ -1972,8 +2013,6 @@ typedef struct LDKCResult_NoneChannelMonitorUpdateErrZ {
  * Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on
  * chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the
  * preimage claim backward will lead to loss of funds.
- *
- * [`chain::Watch`]: ../trait.Watch.html
  */
 typedef struct MUST_USE_STRUCT LDKHTLCUpdate {
    /**
@@ -3018,9 +3057,9 @@ typedef struct LDKCVec_ChannelMonitorZ {
  * funds in the channel. See [`ChannelMonitorUpdateErr`] for more details about how to handle
  * multiple instances.
  *
- * [`ChannelMonitor`]: channelmonitor/struct.ChannelMonitor.html
- * [`ChannelMonitorUpdateErr`]: channelmonitor/enum.ChannelMonitorUpdateErr.html
- * [`PermanentFailure`]: channelmonitor/enum.ChannelMonitorUpdateErr.html#variant.PermanentFailure
+ * [`ChannelMonitor`]: channelmonitor::ChannelMonitor
+ * [`ChannelMonitorUpdateErr`]: channelmonitor::ChannelMonitorUpdateErr
+ * [`PermanentFailure`]: channelmonitor::ChannelMonitorUpdateErr::PermanentFailure
  */
 typedef struct LDKWatch {
    /**
@@ -3035,9 +3074,9 @@ typedef struct LDKWatch {
     * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means
     * calling [`block_connected`] and [`block_disconnected`] on the monitor.
     *
-    * [`get_outputs_to_watch`]: channelmonitor/struct.ChannelMonitor.html#method.get_outputs_to_watch
-    * [`block_connected`]: channelmonitor/struct.ChannelMonitor.html#method.block_connected
-    * [`block_disconnected`]: channelmonitor/struct.ChannelMonitor.html#method.block_disconnected
+    * [`get_outputs_to_watch`]: channelmonitor::ChannelMonitor::get_outputs_to_watch
+    * [`block_connected`]: channelmonitor::ChannelMonitor::block_connected
+    * [`block_disconnected`]: channelmonitor::ChannelMonitor::block_disconnected
     */
    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor);
    /**
@@ -3046,8 +3085,8 @@ typedef struct LDKWatch {
     * Implementations must call [`update_monitor`] with the given update. See
     * [`ChannelMonitorUpdateErr`] for invariants around returning an error.
     *
-    * [`update_monitor`]: channelmonitor/struct.ChannelMonitor.html#method.update_monitor
-    * [`ChannelMonitorUpdateErr`]: channelmonitor/enum.ChannelMonitorUpdateErr.html
+    * [`update_monitor`]: channelmonitor::ChannelMonitor::update_monitor
+    * [`ChannelMonitorUpdateErr`]: channelmonitor::ChannelMonitorUpdateErr
     */
    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update);
    /**
@@ -4027,32 +4066,6 @@ typedef struct LDKCResult_QueryChannelRangeDecodeErrorZ {
    bool result_ok;
 } LDKCResult_QueryChannelRangeDecodeErrorZ;
 
-
-
-/**
- * A reply_channel_range message is a reply to a query_channel_range
- * message. Multiple reply_channel_range messages can be sent in reply
- * to a single query_channel_range message. The query recipient makes a
- * best effort to respond based on their local network view which may
- * not be a perfect view of the network. The short_channel_ids in the
- * reply are encoded. We only support encoding_type=0 uncompressed
- * serialization and do not support encoding_type=1 zlib serialization.
- */
-typedef struct MUST_USE_STRUCT LDKReplyChannelRange {
-   /**
-    * 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.
-    */
-   LDKnativeReplyChannelRange *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;
-} LDKReplyChannelRange;
-
 typedef union LDKCResult_ReplyChannelRangeDecodeErrorZPtr {
    struct LDKReplyChannelRange *result;
    struct LDKDecodeError *err;
@@ -4279,11 +4292,10 @@ typedef struct LDKListen {
  *
  * Note that use as part of a [`Watch`] implementation involves reentrancy. Therefore, the `Filter`
  * should not block on I/O. Implementations should instead queue the newly monitored data to be
- * processed later. Then, in order to block until the data has been processed, any `Watch`
+ * processed later. Then, in order to block until the data has been processed, any [`Watch`]
  * invocation that has called the `Filter` must return [`TemporaryFailure`].
  *
- * [`Watch`]: trait.Watch.html
- * [`TemporaryFailure`]: channelmonitor/enum.ChannelMonitorUpdateErr.html#variant.TemporaryFailure
+ * [`TemporaryFailure`]: channelmonitor::ChannelMonitorUpdateErr::TemporaryFailure
  * [BIP 157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki
  * [BIP 158]: https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki
  */
@@ -4336,11 +4348,8 @@ typedef struct LDKPersist {
     * stored channel data). Note that you **must** persist every new monitor to
     * disk. See the `Persist` trait documentation for more details.
     *
-    * See [`ChannelMonitor::serialize_for_disk`] for writing out a `ChannelMonitor`,
+    * See [`ChannelMonitor::write`] for writing out a `ChannelMonitor`,
     * and [`ChannelMonitorUpdateErr`] for requirements when returning errors.
-    *
-    * [`ChannelMonitor::serialize_for_disk`]: struct.ChannelMonitor.html#method.serialize_for_disk
-    * [`ChannelMonitorUpdateErr`]: enum.ChannelMonitorUpdateErr.html
     */
    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*persist_new_channel)(const void *this_arg, struct LDKOutPoint id, const struct LDKChannelMonitor *NONNULL_PTR data);
    /**
@@ -4363,14 +4372,9 @@ typedef struct LDKPersist {
     * them in batches. The size of each monitor grows `O(number of state updates)`
     * whereas updates are small and `O(1)`.
     *
-    * See [`ChannelMonitor::serialize_for_disk`] for writing out a `ChannelMonitor`,
+    * See [`ChannelMonitor::write`] for writing out a `ChannelMonitor`,
     * [`ChannelMonitorUpdate::write`] for writing out an update, and
     * [`ChannelMonitorUpdateErr`] for requirements when returning errors.
-    *
-    * [`ChannelMonitor::update_monitor`]: struct.ChannelMonitor.html#impl-1
-    * [`ChannelMonitor::serialize_for_disk`]: struct.ChannelMonitor.html#method.serialize_for_disk
-    * [`ChannelMonitorUpdate::write`]: struct.ChannelMonitorUpdate.html#method.write
-    * [`ChannelMonitorUpdateErr`]: enum.ChannelMonitorUpdateErr.html
     */
    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);
    /**
@@ -4390,9 +4394,8 @@ typedef struct LDKPersist {
  * or used independently to monitor channels remotely. See the [module-level documentation] for
  * details.
  *
- * [`chain::Watch`]: ../trait.Watch.html
- * [`ChannelManager`]: ../../ln/channelmanager/struct.ChannelManager.html
- * [module-level documentation]: index.html
+ * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
+ * [module-level documentation]: crate::chain::chainmonitor
  */
 typedef struct MUST_USE_STRUCT LDKChainMonitor {
    /**
@@ -4550,6 +4553,10 @@ typedef struct LDKChannelMessageHandler {
     * Handle an incoming channel_reestablish message from the given peer.
     */
    void (*handle_channel_reestablish)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReestablish *NONNULL_PTR msg);
+   /**
+    * Handle an incoming channel update from the given peer.
+    */
+   void (*handle_channel_update)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelUpdate *NONNULL_PTR msg);
    /**
     * Handle an incoming error message from the given peer.
     */
@@ -4950,6 +4957,8 @@ extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT;
 
 extern const uint64_t CLOSED_CHANNEL_UPDATE_ID;
 
+extern const uint16_t BREAKDOWN_TIMEOUT;
+
 extern const uintptr_t REVOKEABLE_REDEEMSCRIPT_MAX_LENGTH;
 
 void Transaction_free(struct LDKTransaction _res);
@@ -5788,7 +5797,7 @@ void ChannelHandshakeConfig_set_minimum_depth(struct LDKChannelHandshakeConfig *
  * case of an honest unilateral channel close, which implicitly decrease the economic value of
  * our channel.
  *
- * Default value: BREAKDOWN_TIMEOUT (currently 144), we enforce it as a minimum at channel
+ * Default value: [`BREAKDOWN_TIMEOUT`] (currently 144), we enforce it as a minimum at channel
  * opening so you can tweak config to ask for more security, not less.
  */
 uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
@@ -5804,7 +5813,7 @@ uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const struct LDKChannelHan
  * case of an honest unilateral channel close, which implicitly decrease the economic value of
  * our channel.
  *
- * Default value: BREAKDOWN_TIMEOUT (currently 144), we enforce it as a minimum at channel
+ * Default value: [`BREAKDOWN_TIMEOUT`] (currently 144), we enforce it as a minimum at channel
  * opening so you can tweak config to ask for more security, not less.
  */
 void ChannelHandshakeConfig_set_our_to_self_delay(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val);
@@ -6265,10 +6274,6 @@ void ChainMonitor_free(struct LDKChainMonitor this_obj);
  * calls must not exclude any transactions matching the new outputs nor any in-block
  * descendants of such transactions. It is not necessary to re-fetch the block to obtain
  * updated `txdata`.
- *
- * [`ChannelMonitor::block_connected`]: ../channelmonitor/struct.ChannelMonitor.html#method.block_connected
- * [`chain::Watch::release_pending_monitor_events`]: ../trait.Watch.html#tymethod.release_pending_monitor_events
- * [`chain::Filter`]: ../trait.Filter.html
  */
 void ChainMonitor_block_connected(const struct LDKChainMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
 
@@ -6276,8 +6281,6 @@ void ChainMonitor_block_connected(const struct LDKChainMonitor *NONNULL_PTR this
  * Dispatches to per-channel monitors, which are responsible for updating their on-chain view
  * of a channel based on the disconnected block. See [`ChannelMonitor::block_disconnected`] for
  * details.
- *
- * [`ChannelMonitor::block_disconnected`]: ../channelmonitor/struct.ChannelMonitor.html#method.block_disconnected
  */
 void ChainMonitor_block_disconnected(const struct LDKChainMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], uint32_t disconnected_height);
 
@@ -6289,8 +6292,6 @@ void ChainMonitor_block_disconnected(const struct LDKChainMonitor *NONNULL_PTR t
  * pre-filter blocks or only fetch blocks matching a compact filter. Otherwise, clients may
  * always need to fetch full blocks absent another means for determining which blocks contain
  * transactions relevant to the watched channels.
- *
- * [`chain::Filter`]: ../trait.Filter.html
  */
 MUST_USE_RES struct LDKChainMonitor ChainMonitor_new(struct LDKFilter *chain_source, struct LDKBroadcasterInterface broadcaster, struct LDKLogger logger, struct LDKFeeEstimator feeest, struct LDKPersist persister);
 
@@ -6323,8 +6324,6 @@ void ChannelMonitorUpdate_free(struct LDKChannelMonitorUpdate this_obj);
  * The only instance where update_id values are not strictly increasing is the case where we
  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
  * its docs for more details.
- *
- * [`CLOSED_CHANNEL_UPDATE_ID`]: constant.CLOSED_CHANNEL_UPDATE_ID.html
  */
 uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr);
 
@@ -6340,8 +6339,6 @@ uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate
  * The only instance where update_id values are not strictly increasing is the case where we
  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
  * its docs for more details.
- *
- * [`CLOSED_CHANNEL_UPDATE_ID`]: constant.CLOSED_CHANNEL_UPDATE_ID.html
  */
 void ChannelMonitorUpdate_set_update_id(struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr, uint64_t val);
 
@@ -6450,8 +6447,6 @@ void ChannelMonitor_load_outputs_to_watch(const struct LDKChannelMonitor *NONNUL
 /**
  * Get the list of HTLCs who's status has been updated on chain. This should be called by
  * ChannelManager via [`chain::Watch::release_pending_monitor_events`].
- *
- * [`chain::Watch::release_pending_monitor_events`]: ../trait.Watch.html#tymethod.release_pending_monitor_events
  */
 MUST_USE_RES struct LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
 
@@ -8917,12 +8912,26 @@ uint8_t UnsignedChannelUpdate_get_flags(const struct LDKUnsignedChannelUpdate *N
 void UnsignedChannelUpdate_set_flags(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint8_t val);
 
 /**
- * The number of blocks to subtract from incoming HTLC cltv_expiry values
+ * The number of blocks such that if:
+ * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
+ * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
+ * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
+ * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
+ * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
+ * forwarding. Note that the HTLC sender is the one who originally sets this value when
+ * constructing the route.
  */
 uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
 
 /**
- * The number of blocks to subtract from incoming HTLC cltv_expiry values
+ * The number of blocks such that if:
+ * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
+ * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
+ * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
+ * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
+ * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
+ * forwarding. Note that the HTLC sender is the one who originally sets this value when
+ * constructing the route.
  */
 void UnsignedChannelUpdate_set_cltv_expiry_delta(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint16_t val);
 
@@ -9613,6 +9622,11 @@ struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_re
  */
 struct LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj);
 
+/**
+ *\n\t * Calculates the overflow safe ending block height for the query.\n\t * Overflow returns `0xffffffff`, otherwise returns `first_blocknum + number_of_blocks`\n\t
+ */
+MUST_USE_RES uint32_t QueryChannelRange_end_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_arg);
+
 /**
  * Read a QueryChannelRange from a byte array, created by QueryChannelRange_write
  */
@@ -10622,9 +10636,7 @@ void InvoiceFeatures_free(struct LDKInvoiceFeatures this_obj);
 MUST_USE_RES struct LDKInitFeatures InitFeatures_empty(void);
 
 /**
- * Creates features known by the implementation as defined by [`T::KNOWN_FEATURE_FLAGS`].
- *
- * [`T::KNOWN_FEATURE_FLAGS`]: sealed/trait.Context.html#associatedconstant.KNOWN_FEATURE_FLAGS
+ * Creates a Features with the bits set which are known by the implementation
  */
 MUST_USE_RES struct LDKInitFeatures InitFeatures_known(void);
 
@@ -10634,9 +10646,7 @@ MUST_USE_RES struct LDKInitFeatures InitFeatures_known(void);
 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_empty(void);
 
 /**
- * Creates features known by the implementation as defined by [`T::KNOWN_FEATURE_FLAGS`].
- *
- * [`T::KNOWN_FEATURE_FLAGS`]: sealed/trait.Context.html#associatedconstant.KNOWN_FEATURE_FLAGS
+ * Creates a Features with the bits set which are known by the implementation
  */
 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_known(void);
 
@@ -10646,9 +10656,7 @@ MUST_USE_RES struct LDKNodeFeatures NodeFeatures_known(void);
 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_empty(void);
 
 /**
- * Creates features known by the implementation as defined by [`T::KNOWN_FEATURE_FLAGS`].
- *
- * [`T::KNOWN_FEATURE_FLAGS`]: sealed/trait.Context.html#associatedconstant.KNOWN_FEATURE_FLAGS
+ * Creates a Features with the bits set which are known by the implementation
  */
 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_known(void);
 
@@ -10658,9 +10666,7 @@ MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_known(void);
 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_empty(void);
 
 /**
- * Creates features known by the implementation as defined by [`T::KNOWN_FEATURE_FLAGS`].
- *
- * [`T::KNOWN_FEATURE_FLAGS`]: sealed/trait.Context.html#associatedconstant.KNOWN_FEATURE_FLAGS
+ * Creates a Features with the bits set which are known by the implementation
  */
 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_known(void);