Skip to content

Commit 345f5db

Browse files
committed
Cleanup the style of tx_builder::subtract_addl_outputs
Makes it consistent with `get_balances_including_fee`, itself added in the previous commit.
1 parent 5f59aed commit 345f5db

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

lightning/src/sign/tx_builder.rs

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -110,21 +110,19 @@ fn subtract_addl_outputs(
110110
// commitment transaction *before* checking whether the remote party's balance is enough to
111111
// cover the total anchor sum.
112112

113-
let local_balance_before_fee_msat = if is_outbound_from_holder {
114-
value_to_self_after_htlcs_msat
115-
.and_then(|balance_msat| balance_msat.checked_sub(total_anchors_sat * 1000))
116-
} else {
117-
value_to_self_after_htlcs_msat
118-
};
119-
120-
let remote_balance_before_fee_msat = if !is_outbound_from_holder {
121-
value_to_remote_after_htlcs_msat
122-
.and_then(|balance_msat| balance_msat.checked_sub(total_anchors_sat * 1000))
113+
if is_outbound_from_holder {
114+
(
115+
value_to_self_after_htlcs_msat
116+
.and_then(|balance_msat| balance_msat.checked_sub(total_anchors_sat * 1000)),
117+
value_to_remote_after_htlcs_msat,
118+
)
123119
} else {
124-
value_to_remote_after_htlcs_msat
125-
};
126-
127-
(local_balance_before_fee_msat, remote_balance_before_fee_msat)
120+
(
121+
value_to_self_after_htlcs_msat,
122+
value_to_remote_after_htlcs_msat
123+
.and_then(|balance_msat| balance_msat.checked_sub(total_anchors_sat * 1000)),
124+
)
125+
}
128126
}
129127

130128
fn get_dust_buffer_feerate(feerate_per_kw: u32) -> u32 {

0 commit comments

Comments
 (0)