Skip to content

Commit 3fdf252

Browse files
committed
Improve + fix indentation and style in lightning-persister
1 parent 6b2e179 commit 3fdf252

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

lightning-persister/src/lib.rs

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,12 @@ impl<Signer: Sign> DiskWriteable for ChannelMonitor<Signer> {
5252
}
5353

5454
impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> DiskWriteable for ChannelManager<Signer, M, T, K, F, L>
55-
where M::Target: chain::Watch<Signer>,
56-
T::Target: BroadcasterInterface,
57-
K::Target: KeysInterface<Signer=Signer>,
58-
F::Target: FeeEstimator,
59-
L::Target: Logger
55+
where
56+
M::Target: chain::Watch<Signer>,
57+
T::Target: BroadcasterInterface,
58+
K::Target: KeysInterface<Signer=Signer>,
59+
F::Target: FeeEstimator,
60+
L::Target: Logger,
6061
{
6162
fn write_to_file(&self, writer: &mut fs::File) -> Result<(), std::io::Error> {
6263
self.write(writer)
@@ -89,11 +90,12 @@ impl FilesystemPersister {
8990
data_dir: String,
9091
manager: &ChannelManager<Signer, M, T, K, F, L>
9192
) -> Result<(), std::io::Error>
92-
where M::Target: chain::Watch<Signer>,
93-
T::Target: BroadcasterInterface,
94-
K::Target: KeysInterface<Signer=Signer>,
95-
F::Target: FeeEstimator,
96-
L::Target: Logger
93+
where
94+
M::Target: chain::Watch<Signer>,
95+
T::Target: BroadcasterInterface,
96+
K::Target: KeysInterface<Signer=Signer>,
97+
F::Target: FeeEstimator,
98+
L::Target: Logger,
9799
{
98100
let path = PathBuf::from(data_dir);
99101
util::write_to_file(path, "manager".to_string(), manager)
@@ -103,7 +105,7 @@ impl FilesystemPersister {
103105
pub fn read_channelmonitors<Signer: Sign, K: Deref> (
104106
&self, keys_manager: K
105107
) -> Result<Vec<(BlockHash, ChannelMonitor<Signer>)>, std::io::Error>
106-
where K::Target: KeysInterface<Signer=Signer> + Sized
108+
where K::Target: KeysInterface<Signer=Signer> + Sized,
107109
{
108110
let path = self.path_to_monitor_data();
109111
if !Path::new(&path).exists() {
@@ -160,13 +162,13 @@ impl<ChannelSigner: Sign> channelmonitor::Persist<ChannelSigner> for FilesystemP
160162
fn persist_new_channel(&self, funding_txo: OutPoint, monitor: &ChannelMonitor<ChannelSigner>) -> Result<(), ChannelMonitorUpdateErr> {
161163
let filename = format!("{}_{}", funding_txo.txid.to_hex(), funding_txo.index);
162164
util::write_to_file(self.path_to_monitor_data(), filename, monitor)
163-
.map_err(|_| ChannelMonitorUpdateErr::PermanentFailure)
165+
.map_err(|_| ChannelMonitorUpdateErr::PermanentFailure)
164166
}
165167

166168
fn update_persisted_channel(&self, funding_txo: OutPoint, _update: &ChannelMonitorUpdate, monitor: &ChannelMonitor<ChannelSigner>) -> Result<(), ChannelMonitorUpdateErr> {
167169
let filename = format!("{}_{}", funding_txo.txid.to_hex(), funding_txo.index);
168170
util::write_to_file(self.path_to_monitor_data(), filename, monitor)
169-
.map_err(|_| ChannelMonitorUpdateErr::PermanentFailure)
171+
.map_err(|_| ChannelMonitorUpdateErr::PermanentFailure)
170172
}
171173
}
172174

0 commit comments

Comments
 (0)