peer: preallocate errchans opt

This commit is contained in:
Conner Fromknecht 2019-03-05 17:08:35 -08:00
parent f39edd8000
commit 2e5bc783f7
No known key found for this signature in database
GPG Key ID: E7D737B67FA592C7

@ -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
// send.
var errChans []chan error
if sync {
errChans = make([]chan error, 0, len(msgs))
}
for _, msg := range msgs {
// If a sync send was requested, create an error chan to listen
// for an ack from the writeHandler.