Skip to content

Commit 3515d0e

Browse files
committed
validate_update_fee
1 parent 2770ebe commit 3515d0e

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

lightning/src/ln/channel.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4346,16 +4346,19 @@ where
43464346
let dust_exposure_limiting_feerate = self.get_dust_exposure_limiting_feerate(
43474347
&fee_estimator, funding.get_channel_type(),
43484348
);
4349-
let htlc_stats = self.get_pending_htlc_stats(funding, None, dust_exposure_limiting_feerate);
4349+
let next_local_commitment_stats = self.get_next_local_commitment_stats(funding, None, false, 0, msg.feerate_per_kw, dust_exposure_limiting_feerate);
4350+
let next_remote_commitment_stats = self.get_next_remote_commitment_stats(funding, None, false, 0, msg.feerate_per_kw, dust_exposure_limiting_feerate);
4351+
43504352
let max_dust_htlc_exposure_msat = self.get_max_dust_htlc_exposure_msat(dust_exposure_limiting_feerate);
4351-
if htlc_stats.on_holder_tx_dust_exposure_msat > max_dust_htlc_exposure_msat {
4353+
if next_local_commitment_stats.dust_exposure_msat > max_dust_htlc_exposure_msat {
43524354
return Err(ChannelError::close(format!("Peer sent update_fee with a feerate ({}) which may over-expose us to dust-in-flight on our own transactions (totaling {} msat)",
4353-
msg.feerate_per_kw, htlc_stats.on_holder_tx_dust_exposure_msat)));
4355+
msg.feerate_per_kw, next_local_commitment_stats.dust_exposure_msat)));
43544356
}
4355-
if htlc_stats.on_counterparty_tx_dust_exposure_msat > max_dust_htlc_exposure_msat {
4357+
if next_remote_commitment_stats.dust_exposure_msat > max_dust_htlc_exposure_msat {
43564358
return Err(ChannelError::close(format!("Peer sent update_fee with a feerate ({}) which may over-expose us to dust-in-flight on our counterparty's transactions (totaling {} msat)",
4357-
msg.feerate_per_kw, htlc_stats.on_counterparty_tx_dust_exposure_msat)));
4359+
msg.feerate_per_kw, next_remote_commitment_stats.dust_exposure_msat)));
43584360
}
4361+
43594362
Ok(())
43604363
}
43614364

0 commit comments

Comments
 (0)