1 // This file is Copyright its original authors, visible in version control
2 // history and in the source files from which this was generated.
4 // This file is licensed under the license available in the LICENSE or LICENSE.md
5 // file in the root of this repository or, if no such file exists, the same
6 // license as that which applies to the original source files from which this
7 // source was automatically generated.
9 //! Provides utilities for syncing LDK via the transaction-based [`Confirm`] interface.
11 //! The provided synchronization clients need to be registered with a [`ChainMonitor`] via the
12 //! [`Filter`] interface. Then, the respective `fn sync` needs to be called with the [`Confirm`]
13 //! implementations to be synchronized, i.e., usually instances of [`ChannelManager`] and
16 //! ## Features and Backend Support
18 //!- `esplora-blocking` enables syncing against an Esplora backend based on a blocking client.
19 //!- `esplora-async` enables syncing against an Esplora backend based on an async client.
20 //!- `esplora-async-https` enables the async Esplora client with support for HTTPS.
22 //! ## Version Compatibility
24 //! Currently this crate is compatible with LDK version 0.0.114 and above using channels which were
25 //! created on LDK version 0.0.113 and above.
30 //! let tx_sync = Arc::new(EsploraSyncClient::new(
31 //! \tesplora_server_url,
32 //! \tArc::clone(&some_logger),
35 //! let chain_monitor = Arc::new(ChainMonitor::new(
36 //! \tSome(Arc::clone(&tx_sync)),
37 //! \tArc::clone(&some_broadcaster),
38 //! \tArc::clone(&some_logger),
39 //! \tArc::clone(&some_fee_estimator),
40 //! \tArc::clone(&some_persister),
43 //! let channel_manager = Arc::new(ChannelManager::new(
44 //! \tArc::clone(&some_fee_estimator),
45 //! \tArc::clone(&chain_monitor),
46 //! \tArc::clone(&some_broadcaster),
47 //! \tArc::clone(&some_router),
48 //! \tArc::clone(&some_logger),
49 //! \tArc::clone(&some_entropy_source),
50 //! \tArc::clone(&some_node_signer),
51 //! \tArc::clone(&some_signer_provider),
56 //! let confirmables = vec![
57 //! \t&*channel_manager as &(dyn Confirm + Sync + Send),
58 //! \t&*chain_monitor as &(dyn Confirm + Sync + Send),
61 //! tx_sync.sync(confirmables).unwrap();
64 //! [`Confirm`]: lightning::chain::Confirm
65 //! [`Filter`]: lightning::chain::Filter
66 //! [`ChainMonitor`]: lightning::chain::chainmonitor::ChainMonitor
67 //! [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
69 use alloc::str::FromStr;
70 use alloc::string::String;
71 use core::ffi::c_void;
72 use core::convert::Infallible;
73 use bitcoin::hashes::Hash;
74 use crate::c_types::*;
75 #[cfg(feature="no-std")]
76 use alloc::{vec::Vec, boxed::Box};
83 use alloc::str::FromStr;
84 use alloc::string::String;
85 use core::ffi::c_void;
86 use core::convert::Infallible;
87 use bitcoin::hashes::Hash;
88 use crate::c_types::*;
89 #[cfg(feature="no-std")]
90 use alloc::{vec::Vec, boxed::Box};