Skip to content

Commit 2f3c0f9

Browse files
committed
f - split functions into multiple lines consistently
1 parent 2c0c4d2 commit 2f3c0f9

File tree

2 files changed

+33
-16
lines changed

2 files changed

+33
-16
lines changed

lightning/src/ln/channel.rs

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,7 +1061,7 @@ impl<Signer: ChannelSigner> ChannelContext<Signer> {
10611061

10621062
pub fn get_max_dust_htlc_exposure_msat<F: Deref>(&self,
10631063
_fee_estimator: &LowerBoundedFeeEstimator<F>) -> u64
1064-
where F::Target: FeeEstimator
1064+
where F::Target: FeeEstimator
10651065
{
10661066
match self.config.options.max_dust_htlc_exposure_msat {
10671067
MaxDustHTLCExposure::FixedLimitMsat(limit) => limit,
@@ -1539,8 +1539,9 @@ impl<Signer: ChannelSigner> ChannelContext<Signer> {
15391539
/// Doesn't bother handling the
15401540
/// if-we-removed-it-already-but-haven't-fully-resolved-they-can-still-send-an-inbound-HTLC
15411541
/// corner case properly.
1542-
pub fn get_available_balances<F: Deref>(&self, fee_estimator: &LowerBoundedFeeEstimator<F>) -> AvailableBalances
1543-
where F::Target: FeeEstimator
1542+
pub fn get_available_balances<F: Deref>(&self, fee_estimator: &LowerBoundedFeeEstimator<F>)
1543+
-> AvailableBalances
1544+
where F::Target: FeeEstimator
15441545
{
15451546
let context = &self;
15461547
// Note that we have to handle overflow due to the above case.
@@ -2561,9 +2562,13 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
25612562
Ok(self.get_announcement_sigs(node_signer, genesis_block_hash, user_config, best_block.height(), logger))
25622563
}
25632564

2564-
pub fn update_add_htlc<F, FE: Deref, L: Deref>(&mut self, msg: &msgs::UpdateAddHTLC, mut pending_forward_status: PendingHTLCStatus, create_pending_htlc_status: F, fee_estimator: &LowerBoundedFeeEstimator<FE>, logger: &L) -> Result<(), ChannelError>
2565+
pub fn update_add_htlc<F, FE: Deref, L: Deref>(
2566+
&mut self, msg: &msgs::UpdateAddHTLC, mut pending_forward_status: PendingHTLCStatus,
2567+
create_pending_htlc_status: F, fee_estimator: &LowerBoundedFeeEstimator<FE>, logger: &L
2568+
) -> Result<(), ChannelError>
25652569
where F: for<'a> Fn(&'a Self, PendingHTLCStatus, u16) -> PendingHTLCStatus,
2566-
FE::Target: FeeEstimator, L::Target: Logger {
2570+
FE::Target: FeeEstimator, L::Target: Logger,
2571+
{
25672572
// We can't accept HTLCs sent after we've sent a shutdown.
25682573
let local_sent_shutdown = (self.context.channel_state & (ChannelState::ChannelReady as u32 | ChannelState::LocalShutdownSent as u32)) != (ChannelState::ChannelReady as u32);
25692574
if local_sent_shutdown {
@@ -3006,7 +3011,11 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
30063011
/// Public version of the below, checking relevant preconditions first.
30073012
/// If we're not in a state where freeing the holding cell makes sense, this is a no-op and
30083013
/// returns `(None, Vec::new())`.
3009-
pub fn maybe_free_holding_cell_htlcs<F: Deref, L: Deref>(&mut self, fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L) -> (Option<ChannelMonitorUpdate>, Vec<(HTLCSource, PaymentHash)>) where F::Target: FeeEstimator, L::Target: Logger {
3014+
pub fn maybe_free_holding_cell_htlcs<F: Deref, L: Deref>(
3015+
&mut self, fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L
3016+
) -> (Option<ChannelMonitorUpdate>, Vec<(HTLCSource, PaymentHash)>)
3017+
where F::Target: FeeEstimator, L::Target: Logger
3018+
{
30103019
if self.context.channel_state >= ChannelState::ChannelReady as u32 &&
30113020
(self.context.channel_state & (ChannelState::AwaitingRemoteRevoke as u32 | ChannelState::PeerDisconnected as u32 | ChannelState::MonitorUpdateInProgress as u32)) == 0 {
30123021
self.free_holding_cell_htlcs(fee_estimator, logger)
@@ -3015,7 +3024,9 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
30153024

30163025
/// Frees any pending commitment updates in the holding cell, generating the relevant messages
30173026
/// for our counterparty.
3018-
fn free_holding_cell_htlcs<F: Deref, L: Deref>(&mut self, fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L) -> (Option<ChannelMonitorUpdate>, Vec<(HTLCSource, PaymentHash)>)
3027+
fn free_holding_cell_htlcs<F: Deref, L: Deref>(
3028+
&mut self, fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L
3029+
) -> (Option<ChannelMonitorUpdate>, Vec<(HTLCSource, PaymentHash)>)
30193030
where F::Target: FeeEstimator, L::Target: Logger
30203031
{
30213032
assert_eq!(self.context.channel_state & ChannelState::MonitorUpdateInProgress as u32, 0);
@@ -3133,7 +3144,9 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
31333144
/// waiting on this revoke_and_ack. The generation of this new commitment_signed may also fail,
31343145
/// generating an appropriate error *after* the channel state has been updated based on the
31353146
/// revoke_and_ack message.
3136-
pub fn revoke_and_ack<F: Deref, L: Deref>(&mut self, msg: &msgs::RevokeAndACK, fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L) -> Result<(Vec<(HTLCSource, PaymentHash)>, Option<ChannelMonitorUpdate>), ChannelError>
3147+
pub fn revoke_and_ack<F: Deref, L: Deref>(&mut self, msg: &msgs::RevokeAndACK,
3148+
fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L
3149+
) -> Result<(Vec<(HTLCSource, PaymentHash)>, Option<ChannelMonitorUpdate>), ChannelError>
31373150
where F::Target: FeeEstimator, L::Target: Logger,
31383151
{
31393152
if (self.context.channel_state & (ChannelState::ChannelReady as u32)) != (ChannelState::ChannelReady as u32) {
@@ -3371,7 +3384,7 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
33713384
/// commitment update.
33723385
pub fn queue_update_fee<F: Deref, L: Deref>(&mut self, feerate_per_kw: u32,
33733386
fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L)
3374-
where F::Target: FeeEstimator, L::Target: Logger
3387+
where F::Target: FeeEstimator, L::Target: Logger
33753388
{
33763389
let msg_opt = self.send_update_fee(feerate_per_kw, true, fee_estimator, logger);
33773390
assert!(msg_opt.is_none(), "We forced holding cell?");
@@ -3384,7 +3397,10 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
33843397
///
33853398
/// You MUST call [`Self::send_commitment_no_state_update`] prior to any other calls on this
33863399
/// [`Channel`] if `force_holding_cell` is false.
3387-
fn send_update_fee<F: Deref, L: Deref>(&mut self, feerate_per_kw: u32, mut force_holding_cell: bool, fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L) -> Option<msgs::UpdateFee>
3400+
fn send_update_fee<F: Deref, L: Deref>(
3401+
&mut self, feerate_per_kw: u32, mut force_holding_cell: bool,
3402+
fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L
3403+
) -> Option<msgs::UpdateFee>
33883404
where F::Target: FeeEstimator, L::Target: Logger
33893405
{
33903406
if !self.context.is_outbound() {
@@ -5013,7 +5029,7 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
50135029
onion_routing_packet: msgs::OnionPacket, skimmed_fee_msat: Option<u64>,
50145030
fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L
50155031
) -> Result<(), ChannelError>
5016-
where F::Target: FeeEstimator, L::Target: Logger
5032+
where F::Target: FeeEstimator, L::Target: Logger
50175033
{
50185034
self
50195035
.send_htlc(amount_msat, payment_hash, cltv_expiry, source, onion_routing_packet, true,
@@ -5047,7 +5063,7 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
50475063
onion_routing_packet: msgs::OnionPacket, mut force_holding_cell: bool,
50485064
skimmed_fee_msat: Option<u64>, fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L
50495065
) -> Result<Option<msgs::UpdateAddHTLC>, ChannelError>
5050-
where F::Target: FeeEstimator, L::Target: Logger
5066+
where F::Target: FeeEstimator, L::Target: Logger
50515067
{
50525068
if (self.context.channel_state & (ChannelState::ChannelReady as u32 | BOTH_SIDES_SHUTDOWN_MASK)) != (ChannelState::ChannelReady as u32) {
50535069
return Err(ChannelError::Ignore("Cannot send HTLC until channel is fully established and we haven't started shutting down".to_owned()));
@@ -5262,8 +5278,8 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
52625278
/// Shorthand for calling [`Self::send_htlc`] followed by a commitment update, see docs on
52635279
/// [`Self::send_htlc`] and [`Self::build_commitment_no_state_update`] for more info.
52645280
pub fn send_htlc_and_commit<F: Deref, L: Deref>(
5265-
&mut self, amount_msat: u64, payment_hash: PaymentHash, cltv_expiry: u32, source: HTLCSource,
5266-
onion_routing_packet: msgs::OnionPacket, skimmed_fee_msat: Option<u64>,
5281+
&mut self, amount_msat: u64, payment_hash: PaymentHash, cltv_expiry: u32,
5282+
source: HTLCSource, onion_routing_packet: msgs::OnionPacket, skimmed_fee_msat: Option<u64>,
52675283
fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L
52685284
) -> Result<Option<ChannelMonitorUpdate>, ChannelError>
52695285
where F::Target: FeeEstimator, L::Target: Logger

lightning/src/ln/channelmanager.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1505,8 +1505,9 @@ impl ChannelDetails {
15051505

15061506
fn from_channel_context<Signer: WriteableEcdsaChannelSigner, F: Deref>(
15071507
context: &ChannelContext<Signer>, best_block_height: u32, latest_features: InitFeatures,
1508-
fee_estimator: &LowerBoundedFeeEstimator<F>) -> Self
1509-
where F::Target: FeeEstimator
1508+
fee_estimator: &LowerBoundedFeeEstimator<F>
1509+
) -> Self
1510+
where F::Target: FeeEstimator
15101511
{
15111512

15121513
let balance = context.get_available_balances(fee_estimator);

0 commit comments

Comments
 (0)