You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Disconnect peers on timer ticks to unblock channel state machine
At times, we've noticed that channels with `lnd` counterparties do not
receive messages we expect to in a timely manner (or at all) after
sending them a `ChannelReestablish` upon reconnection, or a
`CommitmentSigned` message. This can block the channel state machine
from making progress, eventually leading to force closes, if any pending
HTLCs are committed and their expiration is met.
It seems common wisdom for `lnd` node operators to periodically restart
their node/reconnect to their peers, allowing them to start from a fresh
state such that the message we expect to receive hopefully gets sent. We
can achieve the same end result by disconnecting peers ourselves
(regardless of whether they're a `lnd` node), which we opt to implement
here by awaiting their response within two timer ticks.
// revoke_and_ack, not on sending commitment_signed, so we add one if have
4193
4221
// AwaitingRemoteRevoke set, which indicates we sent a commitment_signed but haven't gotten
4194
4222
// the corresponding revoke_and_ack back yet.
4195
-
let next_counterparty_commitment_number = INITIAL_COMMITMENT_NUMBER - self.cur_counterparty_commitment_transaction_number + if(self.channel_state&ChannelState::AwaitingRemoteRevokeasu32) != 0{1}else{0};
4223
+
let is_awaiting_remote_revoke = self.channel_state&ChannelState::AwaitingRemoteRevokeasu32 != 0;
4224
+
if is_awaiting_remote_revoke && !self.is_awaiting_monitor_update(){
4225
+
self.mark_awaiting_response();
4226
+
}
4227
+
let next_counterparty_commitment_number = INITIAL_COMMITMENT_NUMBER - self.cur_counterparty_commitment_transaction_number + if is_awaiting_remote_revoke {1}else{0};
4196
4228
4197
4229
let channel_ready = if msg.next_local_commitment_number == 1 && INITIAL_COMMITMENT_NUMBER - self.cur_holder_commitment_transaction_number == 1{
4198
4230
// We should never have to worry about MonitorUpdateInProgress resending ChannelReady
0 commit comments