From c0b1b3be140637b27889ccdb14cf2eaa08331a29 Mon Sep 17 00:00:00 2001 From: Joost Jager Date: Thu, 12 Mar 2020 14:08:06 +0100 Subject: [PATCH] cnct: always set trigger height to close height Prior to this change, the trigger height for closed channels was set to the current best block height. As this height is in some cases used as a height hint, the spend may have been missed. --- contractcourt/channel_arbitrator.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/contractcourt/channel_arbitrator.go b/contractcourt/channel_arbitrator.go index 2a58ea52..1c4ee8e8 100644 --- a/contractcourt/channel_arbitrator.go +++ b/contractcourt/channel_arbitrator.go @@ -354,9 +354,6 @@ func (c *ChannelArbitrator) Start() error { return err } - log.Infof("ChannelArbitrator(%v): starting state=%v", c.cfg.ChanPoint, - c.state) - _, bestHeight, err := c.cfg.ChainIO.GetBestBlock() if err != nil { c.cfg.BlockEpochs.Cancel() @@ -391,14 +388,19 @@ func (c *ChannelArbitrator) Start() error { case channeldb.RemoteForceClose: trigger = remoteCloseTrigger } - triggerHeight = c.cfg.ClosingHeight log.Warnf("ChannelArbitrator(%v): detected stalled "+ - "state=%v for closed channel, using "+ - "trigger=%v", c.cfg.ChanPoint, c.state, trigger) + "state=%v for closed channel", + c.cfg.ChanPoint, c.state) } + + triggerHeight = c.cfg.ClosingHeight } + log.Infof("ChannelArbitrator(%v): starting state=%v, trigger=%v, "+ + "triggerHeight=%v", c.cfg.ChanPoint, c.state, trigger, + triggerHeight) + // Next we'll fetch our confirmed commitment set. This will only exist // if the channel has been closed out on chain for modern nodes. For // older nodes, this won't be found at all, and will rely on the