Merge pull request #4030 from halseth/route-cutoff-flake-fix

chancloser: unregister channel before db modification
This commit is contained in:
Johan T. Halseth 2020-03-04 13:14:32 +01:00 committed by GitHub
commit 42e65d4ae5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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