Skip to content

Commit dc419ee

Browse files
committed
f rustfmt
1 parent 57606ac commit dc419ee

File tree

1 file changed

+17
-19
lines changed

1 file changed

+17
-19
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3656,39 +3656,40 @@ macro_rules! locked_close_channel {
36563656
}}
36573657
}
36583658

3659-
fn convert_channel_err_internal<Close: FnOnce(ClosureReason, &str) -> (ShutdownResult, Option<(msgs::ChannelUpdate, NodeId, NodeId)>)>(
3659+
fn convert_channel_err_internal<
3660+
Close: FnOnce(ClosureReason, &str) -> (ShutdownResult, Option<(msgs::ChannelUpdate, NodeId, NodeId)>),
3661+
>(
36603662
err: ChannelError, chan_id: ChannelId, close: Close,
36613663
) -> (bool, MsgHandleErrInternal) {
36623664
match err {
36633665
ChannelError::Warn(msg) => {
36643666
(false, MsgHandleErrInternal::from_chan_no_close(ChannelError::Warn(msg), chan_id))
36653667
},
3666-
ChannelError::WarnAndDisconnect(msg) => {
3667-
(false, MsgHandleErrInternal::from_chan_no_close(ChannelError::WarnAndDisconnect(msg), chan_id))
3668-
},
3668+
ChannelError::WarnAndDisconnect(msg) => (
3669+
false,
3670+
MsgHandleErrInternal::from_chan_no_close(ChannelError::WarnAndDisconnect(msg), chan_id),
3671+
),
36693672
ChannelError::Ignore(msg) => {
36703673
(false, MsgHandleErrInternal::from_chan_no_close(ChannelError::Ignore(msg), chan_id))
36713674
},
36723675
ChannelError::Abort(reason) => {
36733676
(false, MsgHandleErrInternal::from_chan_no_close(ChannelError::Abort(reason), chan_id))
36743677
},
36753678
ChannelError::Close((msg, reason)) => {
3676-
let (shutdown_res, chan_update) = close(reason, &msg);
3677-
(true, MsgHandleErrInternal::from_finish_shutdown(msg, chan_id, shutdown_res, chan_update))
3679+
let (finish, chan_update) = close(reason, &msg);
3680+
(true, MsgHandleErrInternal::from_finish_shutdown(msg, chan_id, finish, chan_update))
36783681
},
36793682
ChannelError::SendError(msg) => {
36803683
(false, MsgHandleErrInternal::from_chan_no_close(ChannelError::SendError(msg), chan_id))
36813684
},
36823685
}
36833686
}
36843687

3685-
fn convert_funded_channel_err_internal<
3686-
SP: Deref,
3687-
CM: AChannelManager<SP = SP>,
3688-
>(
3689-
cm: & CM, closed_channel_monitor_update_ids: &mut BTreeMap<ChannelId, u64>,
3690-
in_flight_monitor_updates: &mut BTreeMap<ChannelId, (OutPoint, Vec<ChannelMonitorUpdate>)>,
3691-
coop_close_shutdown_res: Option<ShutdownResult>, err: ChannelError, chan: &mut FundedChannel<SP>,
3688+
fn convert_funded_channel_err_internal<SP: Deref, CM: AChannelManager<SP = SP>>(
3689+
cm: &CM, closed_update_ids: &mut BTreeMap<ChannelId, u64>,
3690+
in_flight_updates: &mut BTreeMap<ChannelId, (OutPoint, Vec<ChannelMonitorUpdate>)>,
3691+
coop_close_shutdown_res: Option<ShutdownResult>, err: ChannelError,
3692+
chan: &mut FundedChannel<SP>,
36923693
) -> (bool, MsgHandleErrInternal)
36933694
where
36943695
SP::Target: SignerProvider,
@@ -3699,15 +3700,12 @@ where
36993700
let cm = cm.get_cm();
37003701
let logger = WithChannelContext::from(&cm.logger, &chan.context, None);
37013702

3702-
let mut shutdown_res = if let Some(res) = coop_close_shutdown_res {
3703-
res
3704-
} else {
3705-
chan.force_shutdown(reason)
3706-
};
3703+
let mut shutdown_res =
3704+
if let Some(res) = coop_close_shutdown_res { res } else { chan.force_shutdown(reason) };
37073705
let chan_update = cm.get_channel_update_for_broadcast(chan).ok();
37083706

37093707
log_error!(logger, "Closed channel {} due to close-required error: {}", chan_id, msg);
3710-
locked_close_channel!(cm, closed_channel_monitor_update_ids, in_flight_monitor_updates, chan, shutdown_res, FUNDED);
3708+
locked_close_channel!(cm, closed_update_ids, in_flight_updates, chan, shutdown_res, FUNDED);
37113709
(shutdown_res, chan_update)
37123710
})
37133711
}

0 commit comments

Comments
 (0)