Skip to content

Commit cc97a7a

Browse files
committed
f rustfmt
1 parent 664c6cb commit cc97a7a

File tree

1 file changed

+30
-23
lines changed

1 file changed

+30
-23
lines changed

lightning/src/util/persist.rs

Lines changed: 30 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,7 @@ where
676676
&self, monitor_name: MonitorName, update: Option<&ChannelMonitorUpdate>,
677677
monitor: &ChannelMonitor<ChannelSigner>,
678678
) -> chain::ChannelMonitorUpdateStatus {
679-
let inner = Arc::clone(&self.0.0);
679+
let inner = Arc::clone(&self.0 .0);
680680
let res = poll_sync_future(inner.update_persisted_channel(monitor_name, update, monitor));
681681
match res {
682682
Ok(()) => chain::ChannelMonitorUpdateStatus::Completed,
@@ -706,7 +706,7 @@ where
706706
/// Unlike [`MonitorUpdatingPersister`], this does not implement [`Persist`], but is instead used
707707
/// directly by the [`ChainMonitor`].
708708
///
709-
/// [`ChainMonitor`]: lightning::chain::chainmonitor::ChainMonitor
709+
/// [`ChainMonitor`]: crate::chain::chainmonitor::ChainMonitor
710710
pub struct MonitorUpdatingPersisterAsync<
711711
K: Deref,
712712
S: FutureSpawner,
@@ -732,8 +732,7 @@ struct MonitorUpdatingPersisterAsyncInner<
732732
SP: Deref,
733733
BI: Deref,
734734
FE: Deref,
735-
>
736-
where
735+
> where
737736
K::Target: KVStore,
738737
L::Target: Logger,
739738
ES::Target: EntropySource + Sized,
@@ -840,15 +839,14 @@ where
840839
}
841840

842841
impl<
843-
K: Deref + MaybeSend + MaybeSync + 'static,
844-
S: FutureSpawner,
845-
L: Deref + MaybeSend + MaybeSync + 'static,
846-
ES: Deref + MaybeSend + MaybeSync + 'static,
847-
SP: Deref + MaybeSend + MaybeSync + 'static,
848-
BI: Deref + MaybeSend + MaybeSync + 'static,
849-
FE: Deref + MaybeSend + MaybeSync + 'static,
850-
>
851-
MonitorUpdatingPersisterAsync<K, S, L, ES, SP, BI, FE>
842+
K: Deref + MaybeSend + MaybeSync + 'static,
843+
S: FutureSpawner,
844+
L: Deref + MaybeSend + MaybeSync + 'static,
845+
ES: Deref + MaybeSend + MaybeSync + 'static,
846+
SP: Deref + MaybeSend + MaybeSync + 'static,
847+
BI: Deref + MaybeSend + MaybeSync + 'static,
848+
FE: Deref + MaybeSend + MaybeSync + 'static,
849+
> MonitorUpdatingPersisterAsync<K, S, L, ES, SP, BI, FE>
852850
where
853851
K::Target: KVStore + MaybeSync,
854852
L::Target: Logger,
@@ -859,7 +857,8 @@ where
859857
<SP::Target as SignerProvider>::EcdsaSigner: MaybeSend + 'static,
860858
{
861859
pub(crate) fn spawn_async_persist_new_channel(
862-
&self, monitor_name: MonitorName, monitor: &ChannelMonitor<<SP::Target as SignerProvider>::EcdsaSigner>,
860+
&self, monitor_name: MonitorName,
861+
monitor: &ChannelMonitor<<SP::Target as SignerProvider>::EcdsaSigner>,
863862
) {
864863
let inner = Arc::clone(&self.0);
865864
let future = inner.persist_new_channel(monitor_name, monitor);
@@ -898,17 +897,14 @@ where
898897
});
899898
}
900899

901-
pub(crate) fn spawn_async_archive_persisted_channel(
902-
&self, monitor_name: MonitorName,
903-
) {
900+
pub(crate) fn spawn_async_archive_persisted_channel(&self, monitor_name: MonitorName) {
904901
let inner = Arc::clone(&self.0);
905902
self.0.future_spawner.spawn(async move {
906903
inner.archive_persisted_channel(monitor_name).await;
907904
});
908905
}
909906
}
910907

911-
912908
impl<K: Deref, S: FutureSpawner, L: Deref, ES: Deref, SP: Deref, BI: Deref, FE: Deref>
913909
MonitorUpdatingPersisterAsyncInner<K, S, L, ES, SP, BI, FE>
914910
where
@@ -1076,7 +1072,10 @@ where
10761072
fn update_persisted_channel<'a, ChannelSigner: EcdsaChannelSigner + 'a>(
10771073
self: Arc<Self>, monitor_name: MonitorName, update: Option<&ChannelMonitorUpdate>,
10781074
monitor: &ChannelMonitor<ChannelSigner>,
1079-
) -> impl Future<Output = Result<(), io::Error>> + 'a where Self: 'a {
1075+
) -> impl Future<Output = Result<(), io::Error>> + 'a
1076+
where
1077+
Self: 'a,
1078+
{
10801079
const LEGACY_CLOSED_CHANNEL_UPDATE_ID: u64 = u64::MAX;
10811080
let mut res_a = None;
10821081
let mut res_b = None;
@@ -1093,9 +1092,12 @@ where
10931092
// write method, allowing it to do its queueing immediately, and then return a
10941093
// future for the completion of the write. This ensures monitor persistence
10951094
// ordering is preserved.
1096-
res_a = Some(self.kv_store
1097-
.write(primary, &monitor_key, update_name.as_str(), update.encode())
1098-
);
1095+
res_a = Some(self.kv_store.write(
1096+
primary,
1097+
&monitor_key,
1098+
update_name.as_str(),
1099+
update.encode(),
1100+
));
10991101
} else {
11001102
// We could write this update, but it meets criteria of our design that calls for a full monitor write.
11011103
// Note that this is NOT an async function, but rather calls the *sync* KVStore
@@ -1110,7 +1112,12 @@ where
11101112
if let Ok(()) = write_status {
11111113
if latest_update_id == LEGACY_CLOSED_CHANNEL_UPDATE_ID {
11121114
let monitor_key = monitor_name.to_string();
1113-
self.cleanup_stale_updates_for_monitor_to(&monitor_key, latest_update_id, true).await?;
1115+
self.cleanup_stale_updates_for_monitor_to(
1116+
&monitor_key,
1117+
latest_update_id,
1118+
true,
1119+
)
1120+
.await?;
11141121
} else {
11151122
let end = latest_update_id;
11161123
let start = end.saturating_sub(self.maximum_pending_updates);

0 commit comments

Comments
 (0)