peer: ignore new channel requests for already active channels.

This commit is contained in:
Johan T. Halseth 2017-10-02 13:11:26 +02:00
parent d981e12a3a
commit ee2eec6188
No known key found for this signature in database
GPG Key ID: 15BAADA29DA20D26

13
peer.go
View File

@ -1003,10 +1003,19 @@ out:
chanID := lnwire.NewChanIDFromOutPoint(chanPoint)
newChan := newChanReq.channel
// First, we'll add this channel to the set of active
// Make sure this channel is not already active.
p.activeChanMtx.Lock()
if _, ok := p.activeChannels[chanID]; ok {
peerLog.Infof("Already have ChannelPoint(%v), ignoring.", chanPoint)
p.activeChanMtx.Unlock()
close(newChanReq.done)
newChanReq.channel.Stop()
continue
}
// If not already active, we'll add this channel to the set of active
// channels, so we can look it up later easily
// according to its channel ID.
p.activeChanMtx.Lock()
p.activeChannels[chanID] = newChan
p.activeChanMtx.Unlock()