Loosen background-persister so bindings are happy

This commit is contained in:
Matt Corallo 2021-04-13 16:04:17 -04:00
parent feeb89305a
commit f223d2a72e

View file

@ -20,6 +20,7 @@ use std::sync::atomic::{AtomicBool, Ordering};
use std::thread; use std::thread;
use std::thread::JoinHandle; use std::thread::JoinHandle;
use std::time::{Duration, Instant}; use std::time::{Duration, Instant};
use std::ops::Deref;
/// BackgroundProcessor takes care of tasks that (1) need to happen periodically to keep /// BackgroundProcessor takes care of tasks that (1) need to happen periodically to keep
/// Rust-Lightning running properly, and (2) either can or should be run in the background. Its /// Rust-Lightning running properly, and (2) either can or should be run in the background. Its
@ -66,25 +67,29 @@ impl BackgroundProcessor {
/// [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager /// [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
/// [`ChannelManager::write`]: lightning::ln::channelmanager::ChannelManager#impl-Writeable /// [`ChannelManager::write`]: lightning::ln::channelmanager::ChannelManager#impl-Writeable
/// [`FilesystemPersister::persist_manager`]: lightning_persister::FilesystemPersister::persist_manager /// [`FilesystemPersister::persist_manager`]: lightning_persister::FilesystemPersister::persist_manager
pub fn start<PM, Signer, M, T, K, F, L, Descriptor: 'static + SocketDescriptor + Send, CM, RM>( pub fn start<
persist_channel_manager: PM, PM, Signer,
channel_manager: Arc<ChannelManager<Signer, Arc<M>, Arc<T>, Arc<K>, Arc<F>, Arc<L>>>, M: 'static + Deref + Send + Sync,
peer_manager: Arc<PeerManager<Descriptor, Arc<CM>, Arc<RM>, Arc<L>>>, logger: Arc<L>, T: 'static + Deref + Send + Sync,
) -> Self K: 'static + Deref + Send + Sync,
where F: 'static + Deref + Send + Sync,
L: 'static + Deref + Send + Sync,
Descriptor: 'static + SocketDescriptor + Send + Sync,
CM: 'static + Deref + Send + Sync,
RM: 'static + Deref + Send + Sync
>(
persist_channel_manager: PM, channel_manager: Arc<ChannelManager<Signer, M, T, K, F, L>>,
peer_manager: Arc<PeerManager<Descriptor, CM, RM, L>>, logger: L,
) -> Self where
Signer: 'static + Sign, Signer: 'static + Sign,
M: 'static + chain::Watch<Signer>, M::Target: 'static + chain::Watch<Signer>,
T: 'static + BroadcasterInterface, T::Target: 'static + BroadcasterInterface,
K: 'static + KeysInterface<Signer = Signer>, K::Target: 'static + KeysInterface<Signer = Signer>,
F: 'static + FeeEstimator, F::Target: 'static + FeeEstimator,
L: 'static + Logger, L::Target: 'static + Logger,
CM: 'static + ChannelMessageHandler, CM::Target: 'static + ChannelMessageHandler,
RM: 'static + RoutingMessageHandler, RM::Target: 'static + RoutingMessageHandler,
PM: 'static PM: 'static + Send + Fn(&ChannelManager<Signer, M, T, K, F, L>) -> Result<(), std::io::Error>,
+ Send
+ Fn(
&ChannelManager<Signer, Arc<M>, Arc<T>, Arc<K>, Arc<F>, Arc<L>>,
) -> Result<(), std::io::Error>,
{ {
let stop_thread = Arc::new(AtomicBool::new(false)); let stop_thread = Arc::new(AtomicBool::new(false));
let stop_thread_clone = stop_thread.clone(); let stop_thread_clone = stop_thread.clone();