mirror of https://github.com/BTCPrivate/lnd.git
peer: ignore new channel requests for already active channels.
This commit is contained in:
parent
d981e12a3a
commit
ee2eec6188
13
peer.go
13
peer.go
|
@ -1003,10 +1003,19 @@ out:
|
||||||
chanID := lnwire.NewChanIDFromOutPoint(chanPoint)
|
chanID := lnwire.NewChanIDFromOutPoint(chanPoint)
|
||||||
newChan := newChanReq.channel
|
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
|
// channels, so we can look it up later easily
|
||||||
// according to its channel ID.
|
// according to its channel ID.
|
||||||
p.activeChanMtx.Lock()
|
|
||||||
p.activeChannels[chanID] = newChan
|
p.activeChannels[chanID] = newChan
|
||||||
p.activeChanMtx.Unlock()
|
p.activeChanMtx.Unlock()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue