server: use blocking RemoveLink to shutdown links

This commit is contained in:
Conner Fromknecht 2018-07-12 17:39:59 -07:00 committed by Conner Fromknecht
parent c78e81d32b
commit a6e7b35872
No known key found for this signature in database
GPG Key ID: E7D737B67FA592C7

@ -646,7 +646,8 @@ func newServer(listenAddrs []net.Addr, chanDB *channeldb.DB, cc *chainControl,
ChainIO: cc.chainIO, ChainIO: cc.chainIO,
MarkLinkInactive: func(chanPoint wire.OutPoint) error { MarkLinkInactive: func(chanPoint wire.OutPoint) error {
chanID := lnwire.NewChanIDFromOutPoint(&chanPoint) chanID := lnwire.NewChanIDFromOutPoint(&chanPoint)
return s.htlcSwitch.RemoveLink(chanID) s.htlcSwitch.RemoveLink(chanID)
return nil
}, },
IsOurAddress: func(addr btcutil.Address) bool { IsOurAddress: func(addr btcutil.Address) bool {
_, err := cc.wallet.GetPrivKey(addr) _, err := cc.wallet.GetPrivKey(addr)
@ -1960,11 +1961,7 @@ func (s *server) peerTerminationWatcher(p *peer) {
} }
for _, link := range links { for _, link := range links {
err := p.server.htlcSwitch.RemoveLink(link.ChanID()) p.server.htlcSwitch.RemoveLink(link.ChanID())
if err != nil {
srvrLog.Errorf("unable to remove channel link: %v",
err)
}
} }
s.mu.Lock() s.mu.Lock()