lnd: buffer upstream/downstream channels for htlc managers
This commit is contained in:
parent
2bb65a3fb8
commit
c0a28e3b7f
8
peer.go
8
peer.go
@ -231,12 +231,12 @@ func (p *peer) loadActiveChannels(chans []*channeldb.OpenChannel) error {
|
|||||||
// Register this new channel link with the HTLC Switch. This is
|
// Register this new channel link with the HTLC Switch. This is
|
||||||
// necessary to properly route multi-hop payments, and forward
|
// necessary to properly route multi-hop payments, and forward
|
||||||
// new payments triggered by RPC clients.
|
// new payments triggered by RPC clients.
|
||||||
downstreamLink := make(chan *htlcPacket)
|
downstreamLink := make(chan *htlcPacket, 10)
|
||||||
plexChan := p.server.htlcSwitch.RegisterLink(p,
|
plexChan := p.server.htlcSwitch.RegisterLink(p,
|
||||||
dbChan.Snapshot(), downstreamLink)
|
dbChan.Snapshot(), downstreamLink)
|
||||||
|
|
||||||
// TODO(roasbeef): buffer?
|
// TODO(roasbeef): buffer?
|
||||||
upstreamLink := make(chan lnwire.Message)
|
upstreamLink := make(chan lnwire.Message, 10)
|
||||||
p.htlcManagers[chanPoint] = upstreamLink
|
p.htlcManagers[chanPoint] = upstreamLink
|
||||||
p.wg.Add(1)
|
p.wg.Add(1)
|
||||||
go p.htlcManager(lnChan, plexChan, downstreamLink, upstreamLink)
|
go p.htlcManager(lnChan, plexChan, downstreamLink, upstreamLink)
|
||||||
@ -579,14 +579,14 @@ out:
|
|||||||
// Now that the channel is open, notify the Htlc
|
// Now that the channel is open, notify the Htlc
|
||||||
// Switch of a new active link.
|
// Switch of a new active link.
|
||||||
chanSnapShot := newChan.StateSnapshot()
|
chanSnapShot := newChan.StateSnapshot()
|
||||||
downstreamLink := make(chan *htlcPacket)
|
downstreamLink := make(chan *htlcPacket, 10)
|
||||||
plexChan := p.server.htlcSwitch.RegisterLink(p,
|
plexChan := p.server.htlcSwitch.RegisterLink(p,
|
||||||
chanSnapShot, downstreamLink)
|
chanSnapShot, downstreamLink)
|
||||||
|
|
||||||
// With the channel registered to the HtlcSwitch spawn
|
// With the channel registered to the HtlcSwitch spawn
|
||||||
// a goroutine to handle commitment updates for this
|
// a goroutine to handle commitment updates for this
|
||||||
// new channel.
|
// new channel.
|
||||||
upstreamLink := make(chan lnwire.Message)
|
upstreamLink := make(chan lnwire.Message, 10)
|
||||||
p.htlcManagers[chanPoint] = upstreamLink
|
p.htlcManagers[chanPoint] = upstreamLink
|
||||||
p.wg.Add(1)
|
p.wg.Add(1)
|
||||||
go p.htlcManager(newChan, plexChan, downstreamLink, upstreamLink)
|
go p.htlcManager(newChan, plexChan, downstreamLink, upstreamLink)
|
||||||
|
Loading…
Reference in New Issue
Block a user