|
1 | 1 | //! Provides utilities for syncing LDK via the transaction-based [`Confirm`] interface.
|
2 | 2 | //!
|
| 3 | +//! The provided synchronization clients need to be registered with a [`ChainMonitor`] via the |
| 4 | +//! [`Filter`] interface. Then, the respective `fn sync` needs to be called with the [`Confirm`] |
| 5 | +//! implementations to be synchronized, i.e., usually instances of [`ChannelManager`] and |
| 6 | +//! [`ChainMonitor`]. |
| 7 | +//! |
| 8 | +//! ## Features and Backend Support |
| 9 | +//! |
| 10 | +//!- `esplora_blocking` enables syncing against an Esplora backend based on a blocking. |
| 11 | +//!- `esplora_async` enables syncing against an Esplora backend based on an async client. |
| 12 | +//! |
| 13 | +//! ## Usage Example: |
| 14 | +//! |
| 15 | +//! ```ignore |
| 16 | +//! let tx_sync = Arc::new(EsploraSyncClient::new( |
| 17 | +//! esplora_server_url, |
| 18 | +//! Arc::clone(&some_logger), |
| 19 | +//! )); |
| 20 | +//! |
| 21 | +//! let chain_monitor = Arc::new(ChainMonitor::new( |
| 22 | +//! Some(Arc::clone(&tx_sync)), |
| 23 | +//! Arc::clone(&some_broadcaster), |
| 24 | +//! Arc::clone(&some_logger), |
| 25 | +//! Arc::clone(&some_fee_estimator), |
| 26 | +//! Arc::clone(&some_persister), |
| 27 | +//! )); |
| 28 | +//! |
| 29 | +//! let channel_manager = Arc::new(ChannelManager::new( |
| 30 | +//! Arc::clone(&some_fee_estimator), |
| 31 | +//! Arc::clone(&chain_monitor), |
| 32 | +//! Arc::clone(&some_broadcaster), |
| 33 | +//! Arc::clone(&some_router), |
| 34 | +//! Arc::clone(&some_logger), |
| 35 | +//! Arc::clone(&some_entropy_source), |
| 36 | +//! Arc::clone(&some_node_signer), |
| 37 | +//! Arc::clone(&some_signer_provider), |
| 38 | +//! user_config, |
| 39 | +//! chain_params, |
| 40 | +//! )); |
| 41 | +//! |
| 42 | +//! let confirmables = vec![ |
| 43 | +//! &*channel_manager as &(dyn Confirm + Sync + Send), |
| 44 | +//! &*chain_monitor as &(dyn Confirm + Sync + Send), |
| 45 | +//! ]; |
| 46 | +//! |
| 47 | +//! tx_sync.sync(confirmables).unwrap(); |
| 48 | +//! ``` |
| 49 | +//! |
3 | 50 | //! [`Confirm`]: lightning::chain::Confirm
|
| 51 | +//! [`Filter`]: lightning::chain::Filter |
| 52 | +//! [`ChainMonitor`]: lightning::chain::chainmonitor::ChainMonitor |
| 53 | +//! [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager |
4 | 54 |
|
5 | 55 | // Prefix these with `rustdoc::` when we update our MSRV to be >= 1.52 to remove warnings.
|
6 | 56 | #![deny(broken_intra_doc_links)]
|
|
0 commit comments