From 0a11eb19ab8922dae6a827192d65661265d516e4 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Mon, 12 Apr 2021 12:20:38 -0400 Subject: [PATCH] Expand persistence to all ChannelManagers, not just Arc-based ones --- lightning-persister/src/lib.rs | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/lightning-persister/src/lib.rs b/lightning-persister/src/lib.rs index 368945d1c..8effedbce 100644 --- a/lightning-persister/src/lib.rs +++ b/lightning-persister/src/lib.rs @@ -29,7 +29,6 @@ use std::fs; use std::io::{Cursor, Error}; use std::ops::Deref; use std::path::{Path, PathBuf}; -use std::sync::Arc; /// FilesystemPersister persists channel data on disk, where each channel's /// data is stored in a file named after its funding outpoint. @@ -53,12 +52,12 @@ impl DiskWriteable for ChannelMonitor { } } -impl DiskWriteable for ChannelManager, Arc, Arc, Arc, Arc> -where M: chain::Watch, - T: BroadcasterInterface, - K: KeysInterface, - F: FeeEstimator, - L: Logger, +impl DiskWriteable for ChannelManager +where M::Target: chain::Watch, + T::Target: BroadcasterInterface, + K::Target: KeysInterface, + F::Target: FeeEstimator, + L::Target: Logger { fn write_to_file(&self, writer: &mut fs::File) -> Result<(), std::io::Error> { self.write(writer) @@ -87,16 +86,15 @@ impl FilesystemPersister { /// Writes the provided `ChannelManager` to the path provided at `FilesystemPersister` /// initialization, within a file called "manager". - pub fn persist_manager( + pub fn persist_manager( data_dir: String, - manager: &ChannelManager, Arc, Arc, Arc, Arc> + manager: &ChannelManager ) -> Result<(), std::io::Error> - where Signer: Sign, - M: chain::Watch, - T: BroadcasterInterface, - K: KeysInterface, - F: FeeEstimator, - L: Logger + where M::Target: chain::Watch, + T::Target: BroadcasterInterface, + K::Target: KeysInterface, + F::Target: FeeEstimator, + L::Target: Logger { let path = PathBuf::from(data_dir); util::write_to_file(path, "manager".to_string(), manager) -- 2.39.5