peer: update WipeChannel method to match recent htlcswitch API change

This commit is contained in:
Olaoluwa Osuntokun 2017-11-23 01:15:48 -06:00
parent 25082f0b5b
commit 1cf1d250b3
No known key found for this signature in database
GPG Key ID: 964EA263DD637C21

20
peer.go

@ -1932,22 +1932,20 @@ func (p *peer) sendShutdown(channel *lnwallet.LightningChannel,
// Prevent the HTLC switch from receiving additional HTLCs for this
// channel.
p.server.htlcSwitch.RemoveLink(chanID)
// WipeChannel removes the passed channel point from all indexes associated
// with the peer, and the switch.
func (p *peer) WipeChannel(chanPoint *wire.OutPoint) error {
return nil
}
// WipeChannel removes the passed channel from all indexes associated with the
// peer, and deletes the channel from the database.
func (p *peer) WipeChannel(channel *lnwallet.LightningChannel) error {
channel.Stop()
chanID := lnwire.NewChanIDFromOutPoint(channel.ChannelPoint())
chanID := lnwire.NewChanIDFromOutPoint(chanPoint)
p.activeChanMtx.Lock()
delete(p.activeChannels, chanID)
if channel, ok := p.activeChannels[chanID]; ok {
channel.Stop()
delete(p.activeChannels, chanID)
}
p.activeChanMtx.Unlock()
// Instruct the Htlc Switch to close this link as the channel is no
// Instruct the HtlcSwitch to close this link as the channel is no
// longer active.
if err := p.server.htlcSwitch.RemoveLink(chanID); err != nil {
if err == htlcswitch.ErrChannelLinkNotFound {