From e003b67418af511d80514d6499e1e81d20c0951a Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Tue, 18 Oct 2022 22:57:55 +0300 Subject: [PATCH] network: reuse inventory hash list for request hashes Microoptimization, we can do this because we only use them in handleInvCmd(). --- pkg/network/server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/network/server.go b/pkg/network/server.go index 092ddfc9c..364ff30bd 100644 --- a/pkg/network/server.go +++ b/pkg/network/server.go @@ -751,7 +751,7 @@ func (s *Server) handlePong(p Peer, pong *payload.Ping) error { // handleInvCmd processes the received inventory. func (s *Server) handleInvCmd(p Peer, inv *payload.Inventory) error { - reqHashes := make([]util.Uint256, 0) + var reqHashes = inv.Hashes[:0] var typExists = map[payload.InventoryType]func(util.Uint256) bool{ payload.TXType: s.mempool.ContainsKey, payload.BlockType: s.chain.HasBlock,