peer: preallocate errchans opt
This commit is contained in:
parent
f39edd8000
commit
2e5bc783f7
3
peer.go
3
peer.go
@ -2380,6 +2380,9 @@ func (p *peer) sendMessage(sync, priority bool, msgs ...lnwire.Message) error {
|
|||||||
// chans is populated for each message if the caller requested a sync
|
// chans is populated for each message if the caller requested a sync
|
||||||
// send.
|
// send.
|
||||||
var errChans []chan error
|
var errChans []chan error
|
||||||
|
if sync {
|
||||||
|
errChans = make([]chan error, 0, len(msgs))
|
||||||
|
}
|
||||||
for _, msg := range msgs {
|
for _, msg := range msgs {
|
||||||
// If a sync send was requested, create an error chan to listen
|
// If a sync send was requested, create an error chan to listen
|
||||||
// for an ack from the writeHandler.
|
// for an ack from the writeHandler.
|
||||||
|
Loading…
Reference in New Issue
Block a user