/**
* An error when accessing the chain via [`Access`].
- *
- * [`Access`]: trait.Access.html
*/
typedef enum LDKAccessError {
/**
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).
* 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
*/
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 {
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;
* 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 {
/**
* 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 {
/**
* 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);
/**
* 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);
/**
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;
*
* 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
*/
* 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);
/**
* 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);
/**
* 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 {
/**
* 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.
*/
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);
* 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);
* 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);
* 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);
* 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);
* 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);
* 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);
* 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);
/**
* 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);
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);
*/
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
*/
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);
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);
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);
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);
+// 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.
+
//! Traits and utility impls which allow other parts of rust-lightning to interact with the
//! blockchain.
//!
+// 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.
+
//! Logic to connect off-chain channel management with on-chain transaction monitoring.
//!
//! [`ChainMonitor`] is an implementation of [`chain::Watch`] used both to process blocks and to
//! update [`ChannelMonitor`]s accordingly. If any on-chain events need further processing, it will
//! make those available as [`MonitorEvent`]s to be consumed.
//!
-//! `ChainMonitor` is parameterized by an optional chain source, which must implement the
+//! [`ChainMonitor`] is parameterized by an optional chain source, which must implement the
//! [`chain::Filter`] trait. This provides a mechanism to signal new relevant outputs back to light
//! clients, such that transactions spending those outputs are included in block data.
//!
-//! `ChainMonitor` may be used directly to monitor channels locally or as a part of a distributed
-//! setup to monitor channels remotely. In the latter case, a custom `chain::Watch` implementation
+//! [`ChainMonitor`] may be used directly to monitor channels locally or as a part of a distributed
+//! setup to monitor channels remotely. In the latter case, a custom [`chain::Watch`] implementation
//! would be responsible for routing each update to a remote server and for retrieving monitor
-//! events. The remote server would make use of `ChainMonitor` for block processing and for
-//! servicing `ChannelMonitor` updates from the client.
-//!
-//! [`ChainMonitor`]: struct.ChainMonitor.html
-//! [`chain::Filter`]: ../trait.Filter.html
-//! [`chain::Watch`]: ../trait.Watch.html
-//! [`ChannelMonitor`]: ../channelmonitor/struct.ChannelMonitor.html
-//! [`MonitorEvent`]: ../channelmonitor/enum.MonitorEvent.html
+//! events. The remote server would make use of [`ChainMonitor`] for block processing and for
+//! servicing [`ChannelMonitor`] updates from the client.
use std::ffi::c_void;
use bitcoin::hashes::Hash;
/// 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
#[must_use]
#[repr(C)]
pub struct ChainMonitor {
/// 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
#[no_mangle]
pub extern "C" fn ChainMonitor_block_connected(this_arg: &ChainMonitor, header: *const [u8; 80], mut txdata: crate::c_types::derived::CVec_C2Tuple_usizeTransactionZZ, mut height: u32) {
let mut local_txdata = Vec::new(); for mut item in txdata.into_rust().drain(..) { local_txdata.push( { let (mut orig_txdata_0_0, mut orig_txdata_0_1) = item.to_rust(); let mut local_txdata_0 = (orig_txdata_0_0, orig_txdata_0_1.into_bitcoin()); local_txdata_0 }); };
/// 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
#[no_mangle]
pub extern "C" fn ChainMonitor_block_disconnected(this_arg: &ChainMonitor, header: *const [u8; 80], mut disconnected_height: u32) {
unsafe { &*this_arg.inner }.block_disconnected(&::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), disconnected_height)
/// 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]
#[no_mangle]
pub extern "C" fn ChainMonitor_new(chain_source: *mut crate::chain::Filter, mut broadcaster: crate::chain::chaininterface::BroadcasterInterface, mut logger: crate::util::logger::Logger, mut feeest: crate::chain::chaininterface::FeeEstimator, mut persister: crate::chain::channelmonitor::Persist) -> ChainMonitor {
+// 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.
+
//! The logic to monitor for on-chain transactions and create the relevant claim responses lives
//! here.
//!
//! ChannelMonitors should do so). Thus, if you're building rust-lightning into an HSM or other
//! security-domain-separated system design, you should consider having multiple paths for
//! ChannelMonitors to get out of the HSM and onto monitoring devices.
-//!
-//! [`chain::Watch`]: ../trait.Watch.html
use std::ffi::c_void;
use bitcoin::hashes::Hash;
/// 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
#[no_mangle]
pub extern "C" fn ChannelMonitorUpdate_get_update_id(this_ptr: &ChannelMonitorUpdate) -> u64 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.update_id;
/// 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
#[no_mangle]
pub extern "C" fn ChannelMonitorUpdate_set_update_id(this_ptr: &mut ChannelMonitorUpdate, mut val: u64) {
unsafe { &mut *this_ptr.inner }.update_id = val;
/// 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
#[must_use]
#[repr(C)]
pub struct HTLCUpdate {
/// 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]
#[no_mangle]
pub extern "C" fn ChannelMonitor_get_and_clear_pending_monitor_events(this_arg: &ChannelMonitor) -> crate::c_types::derived::CVec_MonitorEventZ {
/// 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
#[must_use]
pub persist_new_channel: extern "C" fn (this_arg: *const c_void, id: crate::chain::transaction::OutPoint, data: &crate::chain::channelmonitor::ChannelMonitor) -> crate::c_types::derived::CResult_NoneChannelMonitorUpdateErrZ,
/// Update one channel's data. The provided `ChannelMonitor` has already
/// 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
#[must_use]
pub update_persisted_channel: extern "C" fn (this_arg: *const c_void, id: crate::chain::transaction::OutPoint, update: &crate::chain::channelmonitor::ChannelMonitorUpdate, data: &crate::chain::channelmonitor::ChannelMonitor) -> crate::c_types::derived::CResult_NoneChannelMonitorUpdateErrZ,
/// Frees any resources associated with this object given its this_arg pointer.
+// 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.
+
//! keysinterface provides keys into rust-lightning and defines some useful enums which describe
//! spendable on-chain outputs which the user owns and is responsible for using just as any other
//! on-chain output which is theirs.
+// 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.
+
//! Structs and traits which allow other parts of rust-lightning to interact with the blockchain.
use std::ffi::c_void;
pub mod transaction;
pub mod keysinterface;
/// An error when accessing the chain via [`Access`].
-///
-/// [`Access`]: trait.Access.html
#[must_use]
#[derive(Clone)]
#[repr(C)]
/// 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
#[repr(C)]
pub struct Watch {
/// An opaque pointer which is passed to your function implementations as an argument.
/// 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
#[must_use]
pub watch_channel: extern "C" fn (this_arg: *const c_void, funding_txo: crate::chain::transaction::OutPoint, monitor: crate::chain::channelmonitor::ChannelMonitor) -> crate::c_types::derived::CResult_NoneChannelMonitorUpdateErrZ,
/// Updates a channel identified by `funding_txo` by applying `update` to its monitor.
/// Implementations must call [`update_monitor`] with the given update. See
/// [`ChannelMonitorUpdateErr`] for invariants around returning an error.
///
- /// [`update_monitor`]: channelmonitor/struct.ChannelMonitor.html#method.update_monitor
- /// [`ChannelMonitorUpdateErr`]: channelmonitor/enum.ChannelMonitorUpdateErr.html
+ /// [`update_monitor`]: channelmonitor::ChannelMonitor::update_monitor
+ /// [`ChannelMonitorUpdateErr`]: channelmonitor::ChannelMonitorUpdateErr
#[must_use]
pub update_channel: extern "C" fn (this_arg: *const c_void, funding_txo: crate::chain::transaction::OutPoint, update: crate::chain::channelmonitor::ChannelMonitorUpdate) -> crate::c_types::derived::CResult_NoneChannelMonitorUpdateErrZ,
/// Returns any monitor events since the last call. Subsequent calls must only return new
///
/// 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
#[repr(C)]
+// 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.
+
//! Types describing on-chain transactions.
use std::ffi::c_void;
+// 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.
+
//!lightning
//! Rust-Lightning, not Rusty's Lightning!
//!
+// 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.
+
//! Various utilities for building scripts and deriving keys related to channels. These are
//! largely of interest for those implementing chain::keysinterface::Sign message signing by hand.
+// 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.
+
//! The top-level channel management and payment tracking stuff lives here.
//!
//! The ChannelManager is the main chunk of logic implementing the lightning protocol and is
latest_height: latest_height_arg,
})), is_owned: true }
}
+/// The amount of time in blocks we require our counterparty wait to claim their money (ie time
+/// between when we, or our watchtower, must check for them having broadcast a theft transaction).
+///
+/// This can be increased (but not decreased) through [`ChannelHandshakeConfig::our_to_self_delay`]
+///
+/// [`ChannelHandshakeConfig::our_to_self_delay`]: crate::util::config::ChannelHandshakeConfig::our_to_self_delay
+
+#[no_mangle]
+pub static BREAKDOWN_TIMEOUT: u16 = lightning::ln::channelmanager::BREAKDOWN_TIMEOUT;
use lightning::ln::channelmanager::ChannelDetails as nativeChannelDetailsImport;
type nativeChannelDetails = nativeChannelDetailsImport;
peer_disconnected: ChannelManager_ChannelMessageHandler_peer_disconnected,
peer_connected: ChannelManager_ChannelMessageHandler_peer_connected,
handle_channel_reestablish: ChannelManager_ChannelMessageHandler_handle_channel_reestablish,
+ handle_channel_update: ChannelManager_ChannelMessageHandler_handle_channel_update,
handle_error: ChannelManager_ChannelMessageHandler_handle_error,
MessageSendEventsProvider: crate::util::events::MessageSendEventsProvider {
this_arg: unsafe { (*this_arg).inner as *mut c_void },
extern "C" fn ChannelManager_ChannelMessageHandler_handle_announcement_signatures(this_arg: *const c_void, mut counterparty_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::AnnouncementSignatures) {
<nativeChannelManager as lightning::ln::msgs::ChannelMessageHandler<>>::handle_announcement_signatures(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &counterparty_node_id.into_rust(), unsafe { &*msg.inner })
}
+extern "C" fn ChannelManager_ChannelMessageHandler_handle_channel_update(this_arg: *const c_void, mut counterparty_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::ChannelUpdate) {
+ <nativeChannelManager as lightning::ln::msgs::ChannelMessageHandler<>>::handle_channel_update(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &counterparty_node_id.into_rust(), unsafe { &*msg.inner })
+}
extern "C" fn ChannelManager_ChannelMessageHandler_handle_channel_reestablish(this_arg: *const c_void, mut counterparty_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::ChannelReestablish) {
<nativeChannelManager as lightning::ln::msgs::ChannelMessageHandler<>>::handle_channel_reestablish(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &counterparty_node_id.into_rust(), unsafe { &*msg.inner })
}
+// 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.
+
//! Feature flag definitions for the Lightning protocol according to [BOLT #9].
//!
//! Lightning nodes advertise a supported set of operation through feature flags. Features are
//! applicable for a specific context as indicated in some [messages]. [`Features`] encapsulates
//! behavior for specifying and checking feature flags for a particular context. Each feature is
-//! defined internally by a trait specifying the corresponding flags (i.e., even and odd bits). A
-//! [`Context`] is used to parameterize [`Features`] and defines which features it can support.
+//! defined internally by a trait specifying the corresponding flags (i.e., even and odd bits).
//!
//! Whether a feature is considered \"known\" or \"unknown\" is relative to the implementation, whereas
//! the term \"supports\" is used in reference to a particular set of [`Features`]. That is, a node
//! And the implementation can interpret a feature if the feature is known to it.
//!
//! [BOLT #9]: https://github.com/lightningnetwork/lightning-rfc/blob/master/09-features.md
-//! [messages]: ../msgs/index.html
-//! [`Features`]: struct.Features.html
-//! [`Context`]: sealed/trait.Context.html
+//! [messages]: crate::ln::msgs
use std::ffi::c_void;
use bitcoin::hashes::Hash;
InitFeatures { inner: Box::into_raw(Box::new(ret)), is_owned: true }
}
-/// 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]
#[no_mangle]
pub extern "C" fn InitFeatures_known() -> InitFeatures {
NodeFeatures { inner: Box::into_raw(Box::new(ret)), is_owned: true }
}
-/// 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]
#[no_mangle]
pub extern "C" fn NodeFeatures_known() -> NodeFeatures {
ChannelFeatures { inner: Box::into_raw(Box::new(ret)), is_owned: true }
}
-/// 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]
#[no_mangle]
pub extern "C" fn ChannelFeatures_known() -> ChannelFeatures {
InvoiceFeatures { inner: Box::into_raw(Box::new(ret)), is_owned: true }
}
-/// 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]
#[no_mangle]
pub extern "C" fn InvoiceFeatures_known() -> InvoiceFeatures {
+// 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.
+
//! High level lightning structs and impls live here.
//!
//! You probably want to create a channelmanager::ChannelManager, and a routing::NetGraphMsgHandler first.
+// 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.
+
//! Wire messages, traits representing wire message handlers, and a few error types live here.
//!
//! For a normal node you probably don't need to use anything here, however, if you wish to split a
pub extern "C" fn UnsignedChannelUpdate_set_flags(this_ptr: &mut UnsignedChannelUpdate, mut val: u8) {
unsafe { &mut *this_ptr.inner }.flags = 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.
#[no_mangle]
pub extern "C" fn UnsignedChannelUpdate_get_cltv_expiry_delta(this_ptr: &UnsignedChannelUpdate) -> u16 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.cltv_expiry_delta;
(*inner_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.
#[no_mangle]
pub extern "C" fn UnsignedChannelUpdate_set_cltv_expiry_delta(this_ptr: &mut UnsignedChannelUpdate, mut val: u16) {
unsafe { &mut *this_ptr.inner }.cltv_expiry_delta = val;
pub peer_connected: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::Init),
/// Handle an incoming channel_reestablish message from the given peer.
pub handle_channel_reestablish: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::ChannelReestablish),
+ /// Handle an incoming channel update from the given peer.
+ pub handle_channel_update: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::ChannelUpdate),
/// Handle an incoming error message from the given peer.
pub handle_error: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::ErrorMessage),
/// Implementation of MessageSendEventsProvider for this object.
fn handle_channel_reestablish(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::ChannelReestablish) {
(self.handle_channel_reestablish)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::ln::msgs::ChannelReestablish { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
}
+ fn handle_channel_update(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::ChannelUpdate) {
+ (self.handle_channel_update)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::ln::msgs::ChannelUpdate { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
+ }
fn handle_error(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::ErrorMessage) {
(self.handle_error)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::ln::msgs::ErrorMessage { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
}
pub(crate) extern "C" fn ReplyShortChannelIdsEnd_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeReplyShortChannelIdsEnd) })
}
+///\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]
+#[no_mangle]
+pub extern "C" fn QueryChannelRange_end_blocknum(this_arg: &QueryChannelRange) -> u32 {
+ let mut ret = unsafe { &*this_arg.inner }.end_blocknum();
+ ret
+}
+
#[no_mangle]
/// Read a QueryChannelRange from a byte array, created by QueryChannelRange_write
pub extern "C" fn QueryChannelRange_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_QueryChannelRangeDecodeErrorZ {
+// 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.
+
//! Top level peer message handling and socket handling logic lives here.
//!
//! Instead of actually servicing sockets ourselves we require that you implement the
peer_disconnected: ErroringMessageHandler_ChannelMessageHandler_peer_disconnected,
peer_connected: ErroringMessageHandler_ChannelMessageHandler_peer_connected,
handle_channel_reestablish: ErroringMessageHandler_ChannelMessageHandler_handle_channel_reestablish,
+ handle_channel_update: ErroringMessageHandler_ChannelMessageHandler_handle_channel_update,
handle_error: ErroringMessageHandler_ChannelMessageHandler_handle_error,
MessageSendEventsProvider: crate::util::events::MessageSendEventsProvider {
this_arg: unsafe { (*this_arg).inner as *mut c_void },
extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_channel_reestablish(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::ChannelReestablish) {
<nativeErroringMessageHandler as lightning::ln::msgs::ChannelMessageHandler<>>::handle_channel_reestablish(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), unsafe { &*msg.inner })
}
+extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_channel_update(this_arg: *const c_void, mut _their_node_id: crate::c_types::PublicKey, _msg: &crate::ln::msgs::ChannelUpdate) {
+ <nativeErroringMessageHandler as lightning::ln::msgs::ChannelMessageHandler<>>::handle_channel_update(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &_their_node_id.into_rust(), unsafe { &*_msg.inner })
+}
extern "C" fn ErroringMessageHandler_ChannelMessageHandler_peer_disconnected(this_arg: *const c_void, mut _their_node_id: crate::c_types::PublicKey, mut _no_connection_possible: bool) {
<nativeErroringMessageHandler as lightning::ln::msgs::ChannelMessageHandler<>>::peer_disconnected(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &_their_node_id.into_rust(), _no_connection_possible)
}
+// 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.
+
//! Structs and impls for receiving messages about the network and storing the topology live here.
use std::ffi::c_void;
+// 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.
+
//! The top-level network map tracking logic lives here.
use std::ffi::c_void;
local_ret
}
#[must_use]
-extern "C" fn NetGraphMsgHandler_RoutingMessageHandler_handle_query_channel_range(this_arg: *const c_void, mut _their_node_id: crate::c_types::PublicKey, mut _msg: crate::ln::msgs::QueryChannelRange) -> crate::c_types::derived::CResult_NoneLightningErrorZ {
- let mut ret = <nativeNetGraphMsgHandler as lightning::ln::msgs::RoutingMessageHandler<>>::handle_query_channel_range(unsafe { &mut *(this_arg as *mut nativeNetGraphMsgHandler) }, &_their_node_id.into_rust(), *unsafe { Box::from_raw(_msg.take_inner()) });
+extern "C" fn NetGraphMsgHandler_RoutingMessageHandler_handle_query_channel_range(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, mut msg: crate::ln::msgs::QueryChannelRange) -> crate::c_types::derived::CResult_NoneLightningErrorZ {
+ let mut ret = <nativeNetGraphMsgHandler as lightning::ln::msgs::RoutingMessageHandler<>>::handle_query_channel_range(unsafe { &mut *(this_arg as *mut nativeNetGraphMsgHandler) }, &their_node_id.into_rust(), *unsafe { Box::from_raw(msg.take_inner()) });
let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { 0u8 /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::LightningError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
local_ret
}
+// 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.
+
//! The top-level routing/network map tracking logic lives here.
//!
//! You probably want to create a NetGraphMsgHandler and use that as your RoutingMessageHandler and then
+// 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.
+
//! Various user-configurable channel limits and settings which ChannelManager
//! applies for you.
/// 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.
#[no_mangle]
pub extern "C" fn ChannelHandshakeConfig_get_our_to_self_delay(this_ptr: &ChannelHandshakeConfig) -> u16 {
/// 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.
#[no_mangle]
pub extern "C" fn ChannelHandshakeConfig_set_our_to_self_delay(this_ptr: &mut ChannelHandshakeConfig, mut val: u16) {
+// 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.
+
//! Error types live here.
use std::ffi::c_void;
+// 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.
+
//! Events are returned from various bits in the library which indicate some action must be taken
//! by the client.
//!
/// The query_short_channel_ids which should be sent.
msg: crate::ln::msgs::QueryShortChannelIds,
},
+ /// Sends a reply to a channel range query. This may be one of several SendReplyChannelRange events
+ /// emitted during processing of the query.
+ SendReplyChannelRange {
+ /// The node_id of this message recipient
+ node_id: crate::c_types::PublicKey,
+ /// The reply_channel_range which should be sent.
+ msg: crate::ln::msgs::ReplyChannelRange,
+ },
}
use lightning::util::events::MessageSendEvent as nativeMessageSendEvent;
impl MessageSendEvent {
msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) },
}
},
+ MessageSendEvent::SendReplyChannelRange {ref node_id, ref msg, } => {
+ let mut node_id_nonref = (*node_id).clone();
+ let mut msg_nonref = (*msg).clone();
+ nativeMessageSendEvent::SendReplyChannelRange {
+ node_id: node_id_nonref.into_rust(),
+ msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) },
+ }
+ },
}
}
#[allow(unused)]
msg: *unsafe { Box::from_raw(msg.take_inner()) },
}
},
+ MessageSendEvent::SendReplyChannelRange {mut node_id, mut msg, } => {
+ nativeMessageSendEvent::SendReplyChannelRange {
+ node_id: node_id.into_rust(),
+ msg: *unsafe { Box::from_raw(msg.take_inner()) },
+ }
+ },
}
}
#[allow(unused)]
msg: crate::ln::msgs::QueryShortChannelIds { inner: Box::into_raw(Box::new(msg_nonref)), is_owned: true },
}
},
+ nativeMessageSendEvent::SendReplyChannelRange {ref node_id, ref msg, } => {
+ let mut node_id_nonref = (*node_id).clone();
+ let mut msg_nonref = (*msg).clone();
+ MessageSendEvent::SendReplyChannelRange {
+ node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref),
+ msg: crate::ln::msgs::ReplyChannelRange { inner: Box::into_raw(Box::new(msg_nonref)), is_owned: true },
+ }
+ },
}
}
#[allow(unused)]
msg: crate::ln::msgs::QueryShortChannelIds { inner: Box::into_raw(Box::new(msg)), is_owned: true },
}
},
+ nativeMessageSendEvent::SendReplyChannelRange {mut node_id, mut msg, } => {
+ MessageSendEvent::SendReplyChannelRange {
+ node_id: crate::c_types::PublicKey::from_rust(&node_id),
+ msg: crate::ln::msgs::ReplyChannelRange { inner: Box::into_raw(Box::new(msg)), is_owned: true },
+ }
+ },
}
}
}
+// 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.
+
//! Log traits live here, which are called throughout the library to provide useful information for
//! debugging purposes.
//!
+// 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.
+
//! Some utility modules live here. See individual sub-modules for more info.
use std::ffi::c_void;
+// 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 very simple serialization framework which is used to serialize/deserialize messages as well
//! as ChannelsManagers and ChannelMonitors.