peer: preallocate errchans opt
This commit is contained in:
1 file changed
+3
@@ -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.
|
||||||
|
|||||||
Reference in new issue
Block a user