Skip to content

Commit b94d8ea

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

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
@@ -3173,7 +3173,10 @@ impl<Signer: Sign> Channel<Signer> {
31733173
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;
31743174
let holder_balance_msat = commitment_stats.local_balance_msat - outbound_stats.holding_cell_msat;
31753175
if holder_balance_msat < buffer_fee_msat + self.counterparty_selected_channel_reserve_satoshis.unwrap() * 1000 {
3176-
//TODO: auto-close after a number of failures?
3176+
// If we're failing affordance, start a autoclose timer as the situation is
3177+
// likely unsafe due to a heavy-loaded channel, of which the feerate should
3178+
// become less and less compelling.
3179+
self.maybe_trigger_autoclose_timer(self.get_feerate(), feerate_per_kw, background_feerate);
31773180
log_debug!(logger, "Cannot afford to send new feerate at {}", feerate_per_kw);
31783181
return None;
31793182
}

0 commit comments

Comments
 (0)