diff --git a/chancloser.go b/chancloser.go index 00dff1bf..bcd0ec8b 100644 --- a/chancloser.go +++ b/chancloser.go @@ -223,6 +223,10 @@ func (c *channelCloser) initChanShutdown() (*lnwire.Shutdown, error) { "close: %v", c.chanPoint, err) } + // Before returning the shutdown message, we'll unregister the channel + // to ensure that it isn't seen as usable within the system. + c.cfg.unregisterChannel(c.cid) + // Before continuing, mark the channel as cooperatively closed with a // nil txn. Even though we haven't negotiated the final txn, this // guarantees that our listchannels rpc will be externally consistent, @@ -233,12 +237,6 @@ func (c *channelCloser) initChanShutdown() (*lnwire.Shutdown, error) { return nil, err } - // Before returning the shutdown message, we'll unregister the channel - // to ensure that it isn't seen as usable within the system. - // - // TODO(roasbeef): fail if err? - c.cfg.unregisterChannel(c.cid) - peerLog.Infof("ChannelPoint(%v): sending shutdown message", c.chanPoint) return shutdown, nil