diff --git a/contractcourt/chain_arbitrator.go b/contractcourt/chain_arbitrator.go index 9acfb4d0..a5c621bc 100644 --- a/contractcourt/chain_arbitrator.go +++ b/contractcourt/chain_arbitrator.go @@ -327,19 +327,22 @@ func (c *ChainArbitrator) Start() error { // For each open channel, we'll configure then launch a corresponding // ChannelArbitrator. for _, channel := range openChannels { + chanPoint := channel.FundingOutpoint + // First, we'll create an active chainWatcher for this channel // to ensure that we detect any relevant on chain events. chainWatcher, err := newChainWatcher( channel, c.cfg.Notifier, c.cfg.PreimageDB, c.cfg.Signer, c.cfg.IsOurAddress, func() error { - return c.resolveContract(channel.FundingOutpoint, nil) + // TODO(roasbeef): also need to pass in log? + return c.resolveContract(chanPoint, nil) }, ) if err != nil { return err } - c.activeWatchers[channel.FundingOutpoint] = chainWatcher + c.activeWatchers[chanPoint] = chainWatcher channelArb, err := newActiveChannelArbitrator( channel, c, chainWatcher.SubscribeChannelEvents(false), ) @@ -347,7 +350,7 @@ func (c *ChainArbitrator) Start() error { return err } - c.activeChannels[channel.FundingOutpoint] = channelArb + c.activeChannels[chanPoint] = channelArb } // In addition to the channels that we know to be open, we'll also diff --git a/contractcourt/chain_watcher.go b/contractcourt/chain_watcher.go index 3f403fb8..d974132a 100644 --- a/contractcourt/chain_watcher.go +++ b/contractcourt/chain_watcher.go @@ -782,11 +782,14 @@ func (c *CooperativeCloseCtx) LogPotentialClose(potentialClose *channeldb.Channe // pending closed in the database, then launch a goroutine to mark the channel // fully closed upon confirmation. func (c *CooperativeCloseCtx) Finalize(preferredClose *channeldb.ChannelCloseSummary) error { - log.Infof("Finalizing chan close for ChannelPoint(%v)", - c.watcher.chanState.FundingOutpoint) + chanPoint := c.watcher.chanState.FundingOutpoint + + log.Infof("Finalizing chan close for ChannelPoint(%v)", chanPoint) err := c.watcher.chanState.CloseChannel(preferredClose) if err != nil { + log.Errorf("closeCtx: unable to close ChannelPoint(%v): %v", + chanPoint, err) return err }