From: Matt Corallo Date: Mon, 12 Apr 2021 21:59:11 +0000 (-0400) Subject: Improve + fix indentation and style in lightning-persister X-Git-Tag: v0.0.14~29^2 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=3fdf252bd3eb5edacaca0d4488c05778249569dd;p=rust-lightning Improve + fix indentation and style in lightning-persister --- diff --git a/lightning-persister/src/lib.rs b/lightning-persister/src/lib.rs index 74e05d4c..f6fbc635 100644 --- a/lightning-persister/src/lib.rs +++ b/lightning-persister/src/lib.rs @@ -52,11 +52,12 @@ impl DiskWriteable for ChannelMonitor { } impl DiskWriteable for ChannelManager -where M::Target: chain::Watch, - T::Target: BroadcasterInterface, - K::Target: KeysInterface, - F::Target: FeeEstimator, - L::Target: Logger +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) @@ -89,11 +90,12 @@ impl FilesystemPersister { data_dir: String, manager: &ChannelManager ) -> Result<(), std::io::Error> - where M::Target: chain::Watch, - T::Target: BroadcasterInterface, - K::Target: KeysInterface, - F::Target: FeeEstimator, - L::Target: 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) @@ -103,7 +105,7 @@ impl FilesystemPersister { pub fn read_channelmonitors ( &self, keys_manager: K ) -> Result)>, std::io::Error> - where K::Target: KeysInterface + Sized + where K::Target: KeysInterface + Sized, { let path = self.path_to_monitor_data(); if !Path::new(&path).exists() { @@ -160,13 +162,13 @@ impl channelmonitor::Persist for FilesystemP fn persist_new_channel(&self, funding_txo: OutPoint, monitor: &ChannelMonitor) -> Result<(), ChannelMonitorUpdateErr> { let filename = format!("{}_{}", funding_txo.txid.to_hex(), funding_txo.index); util::write_to_file(self.path_to_monitor_data(), filename, monitor) - .map_err(|_| ChannelMonitorUpdateErr::PermanentFailure) + .map_err(|_| ChannelMonitorUpdateErr::PermanentFailure) } fn update_persisted_channel(&self, funding_txo: OutPoint, _update: &ChannelMonitorUpdate, monitor: &ChannelMonitor) -> Result<(), ChannelMonitorUpdateErr> { let filename = format!("{}_{}", funding_txo.txid.to_hex(), funding_txo.index); util::write_to_file(self.path_to_monitor_data(), filename, monitor) - .map_err(|_| ChannelMonitorUpdateErr::PermanentFailure) + .map_err(|_| ChannelMonitorUpdateErr::PermanentFailure) } }