Skip to content

Commit 6c01026

Browse files
committed
fixup: Make TxBuilder::get_next_commitment_stats fallible
1 parent 2cfe11d commit 6c01026

File tree

1 file changed

+28
-24
lines changed

1 file changed

+28
-24
lines changed

lightning/src/ln/channel.rs

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4292,18 +4292,20 @@ where
42924292
predicted_fee_sat: ret.commit_tx_fee_sat,
42934293
};
42944294
} else {
4295-
let predicted_stats = SpecTxBuilder {}.get_next_commitment_stats(
4296-
true,
4297-
funding.is_outbound(),
4298-
funding.get_value_satoshis(),
4299-
next_value_to_self_msat,
4300-
&next_commitment_htlcs,
4301-
0,
4302-
feerate_per_kw,
4303-
dust_exposure_limiting_feerate,
4304-
self.holder_dust_limit_satoshis,
4305-
funding.get_channel_type(),
4306-
)?;
4295+
let predicted_stats = SpecTxBuilder {}
4296+
.get_next_commitment_stats(
4297+
true,
4298+
funding.is_outbound(),
4299+
funding.get_value_satoshis(),
4300+
next_value_to_self_msat,
4301+
&next_commitment_htlcs,
4302+
0,
4303+
feerate_per_kw,
4304+
dust_exposure_limiting_feerate,
4305+
self.holder_dust_limit_satoshis,
4306+
funding.get_channel_type(),
4307+
)
4308+
.expect("Balance after HTLCs and anchors exhausted on local commitment");
43074309
*funding.next_local_fee.lock().unwrap() = PredictedNextFee {
43084310
predicted_feerate: feerate_per_kw,
43094311
predicted_nondust_htlc_count: predicted_stats.nondust_htlc_count,
@@ -4349,18 +4351,20 @@ where
43494351
predicted_fee_sat: ret.commit_tx_fee_sat,
43504352
};
43514353
} else {
4352-
let predicted_stats = SpecTxBuilder {}.get_next_commitment_stats(
4353-
false,
4354-
funding.is_outbound(),
4355-
funding.get_value_satoshis(),
4356-
next_value_to_self_msat,
4357-
&next_commitment_htlcs,
4358-
0,
4359-
feerate_per_kw,
4360-
dust_exposure_limiting_feerate,
4361-
self.counterparty_dust_limit_satoshis,
4362-
funding.get_channel_type(),
4363-
)?;
4354+
let predicted_stats = SpecTxBuilder {}
4355+
.get_next_commitment_stats(
4356+
false,
4357+
funding.is_outbound(),
4358+
funding.get_value_satoshis(),
4359+
next_value_to_self_msat,
4360+
&next_commitment_htlcs,
4361+
0,
4362+
feerate_per_kw,
4363+
dust_exposure_limiting_feerate,
4364+
self.counterparty_dust_limit_satoshis,
4365+
funding.get_channel_type(),
4366+
)
4367+
.expect("Balance after HTLCs and anchors exhausted on remote commitment");
43644368
*funding.next_remote_fee.lock().unwrap() = PredictedNextFee {
43654369
predicted_feerate: feerate_per_kw,
43664370
predicted_nondust_htlc_count: predicted_stats.nondust_htlc_count,

0 commit comments

Comments
 (0)