]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Correct indentation in `get_pending_htlc_stats`
authorMatt Corallo <git@bluematt.me>
Wed, 27 Mar 2024 02:21:40 +0000 (02:21 +0000)
committerMatt Corallo <git@bluematt.me>
Thu, 2 May 2024 15:39:03 +0000 (15:39 +0000)
The previous commit left indentation in `get_pending_htlc_stats`
deliberately wrong, to ease reviewability. This commit fixes the
indentation.

lightning/src/ln/channel.rs

index 20bb15ce7e00bbe8e4e7bc5ecc6b643978af0369..a56bb3dc9e689bb037a7cf0744b664d13f1e76c7 100644 (file)
@@ -2758,52 +2758,52 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider  {
 
                let mut pending_inbound_htlcs_value_msat = 0;
                {
-               let counterparty_dust_limit_timeout_sat = htlc_timeout_dust_limit + context.counterparty_dust_limit_satoshis;
-               let holder_dust_limit_success_sat = htlc_success_dust_limit + context.holder_dust_limit_satoshis;
-               for ref htlc in context.pending_inbound_htlcs.iter() {
-                       pending_inbound_htlcs_value_msat += htlc.amount_msat;
-                       if htlc.amount_msat / 1000 < counterparty_dust_limit_timeout_sat {
-                               on_counterparty_tx_dust_exposure_msat += htlc.amount_msat;
-                       }
-                       if htlc.amount_msat / 1000 < holder_dust_limit_success_sat {
-                               on_holder_tx_dust_exposure_msat += htlc.amount_msat;
+                       let counterparty_dust_limit_timeout_sat = htlc_timeout_dust_limit + context.counterparty_dust_limit_satoshis;
+                       let holder_dust_limit_success_sat = htlc_success_dust_limit + context.holder_dust_limit_satoshis;
+                       for ref htlc in context.pending_inbound_htlcs.iter() {
+                               pending_inbound_htlcs_value_msat += htlc.amount_msat;
+                               if htlc.amount_msat / 1000 < counterparty_dust_limit_timeout_sat {
+                                       on_counterparty_tx_dust_exposure_msat += htlc.amount_msat;
+                               }
+                               if htlc.amount_msat / 1000 < holder_dust_limit_success_sat {
+                                       on_holder_tx_dust_exposure_msat += htlc.amount_msat;
+                               }
                        }
                }
-               }
 
                let mut pending_outbound_htlcs_value_msat = 0;
                let mut outbound_holding_cell_msat = 0;
                let mut on_holder_tx_outbound_holding_cell_htlcs_count = 0;
                let mut pending_outbound_htlcs = self.pending_outbound_htlcs.len();
                {
-               let counterparty_dust_limit_success_sat = htlc_success_dust_limit + context.counterparty_dust_limit_satoshis;
-               let holder_dust_limit_timeout_sat = htlc_timeout_dust_limit + context.holder_dust_limit_satoshis;
-               for ref htlc in context.pending_outbound_htlcs.iter() {
-                       pending_outbound_htlcs_value_msat += htlc.amount_msat;
-                       if htlc.amount_msat / 1000 < counterparty_dust_limit_success_sat {
-                               on_counterparty_tx_dust_exposure_msat += htlc.amount_msat;
-                       }
-                       if htlc.amount_msat / 1000 < holder_dust_limit_timeout_sat {
-                               on_holder_tx_dust_exposure_msat += htlc.amount_msat;
+                       let counterparty_dust_limit_success_sat = htlc_success_dust_limit + context.counterparty_dust_limit_satoshis;
+                       let holder_dust_limit_timeout_sat = htlc_timeout_dust_limit + context.holder_dust_limit_satoshis;
+                       for ref htlc in context.pending_outbound_htlcs.iter() {
+                               pending_outbound_htlcs_value_msat += htlc.amount_msat;
+                               if htlc.amount_msat / 1000 < counterparty_dust_limit_success_sat {
+                                       on_counterparty_tx_dust_exposure_msat += htlc.amount_msat;
+                               }
+                               if htlc.amount_msat / 1000 < holder_dust_limit_timeout_sat {
+                                       on_holder_tx_dust_exposure_msat += htlc.amount_msat;
+                               }
                        }
-               }
 
-               for update in context.holding_cell_htlc_updates.iter() {
-                       if let &HTLCUpdateAwaitingACK::AddHTLC { ref amount_msat, .. } = update {
-                               pending_outbound_htlcs += 1;
-                               pending_outbound_htlcs_value_msat += amount_msat;
-                               outbound_holding_cell_msat += amount_msat;
-                               if *amount_msat / 1000 < counterparty_dust_limit_success_sat {
-                                       on_counterparty_tx_dust_exposure_msat += amount_msat;
-                               }
-                               if *amount_msat / 1000 < holder_dust_limit_timeout_sat {
-                                       on_holder_tx_dust_exposure_msat += amount_msat;
-                               } else {
-                                       on_holder_tx_outbound_holding_cell_htlcs_count += 1;
+                       for update in context.holding_cell_htlc_updates.iter() {
+                               if let &HTLCUpdateAwaitingACK::AddHTLC { ref amount_msat, .. } = update {
+                                       pending_outbound_htlcs += 1;
+                                       pending_outbound_htlcs_value_msat += amount_msat;
+                                       outbound_holding_cell_msat += amount_msat;
+                                       if *amount_msat / 1000 < counterparty_dust_limit_success_sat {
+                                               on_counterparty_tx_dust_exposure_msat += amount_msat;
+                                       }
+                                       if *amount_msat / 1000 < holder_dust_limit_timeout_sat {
+                                               on_holder_tx_dust_exposure_msat += amount_msat;
+                                       } else {
+                                               on_holder_tx_outbound_holding_cell_htlcs_count += 1;
+                                       }
                                }
                        }
                }
-               }
 
                HTLCStats {
                        pending_inbound_htlcs: self.pending_inbound_htlcs.len(),