|
31 | 31 | //! use std::sync::Arc; |
32 | 32 | //! |
33 | 33 | //! // Define concrete types for our high-level objects: |
34 | | -//! type TxBroadcaster = dyn lightning::chain::chaininterface::BroadcasterInterface; |
35 | | -//! type FeeEstimator = dyn lightning::chain::chaininterface::FeeEstimator; |
36 | | -//! type Logger = dyn lightning::util::logger::Logger; |
37 | | -//! type ChainAccess = dyn lightning::chain::Access; |
38 | | -//! type ChainFilter = dyn lightning::chain::Filter; |
39 | | -//! type DataPersister = dyn lightning::chain::channelmonitor::Persist<lightning::chain::keysinterface::InMemorySigner>; |
| 34 | +//! type TxBroadcaster = dyn lightning::chain::chaininterface::BroadcasterInterface + Send + Sync; |
| 35 | +//! type FeeEstimator = dyn lightning::chain::chaininterface::FeeEstimator + Send + Sync; |
| 36 | +//! type Logger = dyn lightning::util::logger::Logger + Send + Sync; |
| 37 | +//! type ChainAccess = dyn lightning::chain::Access + Send + Sync; |
| 38 | +//! type ChainFilter = dyn lightning::chain::Filter + Send + Sync; |
| 39 | +//! type DataPersister = dyn lightning::chain::channelmonitor::Persist<lightning::chain::keysinterface::InMemorySigner> + Send + Sync; |
40 | 40 | //! type ChainMonitor = lightning::chain::chainmonitor::ChainMonitor<lightning::chain::keysinterface::InMemorySigner, Arc<ChainFilter>, Arc<TxBroadcaster>, Arc<FeeEstimator>, Arc<Logger>, Arc<DataPersister>>; |
41 | 41 | //! type ChannelManager = Arc<lightning::ln::channelmanager::SimpleArcChannelManager<ChainMonitor, TxBroadcaster, FeeEstimator, Logger>>; |
42 | 42 | //! type PeerManager = Arc<lightning::ln::peer_handler::SimpleArcPeerManager<lightning_net_tokio::SocketDescriptor, ChainMonitor, TxBroadcaster, FeeEstimator, ChainAccess, Logger>>; |
@@ -254,9 +254,9 @@ impl Connection { |
254 | 254 | /// |
255 | 255 | /// See the module-level documentation for how to handle the event_notify mpsc::Sender. |
256 | 256 | pub fn setup_inbound<CMH, RMH, L>(peer_manager: Arc<peer_handler::PeerManager<SocketDescriptor, Arc<CMH>, Arc<RMH>, Arc<L>>>, event_notify: mpsc::Sender<()>, stream: StdTcpStream) -> impl std::future::Future<Output=()> where |
257 | | - CMH: ChannelMessageHandler + 'static, |
258 | | - RMH: RoutingMessageHandler + 'static, |
259 | | - L: Logger + 'static + ?Sized { |
| 257 | + CMH: ChannelMessageHandler + 'static + Send + Sync, |
| 258 | + RMH: RoutingMessageHandler + 'static + Send + Sync, |
| 259 | + L: Logger + 'static + ?Sized + Send + Sync { |
260 | 260 | let (reader, write_receiver, read_receiver, us) = Connection::new(event_notify, stream); |
261 | 261 | #[cfg(debug_assertions)] |
262 | 262 | let last_us = Arc::clone(&us); |
@@ -296,9 +296,9 @@ pub fn setup_inbound<CMH, RMH, L>(peer_manager: Arc<peer_handler::PeerManager<So |
296 | 296 | /// |
297 | 297 | /// See the module-level documentation for how to handle the event_notify mpsc::Sender. |
298 | 298 | pub fn setup_outbound<CMH, RMH, L>(peer_manager: Arc<peer_handler::PeerManager<SocketDescriptor, Arc<CMH>, Arc<RMH>, Arc<L>>>, event_notify: mpsc::Sender<()>, their_node_id: PublicKey, stream: StdTcpStream) -> impl std::future::Future<Output=()> where |
299 | | - CMH: ChannelMessageHandler + 'static, |
300 | | - RMH: RoutingMessageHandler + 'static, |
301 | | - L: Logger + 'static + ?Sized { |
| 299 | + CMH: ChannelMessageHandler + 'static + Send + Sync, |
| 300 | + RMH: RoutingMessageHandler + 'static + Send + Sync, |
| 301 | + L: Logger + 'static + ?Sized + Send + Sync { |
302 | 302 | let (reader, mut write_receiver, read_receiver, us) = Connection::new(event_notify, stream); |
303 | 303 | #[cfg(debug_assertions)] |
304 | 304 | let last_us = Arc::clone(&us); |
@@ -368,9 +368,9 @@ pub fn setup_outbound<CMH, RMH, L>(peer_manager: Arc<peer_handler::PeerManager<S |
368 | 368 | /// |
369 | 369 | /// See the module-level documentation for how to handle the event_notify mpsc::Sender. |
370 | 370 | pub async fn connect_outbound<CMH, RMH, L>(peer_manager: Arc<peer_handler::PeerManager<SocketDescriptor, Arc<CMH>, Arc<RMH>, Arc<L>>>, event_notify: mpsc::Sender<()>, their_node_id: PublicKey, addr: SocketAddr) -> Option<impl std::future::Future<Output=()>> where |
371 | | - CMH: ChannelMessageHandler + 'static, |
372 | | - RMH: RoutingMessageHandler + 'static, |
373 | | - L: Logger + 'static + ?Sized { |
| 371 | + CMH: ChannelMessageHandler + 'static + Send + Sync, |
| 372 | + RMH: RoutingMessageHandler + 'static + Send + Sync, |
| 373 | + L: Logger + 'static + ?Sized + Send + Sync { |
374 | 374 | if let Ok(Ok(stream)) = time::timeout(Duration::from_secs(10), async { TcpStream::connect(&addr).await.map(|s| s.into_std().unwrap()) }).await { |
375 | 375 | Some(setup_outbound(peer_manager, event_notify, their_node_id, stream)) |
376 | 376 | } else { None } |
|
0 commit comments