Skip to content

Commit 184efad

Browse files
committed
Don't generate a commitment if we cannot afford a holding cell feerate
While an `update_fee` is in the holding cell, it is possible though unlikely for HTLCs to get added to the commitment transaction such that when we release the holding cell, we can no longer afford this new feerate. In that case, we previously would drop the fee update, but still send a commitment (at the old feerate), which is a break of the specification. We now stop generating this lonely commitment when the fee update gets dropped upon release from the holding cell.
1 parent 6133a6c commit 184efad

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

lightning/src/ln/channel.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6275,14 +6275,11 @@ impl<SP: Deref> FundedChannel<SP> where
62756275
}
62766276
}
62776277
}
6278-
if update_add_count == 0 && update_fulfill_count == 0 && update_fail_count == 0 && self.context.holding_cell_update_fee.is_none() {
6278+
let update_fee = self.context.holding_cell_update_fee.take().and_then(|feerate| self.send_update_fee(feerate, false, fee_estimator, logger));
6279+
6280+
if update_add_count == 0 && update_fulfill_count == 0 && update_fail_count == 0 && update_fee.is_none() {
62796281
return (None, htlcs_to_fail);
62806282
}
6281-
let update_fee = if let Some(feerate) = self.context.holding_cell_update_fee.take() {
6282-
self.send_update_fee(feerate, false, fee_estimator, logger)
6283-
} else {
6284-
None
6285-
};
62866283

62876284
let mut additional_update = self.build_commitment_no_status_check(logger);
62886285
// build_commitment_no_status_check and get_update_fulfill_htlc may bump latest_monitor_id

0 commit comments

Comments
 (0)