Change ChannelManager::wait to be more descriptive
[rust-lightning] / lightning-c-bindings / include / lightning.h
index 01a252ee3969f959e0d8e2c5744c527b422e61fa..536d6a74cf7db1b5a3a88056db8a90eace2d1151 100644 (file)
@@ -7,7 +7,7 @@
 #include <stdarg.h>
 #include <stdbool.h>
 #include <stdint.h>
-#include <stdlib.h>
+
 
 /**
  * An error when accessing the chain via [`Access`].
@@ -174,8 +174,8 @@ typedef enum LDKSecp256k1Error {
    LDKSecp256k1Error_InvalidSecretKey,
    LDKSecp256k1Error_InvalidRecoveryId,
    LDKSecp256k1Error_InvalidTweak,
+   LDKSecp256k1Error_TweakCheckFailed,
    LDKSecp256k1Error_NotEnoughMemory,
-   LDKSecp256k1Error_CallbackPanicked,
    /**
     * Must be last for serialization purposes
     */
@@ -3451,6 +3451,25 @@ typedef struct LDKAccess {
    void (*free)(void *this_arg);
 } LDKAccess;
 
+/**
+ * The `Listen` trait is used to be notified of when blocks have been connected or disconnected
+ * from the chain.
+ *
+ * Useful when needing to replay chain data upon startup or as new chain events occur.
+ */
+typedef struct LDKListen {
+   void *this_arg;
+   /**
+    * Notifies the listener that a block was added at the given height.
+    */
+   void (*block_connected)(const void *this_arg, struct LDKu8slice block, uint32_t height);
+   /**
+    * Notifies the listener that a block was removed at the given height.
+    */
+   void (*block_disconnected)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
+   void (*free)(void *this_arg);
+} LDKListen;
+
 /**
  * The `Filter` trait defines behavior for indicating chain activity of interest pertaining to
  * channels.
@@ -3629,7 +3648,7 @@ typedef struct LDKChannelMessageHandler {
    /**
     * Handle an incoming shutdown message from the given peer.
     */
-   void (*handle_shutdown)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKShutdown *NONNULL_PTR msg);
+   void (*handle_shutdown)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInitFeatures *NONNULL_PTR their_features, const struct LDKShutdown *NONNULL_PTR msg);
    /**
     * Handle an incoming closing_signed message from the given peer.
     */
@@ -4150,6 +4169,8 @@ struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_err(st
 
 void CResult_ChannelInfoDecodeErrorZ_free(struct LDKCResult_ChannelInfoDecodeErrorZ _res);
 
+struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR orig);
+
 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o);
 
 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e);
@@ -4184,6 +4205,8 @@ struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(
 
 void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res);
 
+struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_clone(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR orig);
+
 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b);
 
 void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res);
@@ -5113,6 +5136,11 @@ enum LDKAccessError AccessError_clone(const enum LDKAccessError *NONNULL_PTR ori
  */
 void Access_free(struct LDKAccess this_ptr);
 
+/**
+ * Calls the free function if one is set
+ */
+void Listen_free(struct LDKListen this_ptr);
+
 /**
  * Calls the free function if one is set
  */
@@ -5663,8 +5691,8 @@ void KeysManager_free(struct LDKKeysManager this_ptr);
 MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos);
 
 /**
- * Derive an old set of Sign for per-channel secrets based on a key derivation
- * parameters.
+ * Derive an old Sign containing per-channel secrets based on a key derivation parameters.
+ *
  * Key derivation parameters are accessible through a per-channel secrets
  * Sign::channel_keys_id and is provided inside DynamicOuputP2WSH in case of
  * onchain output detection for which a corresponding delayed_payment_key must be derived.
@@ -6025,6 +6053,8 @@ struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(
 
 struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
 
+struct LDKListen ChannelManager_as_Listen(const struct LDKChannelManager *NONNULL_PTR this_arg);
+
 /**
  * Updates channel state based on transactions seen in a connected block.
  */
@@ -6042,7 +6072,7 @@ void ChannelManager_block_disconnected(const struct LDKChannelManager *NONNULL_P
  * Blocks until ChannelManager needs to be persisted. Only one listener on `wait` is
  * guaranteed to be woken up.
  */
-void ChannelManager_wait(const struct LDKChannelManager *NONNULL_PTR this_arg);
+void ChannelManager_await_persistable_update(const struct LDKChannelManager *NONNULL_PTR this_arg);
 
 struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg);
 
@@ -6149,6 +6179,18 @@ struct LDKDecodeError DecodeError_clone(const struct LDKDecodeError *NONNULL_PTR
 
 void Init_free(struct LDKInit this_ptr);
 
+/**
+ * The relevant features which the sender supports
+ */
+struct LDKInitFeatures Init_get_features(const struct LDKInit *NONNULL_PTR this_ptr);
+
+/**
+ * The relevant features which the sender supports
+ */
+void Init_set_features(struct LDKInit *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
+
+MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg);
+
 struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig);
 
 void ErrorMessage_free(struct LDKErrorMessage this_ptr);
@@ -8772,6 +8814,8 @@ struct LDKCResult_RouteLightningErrorZ get_route(struct LDKPublicKey our_node_id
 
 void NetworkGraph_free(struct LDKNetworkGraph this_ptr);
 
+struct LDKNetworkGraph NetworkGraph_clone(const struct LDKNetworkGraph *NONNULL_PTR orig);
+
 void LockedNetworkGraph_free(struct LDKLockedNetworkGraph this_ptr);
 
 void NetGraphMsgHandler_free(struct LDKNetGraphMsgHandler this_ptr);
@@ -8952,6 +8996,8 @@ struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct
  */
 void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val);
 
+struct LDKChannelInfo ChannelInfo_clone(const struct LDKChannelInfo *NONNULL_PTR orig);
+
 struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj);
 
 struct LDKCResult_ChannelInfoDecodeErrorZ ChannelInfo_read(struct LDKu8slice ser);