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.
This commit is contained in:
Joost Jager
2020-03-12 14:08:06 +01:00
parent 29e1489179
commit c0b1b3be14

View File

@@ -354,9 +354,6 @@ func (c *ChannelArbitrator) Start() error {
return err return err
} }
log.Infof("ChannelArbitrator(%v): starting state=%v", c.cfg.ChanPoint,
c.state)
_, bestHeight, err := c.cfg.ChainIO.GetBestBlock() _, bestHeight, err := c.cfg.ChainIO.GetBestBlock()
if err != nil { if err != nil {
c.cfg.BlockEpochs.Cancel() c.cfg.BlockEpochs.Cancel()
@@ -391,14 +388,19 @@ func (c *ChannelArbitrator) Start() error {
case channeldb.RemoteForceClose: case channeldb.RemoteForceClose:
trigger = remoteCloseTrigger trigger = remoteCloseTrigger
} }
triggerHeight = c.cfg.ClosingHeight
log.Warnf("ChannelArbitrator(%v): detected stalled "+ log.Warnf("ChannelArbitrator(%v): detected stalled "+
"state=%v for closed channel, using "+ "state=%v for closed channel",
"trigger=%v", c.cfg.ChanPoint, c.state, trigger) 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 // 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 // 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 // older nodes, this won't be found at all, and will rely on the