Skip to content

Commit 8ad1493

Browse files
committed
fixup: Add TxBuilder::get_next_commitment_stats
Return a single `NextCommitmentStats`
1 parent caee5e8 commit 8ad1493

File tree

1 file changed

+25
-33
lines changed

1 file changed

+25
-33
lines changed

lightning/src/sign/tx_builder.rs

Lines changed: 25 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -222,39 +222,31 @@ impl TxBuilder for SpecTxBuilder {
222222
.sum();
223223

224224
// Count the excess fees on the counterparty's transaction as dust
225-
if let (Some(excess_feerate), false) = (excess_feerate_opt, local) {
226-
let (dust_exposure_msat, extra_htlc_dust_exposure_msat) =
227-
excess_fees_on_counterparty_tx_dust_exposure_msat(
228-
&next_commitment_htlcs,
229-
dust_buffer_feerate,
230-
excess_feerate,
231-
broadcaster_dust_limit_satoshis,
232-
dust_exposure_msat,
233-
channel_type,
234-
);
235-
NextCommitmentStats {
236-
inbound_htlcs_count,
237-
inbound_htlcs_value_msat,
238-
holder_balance_msat,
239-
counterparty_balance_msat,
240-
nondust_htlc_count,
241-
commit_tx_fee_sat,
242-
dust_exposure_msat,
243-
extra_nondust_htlc_on_counterparty_tx_dust_exposure_msat: Some(
244-
extra_htlc_dust_exposure_msat,
245-
),
246-
}
247-
} else {
248-
NextCommitmentStats {
249-
inbound_htlcs_count,
250-
inbound_htlcs_value_msat,
251-
holder_balance_msat,
252-
counterparty_balance_msat,
253-
nondust_htlc_count,
254-
commit_tx_fee_sat,
255-
dust_exposure_msat,
256-
extra_nondust_htlc_on_counterparty_tx_dust_exposure_msat: None,
257-
}
225+
let (dust_exposure_msat, extra_nondust_htlc_on_counterparty_tx_dust_exposure_msat) =
226+
if let (Some(excess_feerate), false) = (excess_feerate_opt, local) {
227+
let (dust_exposure_msat, extra_nondust_htlc_exposure_msat) =
228+
excess_fees_on_counterparty_tx_dust_exposure_msat(
229+
&next_commitment_htlcs,
230+
dust_buffer_feerate,
231+
excess_feerate,
232+
broadcaster_dust_limit_satoshis,
233+
dust_exposure_msat,
234+
channel_type,
235+
);
236+
(dust_exposure_msat, Some(extra_nondust_htlc_exposure_msat))
237+
} else {
238+
(dust_exposure_msat, None)
239+
};
240+
241+
NextCommitmentStats {
242+
inbound_htlcs_count,
243+
inbound_htlcs_value_msat,
244+
holder_balance_msat,
245+
counterparty_balance_msat,
246+
nondust_htlc_count,
247+
commit_tx_fee_sat,
248+
dust_exposure_msat,
249+
extra_nondust_htlc_on_counterparty_tx_dust_exposure_msat,
258250
}
259251
}
260252
fn commit_tx_fee_sat(

0 commit comments

Comments
 (0)