Skip to content

Commit ffb1048

Browse files
author
Antoine Riard
committed
Start auto-close timer at outbound update fee failure.
1 parent d78cfa8 commit ffb1048

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lightning/src/ln/channel.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -3170,7 +3170,10 @@ impl<Signer: Sign> Channel<Signer> {
31703170
let buffer_fee_msat = Channel::<Signer>::commit_tx_fee_sat(feerate_per_kw, commitment_stats.num_nondust_htlcs + outbound_stats.on_holder_tx_holding_cell_htlcs_count as usize + CONCURRENT_INBOUND_HTLC_FEE_BUFFER as usize) * 1000;
31713171
let holder_balance_msat = commitment_stats.local_balance_msat - outbound_stats.holding_cell_msat;
31723172
if holder_balance_msat < buffer_fee_msat + self.counterparty_selected_channel_reserve_satoshis.unwrap() * 1000 {
3173-
//TODO: auto-close after a number of failures?
3173+
// If we're failing affordance, start a autoclose timer as the situation is
3174+
// likely unsafe due to a heavy-loaded channel, of which the feerate should
3175+
// become less and less compelling.
3176+
self.maybe_trigger_autoclose_timer(self.get_feerate(), feerate_per_kw);
31743177
log_debug!(logger, "Cannot afford to send new feerate at {}", feerate_per_kw);
31753178
return None;
31763179
}

0 commit comments

Comments
 (0)