From 1cf1d250b3a180fd89856255885b56e6c974a26a Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Thu, 23 Nov 2017 01:15:48 -0600 Subject: [PATCH] peer: update WipeChannel method to match recent htlcswitch API change --- peer.go | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/peer.go b/peer.go index 0115966e..2be53489 100644 --- a/peer.go +++ b/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 {