@@ -386,6 +386,9 @@ pub(super) struct Channel<Signer: Sign> {
386
386
// Auto-close timer, if the channel is outbound, we sent a `update_fee`, and we didn't
387
387
// receive a RAA from counterparty committing this state after `AUTOCLOSE_TIMEOUT` periods,
388
388
// this channel must be force-closed.
389
+ // If the channel is inbound, it has been observed the channel feerate should increase,
390
+ // and we didn't receive a RAA from counterparty committing an `update_fee` after
391
+ // `AUTOCLOSE_TIMEOUT` periods, this channel must be force-closed.
389
392
autoclose_timer : u16 ,
390
393
391
394
holder_signer : Signer ,
@@ -2722,15 +2725,17 @@ impl<Signer: Sign> Channel<Signer> {
2722
2725
}
2723
2726
2724
2727
/// Trigger the autoclose timer if it's in the starting position
2725
- fn maybe_trigger_autoclose_timer ( & mut self ) {
2728
+ pub fn maybe_trigger_autoclose_timer ( & mut self ) -> bool {
2726
2729
// Start an auto-close timer, if the channel feerate doesn't increase before its
2727
2730
// expiration (i.e this outbound feerate update has been committed on both sides),
2728
2731
// the channel will be marked as unsafe and force-closed.
2729
2732
// If a timer is already pending, no-op, as a higher-feerate `update_fee` will
2730
2733
// implicitly override a lower-feerate `update_fee` part of the same update sequence.
2731
2734
if self . autoclose_timer == 0 {
2732
2735
self . autoclose_timer = 1 ;
2736
+ return true ;
2733
2737
}
2738
+ return false ;
2734
2739
}
2735
2740
2736
2741
/// Handles receiving a remote's revoke_and_ack. Note that we may return a new
@@ -2907,6 +2912,7 @@ impl<Signer: Sign> Channel<Signer> {
2907
2912
require_commitment = true ;
2908
2913
self . feerate_per_kw = feerate;
2909
2914
self . pending_update_fee = None ;
2915
+ self . autoclose_timer = 0 ;
2910
2916
} ,
2911
2917
}
2912
2918
}
@@ -4712,6 +4718,7 @@ impl<Signer: Sign> Channel<Signer> {
4712
4718
log_trace ! ( logger, " ...promoting inbound AwaitingRemoteRevokeToAnnounce fee update {} to Committed" , feerate) ;
4713
4719
self . feerate_per_kw = feerate;
4714
4720
self . pending_update_fee = None ;
4721
+ self . autoclose_timer = 0 ;
4715
4722
}
4716
4723
}
4717
4724
self . resend_order = RAACommitmentOrder :: RevokeAndACKFirst ;
0 commit comments