Use NewMsgInvSizeHint when we know the size.
When trickling inv's to peers, allocate for the number of inv's in the queue instead of the default 1000. This should save on memory.
This commit is contained in:
parent
527f585463
commit
bb8333a739
1 changed files with 2 additions and 2 deletions
4
peer.go
4
peer.go
|
@ -1670,7 +1670,7 @@ out:
|
|||
|
||||
// Create and send as many inv messages as needed to
|
||||
// drain the inventory send queue.
|
||||
invMsg := wire.NewMsgInv()
|
||||
invMsg := wire.NewMsgInvSizeHint(uint(invSendQueue.Len()))
|
||||
for e := invSendQueue.Front(); e != nil; e = invSendQueue.Front() {
|
||||
iv := invSendQueue.Remove(e).(*wire.InvVect)
|
||||
|
||||
|
@ -1685,7 +1685,7 @@ out:
|
|||
waiting = queuePacket(
|
||||
outMsg{msg: invMsg},
|
||||
pendingMsgs, waiting)
|
||||
invMsg = wire.NewMsgInv()
|
||||
invMsg = wire.NewMsgInvSizeHint(uint(invSendQueue.Len()))
|
||||
}
|
||||
|
||||
// Add the inventory that is being relayed to
|
||||
|
|
Loading…
Add table
Reference in a new issue