From 2d194c9672c3f3afb3e292ffd3b19538b3212fdc Mon Sep 17 00:00:00 2001 From: "Johan T. Halseth" Date: Wed, 11 Sep 2019 12:26:52 +0200 Subject: [PATCH] htlcswitch/link: remove chan sync delay Earlier this delay was needed to increase the likelihood that the DLP scanario was successfully completed. Since we would risk the connection being torn down, and the link exit, we could end up with the remote marking the channel borked, but not finishing the force close. With the previous set of commits, we should now trigger the force close before we merk the channel borked, which should ensure we'll resume the orocess on next restart/connect. --- htlcswitch/link.go | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/htlcswitch/link.go b/htlcswitch/link.go index fc92a5e9..351a7623 100644 --- a/htlcswitch/link.go +++ b/htlcswitch/link.go @@ -615,21 +615,6 @@ func (l *channelLink) syncChanStates() error { "ChannelPoint(%v)", l.channel.ChannelPoint()) } - // If we have a restored channel, we'll delay sending our channel - // reestablish message briefly to ensure we first have a stable - // connection. Sending the message will cause the remote peer to force - // close the channel, which currently may not be resumed reliably if the - // connection is being torn down simultaneously. This delay can be - // removed after the force close is reliable, but in the meantime it - // improves the reliability of successfully closing out the channel. - if chanState.HasChanStatus(channeldb.ChanStatusRestored) { - select { - case <-time.After(5 * time.Second): - case <-l.quit: - return ErrLinkShuttingDown - } - } - if err := l.cfg.Peer.SendMessage(true, localChanSyncMsg); err != nil { return fmt.Errorf("Unable to send chan sync message for "+ "ChannelPoint(%v)", l.channel.ChannelPoint())