mirror of
https://github.com/lightningnetwork/lnd.git
synced 2024-11-19 09:53:54 +01:00
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)
|
||||
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()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user