1 //! Provides utilities for syncing LDK via the transaction-based [`Confirm`] interface.
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
8 //! ## Features and Backend Support
10 //!- `esplora_blocking` enables syncing against an Esplora backend based on a blocking client.
11 //!- `esplora_async` enables syncing against an Esplora backend based on an async client.
13 //! ## Version Compatibility
15 //! Currently this crate is compatible with nodes that were created with LDK version 0.0.113 and above.
20 //! let tx_sync = Arc::new(EsploraSyncClient::new(
21 //! esplora_server_url,
22 //! Arc::clone(&some_logger),
25 //! let chain_monitor = Arc::new(ChainMonitor::new(
26 //! Some(Arc::clone(&tx_sync)),
27 //! Arc::clone(&some_broadcaster),
28 //! Arc::clone(&some_logger),
29 //! Arc::clone(&some_fee_estimator),
30 //! Arc::clone(&some_persister),
33 //! let channel_manager = Arc::new(ChannelManager::new(
34 //! Arc::clone(&some_fee_estimator),
35 //! Arc::clone(&chain_monitor),
36 //! Arc::clone(&some_broadcaster),
37 //! Arc::clone(&some_router),
38 //! Arc::clone(&some_logger),
39 //! Arc::clone(&some_entropy_source),
40 //! Arc::clone(&some_node_signer),
41 //! Arc::clone(&some_signer_provider),
46 //! let confirmables = vec![
47 //! &*channel_manager as &(dyn Confirm + Sync + Send),
48 //! &*chain_monitor as &(dyn Confirm + Sync + Send),
51 //! tx_sync.sync(confirmables).unwrap();
54 //! [`Confirm`]: lightning::chain::Confirm
55 //! [`Filter`]: lightning::chain::Filter
56 //! [`ChainMonitor`]: lightning::chain::chainmonitor::ChainMonitor
57 //! [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
59 // Prefix these with `rustdoc::` when we update our MSRV to be >= 1.52 to remove warnings.
60 #![deny(broken_intra_doc_links)]
61 #![deny(private_intra_doc_links)]
63 #![deny(missing_docs)]
66 #![cfg_attr(docsrs, feature(doc_auto_cfg))]
68 #[cfg(any(feature = "esplora-blocking", feature = "esplora-async"))]
70 extern crate bdk_macros;
72 #[cfg(any(feature = "esplora-blocking", feature = "esplora-async"))]
75 #[cfg(any(feature = "esplora-blocking", feature = "esplora-async"))]
79 pub use error::TxSyncError;
81 #[cfg(any(feature = "esplora-blocking", feature = "esplora-async"))]
82 pub use esplora::EsploraSyncClient;