Skip to content

Commit bf5efd7

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 017a33a commit bf5efd7

File tree

4 files changed

+87
-172
lines changed

4 files changed

+87
-172
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::channelmonitor::{ChannelMonitor, ANTI_REORG_DELAY};
1617
use crate::chain::{ChannelMonitorUpdateStatus, Listen, Watch};
1718
use crate::events::{ClosureReason, Event, HTLCHandlingFailureType, PaymentPurpose};
@@ -124,9 +125,12 @@ fn test_monitor_and_persister_update_fail() {
124125
let chan_opt = get_channel_ref!(nodes[0], nodes[1], per_peer_lock, peer_state_lock, chan.2);
125126
if let Some(channel) = chan_opt.as_funded_mut() {
126127
assert_eq!(updates.commitment_signed.len(), 1);
127-
if let Ok(Some(update)) =
128-
channel.commitment_signed(&updates.commitment_signed[0], &node_cfgs[0].logger)
129-
{
128+
let feeest = LowerBoundedFeeEstimator::new(&chanmon_cfgs[0].fee_estimator);
129+
if let Ok(Some(update)) = channel.commitment_signed(
130+
&updates.commitment_signed[0],
131+
&feeest,
132+
&node_cfgs[0].logger,
133+
) {
130134
// Check that the persister returns InProgress (and will never actually complete)
131135
// as the monitor update errors.
132136
if let ChannelMonitorUpdateStatus::InProgress =

0 commit comments

Comments
 (0)