Skip to content

Commit 2356e05

Browse files
committed
Check dust exposure on receiving commitment_signed, not update_fee
We allow a peer to send an `update_fee` message that pushes the dust exposure over our max as long as they send HTLC updates that bring the dust exposure back down under the limit before they send `commitment_signed`.
1 parent 1ae5da1 commit 2356e05

File tree

4 files changed

+87
-185
lines changed

4 files changed

+87
-185
lines changed

lightning/src/ln/chanmon_update_fail_tests.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
//! There are a bunch of these as their handling is relatively error-prone so they are split out
1313
//! here. See also the chanmon_fail_consistency fuzz test.
1414
15+
use crate::chain::chaininterface::LowerBoundedFeeEstimator;
1516
use crate::chain::chainmonitor::ChainMonitor;
1617
use crate::chain::channelmonitor::{ChannelMonitor, MonitorEvent, ANTI_REORG_DELAY};
1718
use crate::chain::transaction::OutPoint;
@@ -133,9 +134,12 @@ fn test_monitor_and_persister_update_fail() {
133134
let chan_opt = get_channel_ref!(nodes[0], nodes[1], per_peer_lock, peer_state_lock, chan.2);
134135
if let Some(channel) = chan_opt.as_funded_mut() {
135136
assert_eq!(updates.commitment_signed.len(), 1);
136-
if let Ok(Some(update)) =
137-
channel.commitment_signed(&updates.commitment_signed[0], &node_cfgs[0].logger)
138-
{
137+
let feeest = LowerBoundedFeeEstimator::new(&chanmon_cfgs[0].fee_estimator);
138+
if let Ok(Some(update)) = channel.commitment_signed(
139+
&updates.commitment_signed[0],
140+
&feeest,
141+
&node_cfgs[0].logger,
142+
) {
139143
// Check that the persister returns InProgress (and will never actually complete)
140144
// as the monitor update errors.
141145
if let ChannelMonitorUpdateStatus::InProgress =

0 commit comments

Comments
 (0)